GNU/Linux Command – NETCAT

nc — TCP/IP Tool to read and write data across network connection

Summary:
netcat(nc) is a simple utility which reads and writes data across network connections, using IP, TCP or UDP protocol. It is designed to be a reliable “back-end” tool that can be used directly or easily driven by other programs and scripts. It is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities.

We can use netcat with-in local system. But just for better understanding, I use two systems A and B. IP of A is 192.168.1.1 and B is 192.168.1.2.

Examples:
(A) $ nc B 21 -- Connect to port 21 on B (B) $ nc -l -p 5000 -- Listen on port 5000 in B. (A) $ nc B 5000 -- Connect to B on port 5000. Whatever typedin A will goto B and vice-versa. (A) $ nc -o dump.txt B 5000 -- Same as above. But all trafficwill be dumped in the file in hex format. (B) cat fileB.txt | gzip -9 | nc -l 5000 -- Send the file throughport 5000 and on-the-fly compress it. (A) nc B 5000 > fileA.gz -- Receive a file from B and save it in A. (A) $ echo "Hello" | nc -w 1 B 5000 -- Connect to B on port 5000and pass "Hello" message to it. (B) nc -l -p 5000 -e /bin/bash -- Listen on port 5000. If anyoneconnected this, provide the bash shell. (Simple way to open a backdoor). (A) $ nc -zv B 10-100 -- Simple TCP port scan on B. Option -zmakes the netcat not to wait for any response from B. (A) $ nc -zvu B 10-100 -- Simple UDP port scan on B.
Read: man nc or man netcat

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: