This commit is contained in:
James Zhu 2014-10-04 22:08:24 +08:00
parent e1782a84a9
commit 1b65674318

26
cheat/cheatsheets/nc Normal file
View File

@ -0,0 +1,26 @@
#Open a TCP connection to port 42 of host.example.com, using port 31337 as the source port, with a timeout of 5 seconds:
$ nc -p 31337 -w 5 host.example.com 42
#Open a UDP connection to port 53 of host.example.com:
$ nc -u host.example.com 53
#Open a TCP connection to port 42 of host.example.com using 10.1.2.3 as the IP for the local end of the connection:
$ nc -s 10.1.2.3 host.example.com 42
#Create and listen on a UNIX-domain stream socket:
$ nc -lU /var/tmp/dsocket
#Connect to port 42 of host.example.com via an HTTP proxy at 10.2.3.4, port 8080. This example could also be used by ssh(1); see the ProxyCommand directive in ssh_config(5) for more information.
$ nc -x10.2.3.4:8080 -Xconnect host.example.com 42
#The same example again, this time enabling proxy authentication with username “ruser” if the proxy requires it:
$ nc -x10.2.3.4:8080 -Xconnect -Pruser host.example.com 42
#choose the source IP for the testing using the -s option
$ nc -zv -s source_IP target_IP Port