I wanted to build a script to copy some files from a computer to another. This can be done using a few utilities like:
  • nc - for stream network transfer
  • tar - for clumping all files together
  • gpg - for encryption


Here is the quick and dirty version.
On the receiving computer:
nc -dl _MyPort_ | gpg -d -q --no-mdc-warning --passphrase _MyPassword_ | tar -xjC _DownloadFolder_

On the sending computer:
tar -cj -C _Folder1_ _File1_ -C _Folder2_ _File2_ -C _Folder3_ _File3_ _File4_ _File5_ | gpg --passphrase _MyPassword_ -c | nc _MyIP_ _MyPort_

In other words:
On the receiving side nc is listening on a specific port for a stream that will be passed through gpg and decrypted, then passed to tar which will decompress it and split it into different files in a specified download folder.
On the sending site the files to be transferred are clumped and compressed into a stream by tar passed through gpg and encrypted, then sent to a specified IP and port via nc.

nc and tar are standard Linux utilities. gpg must be downloaded and installed.

The scripts themselves are more complicated, but the gist of it is in here.

Comments

Be the first to post a comment

Post a comment