0

I have made some programs to send messages through netcat and would like to encrypt it, but i am lost as to how to automatically decrypt the messages.

Listener.

#!/bin/bash
read -p "Enter Number : " num

curl http://exampledomain.com/listenreg.php?api=apikey\&name=$name
while true
do
if [ "$num" == "1" ]; then
     nc -nv exampledomain.com 5555
elif [ "$num" == "2" ]; then
     nc -nv exampledomain.com 5556
else
    echo "invalid"
fi
done

Sender

#!/bin/bash
read -p "Server to message? : " num
while true
do
read -p "Enter Message : " msg
if [ "$msg" == "!quit" ]; then

    exit 1
else
    echo "Encrypting"
    key=`echo -n "$msg" | openssl enc -e -aes-256-cbc -a -salt -k encryptionkey 2>/dev/null`
    echo "Succesfully Encrypted!"
    echo "$key"
    echo "Sending Message to $num!"
    curl http://exampledomain.com/crypto.php?api=apikey\&msg=$key\&name=$num > /dev/null 2>&1
fi
done

Thank you.

Kevin Char
  • 65
  • 6

0 Answers0