Bash client added
Ursprung
329db1b423
Commit
7fbb57fdde
@ -0,0 +1,22 @@
|
|||||||
|
#!/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
|
Laden…
In neuem Issue referenzieren