RedTeam
4.Exploitation
Shell-and-Reverse-Shell
2.Listeners
Netcat

Netcat

Netcat is the traditional "Swiss Army Knife" of networking. It is used to manually perform all kinds of network interactions, including things like banner grabbing during enumeration, but more importantly for our uses, it can be used to receive reverse shells and connect to remote ports attached to bind shells on a target system. Netcat shells are very unstable (easy to lose) by default, but can be improved by techniques that we will be covering in an upcoming task.

  • Server
  • Client

Reverse Shell

This starts a listener to catch any connection on the specific port:

nc -lvnp <port-number>
  • -l  ---> Listen mode
  • -v  ---> Verbose output
  • -n ---> Numeric only; no resolution of hostname via DNS
  • -p  ---> Specify the port number

Bind Shell

This starts a listen server and binds the shell information to the open port:

nc -lvnp <IP-OF-TARGET> <PORT>