diff --git a/cheat/cheatsheets/nc b/cheat/cheatsheets/nc new file mode 100644 index 0000000..527e7f9 --- /dev/null +++ b/cheat/cheatsheets/nc @@ -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