Skip to content

Instantly share code, notes, and snippets.

@AndrewBelt AndrewBelt/pls+gib.sh

Last active Jan 30, 2018
Embed
What would you like to do?
# 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
You can’t perform that action at this time.