Skip to content

Instantly share code, notes, and snippets.

View INCENDE's full-sized avatar
👀
Looking at your repos

Justin INCENDE

👀
Looking at your repos
  • Singapore
View GitHub Profile
@INCENDE
INCENDE / receivefile.ps1
Created June 16, 2025 03:16 — forked from staaldraad/receivefile.ps1
Small powershell script to bind to port, accept connection and stream to file. useful for ```cat blah.exe | nc 192.168.1.7 8080```
$socket = new-object System.Net.Sockets.TcpListener('0.0.0.0', 1080);
if($socket -eq $null){
exit 1;
}
$socket.start();
$client = $socket.AcceptTcpClient();
$stream = $client.GetStream();
$buffer = new-object System.Byte[] 2048;
$file = 'c:/afile.exe';
$fileStream = New-Object System.IO.FileStream($file, [System.IO.FileMode]'Create', [System.IO.FileAccess]'Write');