How to Create a Simple Chat with netcat in Linux
Abstract: the nc tool can be used about anything under the sun involving TCP or UDP. You can use it to do port scanningI will explain how to install netcat in y
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.
Cats Communication, understanding c...To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
Cats Communication, understanding cat's languageWhat 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 Linuxsudo apt-get install netcat
Compile netcat From Source
1. Get netcat from the official source.
2. Run the following command to decompress the file.
gunzip netcat-0.7.1.tar.gz
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.
./configure
6. Compile the program.
make
7. Install netcat
make install
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
Enjoy :-)
Read also
- How to Install and Use netcat Command on Linux