-
-
Save ibitebyt3s/b5fc8e913b9c425d8534575afdb44b99 to your computer and use it in GitHub Desktop.
netcat – encrypt transfer with openssl
This file contains 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
IP="127.0.0.1" | |
PORT="8877" | |
SHARED_SECRET="shared secret" | |
OPENSSL="/usr/local/opt/libressl/bin/openssl" | |
OPENSSL_CMD="$OPENSSL enc -a -A -aes-256-gcm" | |
while IFS= read -r MSG; do | |
echo "$MSG" | $OPENSSL_CMD -e -k "$SHARED_SECRET" | |
echo | |
done | \ | |
nc "$IP" "$PORT" | \ | |
while IFS= read -r REC; do | |
echo "Server: $(echo "$REC" | $OPENSSL_CMD -d -k "$SHARED_SECRET")" | |
done |
This file contains 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
#IP="127.0.0.1" | |
PORT="8877" | |
SHARED_SECRET="shared secret" | |
OPENSSL="/usr/local/opt/libressl/bin/openssl" | |
OPENSSL_CMD="$OPENSSL enc -a -A -aes-256-gcm" | |
while IFS= read -r MSG; do | |
echo "$MSG" | $OPENSSL_CMD -e -k "$SHARED_SECRET" | |
echo | |
done | \ | |
nc -l "$PORT" | \ | |
while IFS= read -r REC; do | |
echo "Client: $(echo "$REC" | $OPENSSL_CMD -d -k "$SHARED_SECRET")" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment