Skip to content

Instantly share code, notes, and snippets.

@AndrewBelt
Last active January 30, 2018 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewBelt/89d1592cb39f544c7e1d to your computer and use it in GitHub Desktop.
Save AndrewBelt/89d1592cb39f544c7e1d to your computer and use it in GitHub Desktop.
# pls + gib
# "Securely" transfer files between two computers, assuming the receiver has an accessible IP address
# Instructions:
# Add this to your .bashrc, and restart your terminal.
# Example session
#
# on receiver's terminal:
# $ pls > file.txt
#
# on sender's terminal:
# $ gib 192.168.1.2 < file.txt
PLSPORT=42069
PLSCERT=$HOME/.pls.pem
# On first run, a certificate will be created in $PLSCERT.
# You can repeatedly hit Enter to fill in default cert info,
# as it doesn't really matter for such a dumb command line tool.
function pls() {
if test ! -f $PLSCERT; then
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -out $PLSCERT -keyout $PLSCERT
fi
openssl s_server -accept $PLSPORT -naccept 1 -quiet -cert $PLSCERT -key $PLSCERT
}
function gib() {
openssl s_client -connect $1:$PLSPORT -quiet -no_ign_eof
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment