Lately, I have been reading a book about Netcat Power Tools and I have picked up new skills that can be used to solve problems in your binary life. I never thought or imagined that such a simple tool can be so powerful until the moment I started practicing it.
What is Netcat?
nc, also known as the TCP/IP swiss army knife is a feature-rich network utility which can be used to read and write data to network connections using TCP or UDP.
What can you do with netcat?
According to the description in the manual page, the nc tool can be used about anything under the sun involving TCP or UDP. You can use it to do port scanning, transfer files, create a listener or stream media. Is this all you can do with netcat? No, but these are the things you guys will learn from our tutorial series for netcat.
In this article, I will explain how to install netcat in your Linux machine and after the installation is completed you will build a simple chat.
How To Install netcat In Ubuntu Linux
sudo apt-get install netcat
Compile netcat From Source
1. Get netcat from the official source.
2. Run the following command to decompress the file.
3. Untar the archive.
tar -xf netcat-0.7.1.tar
4. Change directory.
cd netcat-0.7.1 /
5.Type the following command to configure the source code.
6. Compile the program.
7. Install netcat
Create A Simple Chat
To create a simple chat we need two instances of netcat, one to listen for incoming connections (the server) and another one to start the connection.
1. Run netcat with the '-l' option in order to operate in listening mode. You should also specify the listening port, I prefer 1300.
nc -l -p 1300
Then, run another 'netcat' which will initiate the connection by connecting to the server.
nc localhost 1300