Living off the land technique: Using PowerShell to scan ports

I just read up on an interesting technique to perform scan ports from a Windows machine using PowerShell.

$target = “192.168.1.95”
22,80,135,139,443,445,3389,5900 | % {echo ((New-Object net.sockets.tcpclient).connect(“$target”,$_)) “$target has port $_ open”} 2>out-null | Out-File OpenPorts.txt

This will scan ports 22, 80, 135, 139, 443, 445, 3389 and 5900 on the host IP of 192.168.1.95  and will write the results to the text file OpenPorts.txt.

Happy New Years 2019!

Team RunCMD and Friends,

I hope you had a great 2018 and are looking forward to kicking ass in 2019!

PS., KringleCon runs through January 14th, 2019 if you haven’t had an opportunity to try it out yet.