Skip to content

Instantly share code, notes, and snippets.

@emaldonadot
Last active April 12, 2020 13:02
Show Gist options
  • Save emaldonadot/dd18f2a187b240c10bbdd980410a4794 to your computer and use it in GitHub Desktop.
Save emaldonadot/dd18f2a187b240c10bbdd980410a4794 to your computer and use it in GitHub Desktop.

A nice way to securely communicate wit your friends

Open a port using netcat and redirect the messages received to a named queue. then in an infinite loop extract the message from the queue and decrypt with gpg And for sure we need to send our gpg public key to our friends And we can use TOR to expose the server as an onion service so we don't give our real ip address.

while true; do (cat mypipe > text.gpg); sleep 1; echo 'Message received:' && gpg --decrypt text.gpg ; done &
nc -l -p 50001 > mypipe &

In another scritp we can have what we need to send the message

echo "Hello world" | gpg -eas -r someones@gpgid.com | nc somefakeonionurl.onion 50001

With this very siemple solution we can send gpg/pgp key based encrypted messages to our friends or receive messages with no intermediate hosing services, then we can also have a little database to match the public keys with the hostnames to make it more accessible.

I've done this and works well. but we may need to spread the word. When I get the message in my computer I get the screen to type the password of my private key to decrypt the messageand if password is correct the message is shown.

This could be a simple thing that can be elaborated in a better solution.

Try this in local host:

In terminal 1:

while true; do (cat mypipe > text.gpg); sleep 1; echo 'Message received:' && gpg --decrypt text.gpg ; done &
nc -l -p 50001 > mypipe &

In terminal 2:

echo "Hello world" | gpg -eas -r someones@gpgid.com | nc localhost 50001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment