I know that its possible to chat in linux terminal using netcat
. I want to know whether it is possible to encrypt the netcat
communications.
I did chat by listening on PC-1
nc -l 1234
And connecting to my IP on the other machine.
nc $IP 1234
It's possible - however I don't think nc does this itself:
echo "Words" | gpg -e
will produce an encrypted version on stdout; you can specify a receiving user as per usual.If you pipe this to another copy of gpg as
gpg -d
then it asks for a passphrase - this will be remembered for a period, so enabling a conversation.Therefore,
echo "words" | gpg -e | nc target 4321
will send, andnc -l 4321 | gpg -d
will listen.Also, see this question which is similar.
By itself netcat doesn't have encryption or authentication controls so while the traffic could be encrypted via OpenSSL or GnuPG with some clever piping and a bit if loops on the listening side, if you're on an untrustworthy network you might lose the race-condition to read using it and netcat doesn't allow multiple clients without clever scripting... but I'm not here to bash a tool but instead notify you of a Bash tool ;-)
Note it's very experimental and you should really check out the Travis-CI build log to find out exactly what it does, hint open a second window/tab and follow along with the travis.yml enabled scripts to see every working/tested feature so far developed.
Second hint, the following command examples are better in my experience with encrypting random strings.
However, decryption of multi-armored output file is a bit trickier... so here's the link to the script written for that because it's a bit too long to post here.