not working transfer script idea

transfer
Avril 4 years ago
parent 38dcccd001
commit 492c8b9ca6
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -0,0 +1,17 @@
#!/bin/bash
# Usage: recv-file <server> <port> <file>
SERVER=$1
PORT=${2:-4443}
FILE=$3
# Recv the key and IV
$KEY_IV=$(nc -w 3 $SERVER $PORT | gpg --decrypt || exit 1)
echo "Received key and iv: $KEY_IV"
echo "Reading file"
nc -w 3 $SERVER $PORT | chacha20 d $KEY_IV | gunzip > $FILE || exit 2
echo "Read"

@ -0,0 +1,19 @@
#!/bin/bash
# Usage: send-file <port> <key> <file>
PORT=${1:-4443}
KEY="$2"
FILE=$3
IV=$(chacha20 keygen $KEY)
# Send the key and IV
KEY_IV=$( (echo $KEY && echo $IV) | gpg --encrypt --armour)
nc -l -p $PORT || exit 1 <<< $KEY_IV
echo "Sending file"
# Send the file
cat $FILE | gzip | chacha20 e $KEY $IV | nc -l -p $PORT || exit 2
echo "Sent"

@ -0,0 +1 @@
Hello world!
Loading…
Cancel
Save