Show Menu

nc - netcat Cheat Sheet by

netcat
linux     networking     netcat

Syntax

nc [options] host port

UDP Connection

nc -u host port
Default for netcat is TCP.

Port Scanning

nc -z -v 192.168.1.2 21-80
nc: connect to 192.16­8.1.1 port 21 (tcp) failed: Connection refused
Connection to 192.16­8.1.1 22 port [tcp/ssh] succeeded!
nc: connect to 192.16­8.1.1 port 23 (tcp) failed: Connection refused
...
nc: connect to 192.16­8.1.1 port 79 (tcp) failed: Connection refused
Connection to 192.16­8.1.1 80 port [tcp/http] succeeded!

Server Details

echo "EXIT" | nc 192.168.1.1 22
SSH-2.0­-O­pen­SSH­_7.2p2 Ubuntu­-4u­bun­tu2.8
Protocol mismatch.

Sendin­g/R­ece­iving

Receiving
nc -l 5555 > file_name
Sending
nc receiv­ing.ho­st.com 5555 < file_name

Sendin­g/R­ece­iving Multiple Files

Receiving
nc -l 5555 | tar xzvf -
Sending
tar czvf - /path/­to/dir | nc receiv­ing.ho­st.com 5555

SImple Chat Server

Server
nc -l 5555
Client
nc first.h­os­t.com 5555
To close the connec­tion, type CTRL+C

HTTP Request

printf "GET /nc.1 HTTP/1.1\r\nHost: man.openbsd.org\r\n\r\n" | nc man.openbsd.org 80

Download the nc - netcat Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/shortt-circuitt_nc-netcat.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets