Tutorials

NetCat Shell

NETCAT  REVERSE-SHELLS

#exploitation

NETCAT

REVERSE-SHELLS 

shell
nc -lvnp <port-number>

-l = used to tell netcat that this will be a listener

-v = is used to request a verbose output

-n = tells netcat not to resolve host name or dns

-p = indicates that the port specification will follow

eg:

shell
nc -lvnp 443

BIND-SHELLS

shell
nc <target-ip> <chosen-port>

Di default le shell create con NetCat sono molto poco staili e non interattive. Infatti non sarà possibile usare il tab-autocomplete, le frecce di navigazione e ctrl + C killerà tutto.

STABILIZZAZIONE SHELLS CON PYTHON:

python
python -c 'import pty;pty.spawn("/bin/bash")'
  • useremo python per creare un altra shell ottimizzata meglio. Tuttavia sarà ancora una shell non interattiva. 
shell
export TERM=xterm
  • ci darà l'accesso ai comandi da terminale come "clear". 
Ora andremo a mettere la shell in background con ctrl + Z.

Nel nostro terminale lanceremo il comando:

shell
stty raw -echo; fg
questo fa due cose: ci da il permesso di usare il tab-autocomplete, le arrow keys, and ctrl + C to kill processes.

STABILIZZAZIONE SHELLS CON RLWRAP: 

in questo caso andremo in principio ad usare un listener differente con questo comando, che ci darà immediatamente accesso al tab-autocomplete, arrow keys, and ctrl + C

shell
rlwrap nc -lvnp <port>