1# $OpenBSD: putty-transfer.sh,v 1.12 2024/02/09 08:47:42 dtucker Exp $ 2# Placed in the Public Domain. 3 4tid="putty transfer data" 5 6puttysetup 7 8if [ "`${SSH} -Q compression`" = "none" ]; then 9 comp="0" 10else 11 comp="0 1" 12fi 13 14for c in $comp; do 15 verbose "$tid: compression $c" 16 rm -f ${COPY} 17 cp ${OBJ}/.putty/sessions/localhost_proxy \ 18 ${OBJ}/.putty/sessions/compression_$c 19 echo "Compression=$c" >> ${OBJ}/.putty/sessions/kex_$k 20 env HOME=$PWD ${PLINK} -load compression_$c -batch \ 21 -i ${OBJ}/putty.rsa2 cat ${DATA} > ${COPY} 22 if [ $? -ne 0 ]; then 23 fail "ssh cat $DATA failed" 24 fi 25 cmp ${DATA} ${COPY} || fail "corrupted copy" 26 27 for s in 10 100 1k 32k 64k 128k 256k; do 28 trace "compression $c dd-size ${s}" 29 rm -f ${COPY} 30 dd if=$DATA obs=${s} 2> /dev/null | \ 31 env HOME=$PWD ${PLINK} -load compression_$c \ 32 -batch -i ${OBJ}/putty.rsa2 \ 33 "cat > ${COPY}" 34 if [ $? -ne 0 ]; then 35 fail "ssh cat $DATA failed" 36 fi 37 cmp $DATA ${COPY} || fail "corrupted copy" 38 done 39done 40rm -f ${COPY} 41 42