Security 101 : Netcat - a short overview -



The netcat utility can be used to send or receiver data on TCP or UDP ports.

Opening a port with netcat:


We can open the port "
120" on the localhost using the below command:


-l: listening mode
-p: port number

The netcat utility is now listening on port "120"

Remark:

We could use the "-v" flag to get the "verbose" mode that prints more detailed information about the connection.

Connecting to our host:

We can now connect to our host from another machine using the IP address "10.20.1.36" and port "120" that we have opened using netcat.

From another machine, we use the below command:


We are now connected to the other host "10.20.1.36" on port "120".
We can type text, that will appear on the other host.

We can end the connection using the key combination <ctrl-c> which sends a "TCP FIN" packet.

Using netcat to connect to a webserver:

We could use netcat to connect to a Webserver on port "80":


We can then start sending GET requests (GET ------) for example.

Comments

Leave as a comment:

Archive