lancat is a P2P LAN file transfer tool that works with zero configuration. Yes, it resembles the popular network tool netcat by name and is much simpler to use for transfers. The main advantage of lancat is remembering IP address is not necessary. The syntax is also very easy to remember. The tool is particularly useful for a quick file transfer on networks where DHCP is used. lancat is written in ruby.
However, lancat has two cons to be considered:
- The data is not encrypted. So confidential data should be encrypted before sending.
- Any other user may receive the data if they run the lancat command before the intended receiver.
However, for trivial file transfers these may not be very relevant.
In addition to files, lancat can be combined with other commands using pipes and redirections to compress and/or encrypt data before sending. It can also be used to send clipboard data.
The sender opens a TCP server socket on a random port and sends out UDP multicast packets every second until there is a connection from receiver or timeout. The receiver waits to receive one of these UDP multicast packets and opens a TCP client socket upon receiving one. Once a connection is established, the sender sends all the data from stdin to the receiver. The receiver writes everything it receives to stdout.
To install lancat, run the following:
$ sudo gem install lancat
- Command to run on sending machine:
$ lancat -s < myfile.img
- Command to run at receiver’s end:
$ lancat -r > myfile.img
The two commands can be executed in any order.
- The progress at sender’s end can be viewed using:
$ pv myfile.img | lancat -s
- The progress at receiver’s end can be viewed using:
$ lancat -r | pv > myfile.img
- Transfer several files at once with tar:
$ tar cf - file1.txt file2.txt file3.txt | lancat -s $ lancat -r | tar xf
- Compress and transfer large files:
$ xz -c really_big_file.dat | lancat -s $ lancat -r | xz -dc > really_big_file.dat
- Encrypt and transfer:
$ openssl aes-256-cbc -in nuclear_launch_codes.txt | lancat -s $ lancat -r | openssl aes-256-cbc -d -out nuclear_launch_codes.txt
- Transfer clipboard contents:
$ xclip -o -selection clipboard | lancat -s $ lancat -r | xclip -i -selection clipboard
On GitHub: lancat
In case you are not familiar with netcat syntax:
- To receive a file:
$ nc -l -p 1234 > myfile.img // l: listen // p: port number
- To send the file:
$ nc -w 3 [destination IP] 1234 < myfile.img // w: wait for seconds