update the up2k.sh client example

This commit is contained in:
ed 2021-09-25 18:04:18 +02:00
parent 5994f40982
commit 86d4c43909

View file

@ -8,7 +8,7 @@ set -e
## ##
## config ## config
datalen=$((2*1024*1024*1024)) datalen=$((128*1024*1024))
target=127.0.0.1 target=127.0.0.1
posturl=/inc posturl=/inc
passwd=wark passwd=wark
@ -37,10 +37,10 @@ gendata() {
# pipe a chunk, get the base64 checksum # pipe a chunk, get the base64 checksum
gethash() { gethash() {
printf $( printf $(
sha512sum | cut -c-64 | sha512sum | cut -c-66 |
sed -r 's/ .*//;s/(..)/\\x\1/g' sed -r 's/ .*//;s/(..)/\\x\1/g'
) | ) |
base64 -w0 | cut -c-43 | base64 -w0 | cut -c-44 |
tr '+/' '-_' tr '+/' '-_'
} }
@ -123,7 +123,7 @@ printf '\033[36m'
{ {
{ {
cat <<EOF cat <<EOF
POST $posturl/handshake.php HTTP/1.1 POST $posturl/ HTTP/1.1
Connection: Close Connection: Close
Cookie: cppwd=$passwd Cookie: cppwd=$passwd
Content-Type: text/plain;charset=UTF-8 Content-Type: text/plain;charset=UTF-8
@ -145,14 +145,16 @@ printf '\033[0m\nwark: %s\n' $wark
## ##
## wait for signal to continue ## wait for signal to continue
w8=/dev/shm/$salt.w8 true || {
touch $w8 w8=/dev/shm/$salt.w8
touch $w8
echo "ready; rm -f $w8" echo "ready; rm -f $w8"
while [ -e $w8 ]; do while [ -e $w8 ]; do
sleep 0.2 sleep 0.2
done done
}
## ##
@ -175,7 +177,7 @@ while [ $remains -gt 0 ]; do
{ {
cat <<EOF cat <<EOF
POST $posturl/chunkpit.php HTTP/1.1 POST $posturl/ HTTP/1.1
Connection: Keep-Alive Connection: Keep-Alive
Cookie: cppwd=$passwd Cookie: cppwd=$passwd
Content-Type: application/octet-stream Content-Type: application/octet-stream