1
0
Fork 0
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

23 Zeilen
684 B
Bash

vor 3 Jahren
#!/bin/bash
# Simple bash client for linux
if [ "$#" != 3 ] || { [ "$1" != "download" ] && [ "$1" != "upload" ];}
then echo "Usage: $0 [download|upload] FILENAME SERVERNAME"; exit 1; fi
f=$2; s=$3
if [ "$1" = "download" ]
then
c=$(dig +short txt "$f".count."$s"|tr -d \")
for i in $(seq 0 "$c"); do echo -n "$(dig +short txt "$f"."$i"."$s"|tr -d \")"; done | base64 -d > "$f"
else
i=0; d=$(base64 -w 0 < "$f"); id=$(sha256sum "$f" | cut -d" " -f1 | base64 -w 0 | cut -c1-6)
while true; do
u=".$i-${id}u.$s"; ((i++)); x=$((63-${#u}))
if [ $x -lt ${#d} ]
then p=${d:0:$x}; d=${d:$x}; dig +short txt "$p$u"
else dig +short txt "$d$u"; exit 0
fi
done
fi