secabstraction / PowerCat

A PowerShell TCP/IP swiss army knife.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

odd error on failed tcp stream

isaacl opened this issue · comments

PS C:\Users\Isaac> Connect-PowerCat -RemoteIp 10.1.1.1 -Port 443 -Execute
WARNING: Connection to 10.1.1.1:443 [tcp] failed. Exception calling "EndConnect" with "1" argument(s): "No connection
could be made because the target machine actively refused it 10.1.1.1:443"
WARNING: Failed to open Tcp stream. Method invocation failed because [System.Net.Sockets.TcpClient] doesn't contain a
method named 'Dispose'.
WARNING: Tcp connection broken, exiting.
WARNING: Failed to dispose Tcp socket. You cannot call a method on a null-valued expression..

commented

"No connection could be made because the target machine actively refused it 10.1.1.1:443"

This means the firewall on that machine blocked it, all the rest are a waterfall of the blocked connection. I put in a lot of warning messages for trouble shooting. These will likely be changed to verbose outputs soon.

On Nov 11, 2015, at 2:48 PM, Isaac Levy notifications@github.com wrote:

"No connection
could be made because the target machine actively refused it 10.1.1.1:443"

The bug was about

Method invocation failed because [System.Net.Sockets.TcpClient] doesn't contain a method named 'Dispose'.

and

Failed to dispose Tcp socket. You cannot call a method on a null-valued expression..

commented

You're right. It seems the older CLR in v2.0 didn't have the dispose method. The last one is now a verbose message in the cleanup routine. Since the socket get's closed during the connection attempt, there's no socket to close when it hits the cleanup routine, thus it is null. Try it now.