Created
July 25, 2017 08:24
-
-
Save aduzsardi/653b22002d77e6437ec526cf10ef85df to your computer and use it in GitHub Desktop.
Netcat usage examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.rationallyparanoid.com/articles/netcat.html | |
Netcat usage examples | |
The following commands were done on the Linux version of Netcat. | |
Connect to TCP port 80 on host example.com: | |
nc -vv example.com 80 | |
Port scan TCP ports 7 through 1023 on host example.com | |
nc -v -z example.com 7-1023 | |
Port scan TCP ports 7 through 1023 on host example.com, but stop for user interaction on open ports | |
nc -v example.com 7-1023 | |
Port scan UDP ports 53 through 69 on host example.com | |
nc -v -z -u example.com 53-69 | |
Listen for inbound connections on TCP port 1234 and pipe the results to a file data.txt | |
nc -vv -l 1234 > data.txt | |
Listen for inbound connections on TCP port 25 and pipe the results to /dev/null | |
nc -vv -l 25 > /dev/null | |
Listen for inbound connections on TCP port 25 and pipe the results to /dev/null, but keep listening on the port even after a disconnect. | |
nc -vv -k -l 25 > /dev/null | |
Listen for inbound connections on TCP port 25, keep listening on the port open even after a disconnect, but automatically drop any session after 3 seconds of inactivity. | |
nc -vv -k -w 3 -l 25 | |
Listen for inbound connections on TCP port 25, automatically pushing the contents of file welcome.txt upon a connection. | |
cat welcome.txt | nc -vv -l 25 | |
Transfer contents of file payload.txt to host example.com using TCP port 1234 | |
nc -vv example.com 1234 < payload.txt | |
Transfer the image of device /dev/sda1 to host example.com using TCP port 1234 | |
dd if=/dev/sda1 | nc -vv example.com 1234 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment