How To Create A Simple Chat With netcat In Linux

December 5, 2013 | By
| Reply More

Hi binary geeks!

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 practising 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

install netcat in linux and build a simple chat

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

how to install netcat in linux, compile from source

3. Untar the archive.

tar -xf netcat-0.7.1.tar

how to install netcat in linux, compile from source

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

how to install netcat in linux, create a simple chat with netcat

Enjoy :)

how to install netcat in linux, create a simple chat with netcat

Filed Under : OPEN SOURCE TOOLS, OPENSOURCE

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.