Last active
January 30, 2018 13:49
-
-
Save AndrewBelt/89d1592cb39f544c7e1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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