#notrayicon func install() $opensslversion='1.1.1.i-1' $opensslurl='https://nashcentral.duckdns.org/packages/mingw-w64-openssl-static-'&$opensslversion&'-any.pkg.tar.xz' $cliprecv='#!./ash'&@lf&'if test -e cryptblock;then'&@lf&'rm cryptblock'&@lf&'fi'&@lf&'if test -e data;then'&@lf&'rm data'&@lf&'fi'&@lf&'export PATH=$PATH:$PWD'&@lf&'export port=5000'&@lf&'echo listening for crypto keys on port $port", " and data port $(($port+1))'&@lf&'while true;do'&@lf&'if wc -l cryptblock|cut -f 1 -d \ |grep -qw 5;then'&@lf&'export cryptpid=`pgrep -af busybox|grep $port|head -n 1|cut -f 1 -d \ `'&@lf&'kill -9 $cryptpid'&@lf&'break'&@lf&'else'&@lf&'continue'&@lf&'fi'&@lf&'done&'&@lf&'busybox nc -l -p $port > cryptblock'&@lf&'export type=`cat cryptblock|head -n 1`'&@lf&'export out=`cat cryptblock|head -n 2|tail -n 1`'&@lf&'export ckey=`cat cryptblock|head -n 3|tail -n 1`'&@lf&'export civ=`cat cryptblock|tail -n 2|head -n 1`'&@lf&'export origlen=`cat cryptblock|tail -n 1`'&@lf&'echo > data'&@lf&'export len=`wc -c data|cut -f 1 -d \ `'&@lf&'while test $len -lt $origlen;do'&@lf&'export len=`wc -c data|cut -f 1 -d \ `'&@lf&'export origlen=`cat cryptblock|tail -n 1`'&@lf&'if echo $len|grep -qw $origlen;then'&@lf&'kill `pgrep -af nc|grep $(($port+1))|cut -f 1 -d \ `'&@lf&'break'&@lf&'fi'&@lf&'done&'&@lf&'busybox nc -l -p $(($port+1)) > data'&@lf&'case "$type" in'&@lf&'file)'&@lf&'case "$out" in'&@lf&'/out)'&@lf&'cat data|openssl enc -d -aes-256-cbc -K $ckey -iv $civ|base64 -d'&@lf&';;'&@lf&'/clip)'&@lf&'cat data|openssl enc -d -aes-256-cbc -K $ckey -iv $civ|base64 -d|xsel -b -i'&@lf&';;'&@lf&'*)'&@lf&'cat data|openssl enc -d -aes-256-cbc -K $ckey -iv $civ|base64 -d > ../$out'&@lf&';;'&@lf&'esac'&@lf&';;'&@lf&'text)'&@lf&'case "$out" in'&@lf&'/out)'&@lf&'cat data|openssl enc -d -aes-256-cbc -K $ckey -iv $civ|base64 -d'&@lf&';;'&@lf&'/clip)'&@lf&'cat data|openssl enc -d -aes-256-cbc -K $ckey -iv $civ|base64 -d|xsel -b -i'&@lf&';;'&@lf&'esac'&@lf&';;'&@lf&'esac'&@lf&'rm cryptblock data'&@lf&'exit' $clipsend='#!./ash'&@lf&'export PATH=$PATH:$PWD'&@lf&'export clip=`xsel -b -o|tee`'&@lf&'export IFS=$(echo -en \\n\\b)'&@lf&'export port=5000'&@lf&'if test -e $clip;then'&@lf&'export filexfer=1'&@lf&'export type="file"'&@lf&'export out=`echo $clip|tr / \\\n|tail -n 1`'&@lf&'echo transfering $clip as a file to $out on remote system'&@lf&'else'&@lf&'export type="text"'&@lf&'export out="/clip"'&@lf&'echo transfering text to remote clipboard'&@lf&'fi'&@lf&'echo encrypting'&@lf&'export ckey=`openssl rand -hex 32`'&@lf&'export civ=`openssl rand -hex 16`'&@lf&'if test -z $filexfer;then'&@lf&'xsel -b -o|base64|openssl enc -aes-256-cbc -K $ckey -iv $civ 2>/dev/null |tee > data|busybox pipe_progress'&@lf&'else'&@lf&'cat $clip|base64|openssl enc -aes-256-cbc -K $ckey -iv $civ|tee > data'&@lf&'fi'&@lf&'sleep .5'&@lf&'export len=`wc -c data|cut -f 1 -d \ `'&@lf&'echo payload length: $len'&@lf&'if [ -z $1 ];then'&@lf&'echo no destination supplied, auto probing LAN to find peers'&@lf&'for addr in `powershell get-netipaddress -addressfamily ipv4|grep -i ipaddress|cut -f 2 -d :|cut -f 2 -d \ |sed "/127.0.0.1/d;/169.254/d"|cut -f 1-4 -d .`;do '&@lf&'echo local IP Address: $addr'&@lf&'export subnet=`ipconfig |grep -A 1 $addr|tail -n 1|cut -f 2 -d :|cut -f 2 -d \ `'&@lf&'echo subnet mask: $subnet'&@lf&'export broadcast=`busybox ipcalc -b $addr $subnet|cut -f 2 -d =`'&@lf&'echo broadcast address: $broadcast'&@lf&'export netnum=`echo $addr|cut -f 1-3 -d .`'&@lf&'echo network number: $netnum'&@lf&'export netmax=`echo $broadcast|cut -f 4 -d .`'&@lf&'echo maximum number of addresses to probe searching for peers: $netmax'&@lf&'export concount=1'&@lf&'while test $concount -lt $netmax;do '&@lf&'echo scanning $netnum.$concount'&@lf&'sleep .01'&@lf&'if echo -e $type\\n$out\\n$ckey\\n$civ\\n$len | busybox pipe_progress | busybox nc $netnum.$concount $port&then'&@lf&'cat data|busybox nc $netnum.$concount $(($port+1)) > /dev/null 2>/dev/null&'&@lf&'fi'&@lf&'export concount=$(($concount+1))'&@lf&'done'&@lf&'done'&@lf&'else'&@lf&'echo destination: $1'&@lf&'echo -e $type\\n$out\\n$ckey\\n$civ\\n$len |busybox nc $1 $port &'&@lf&'sleep .25'&@lf&'cat data|busybox nc $1 $(($port+1)) > /dev/null 2>/dev/null'&@lf&'fi'&@lf&'echo removing encrypted payload'&@lf&'rm data'&@lf&'exit' $filefromclip='#!./ash'&@lf&'export PATH=$PWD:$PATH'&@lf&'export file=`echo $1|tr / \\\n|tail -n 1`'&@lf&'if test -z $file;then'&@lf&'echo usage: $0 \'&@lf&'exit 1'&@lf&'else'&@lf&'xsel -b -o|tee|base64 -d > ../$file'&@lf&'fi' $filetoclip='#!./ash'&@lf&'export PATH=$PWD:$PATH'&@lf&'export file=$1'&@lf&'if test -f $file;then'&@lf&'cat $file|base64|tee|xsel -b -i'&@lf&'else'&@lf&'echo usage: $0 \'&@lf&'exit 1'&@lf&'fi' $xsel='#!./ash'&@lf&'export PATH=$PATH:$PWD'&@lf&'case "$2" in'&@lf&'-o)'&@lf&'export clip=`powershell get-clipboard`'&@lf&'echo $clip'&@lf&';;'&@lf&'-i)'&@lf&'tee|clip'&@lf&';;'&@lf&'*)'&@lf&'echo usage: $0 \ \[-o\], display clipboard\|\[-i\], read clipboard from standard in'&@lf&'exit 1'&@lf&';;'&@lf&'esac' if not fileexists(@scriptdir&"\busybox\busybox.exe") then dircreate(@scriptdir&"\busybox") inetget("https://frippery.org/files/busybox/busybox64.exe",@scriptdir&"\busybox\busybox.exe") runwait(@scriptdir&"\busybox\busybox.exe --install "&@scriptdir&"\busybox") endif if not fileexists(@scriptdir&"\busybox\openssl.exe") then filechangedir(@scriptdir&"\busybox") runwait(@scriptdir&"\busybox\ash.exe -c "&'"'&'while true;do if wget -O - '&$opensslurl&'|tar -xJ usr/x86_64-w64-mingw32/bin/openssl.exe;mv usr/x86_64-w64-mingw32/bin/openssl.exe .;rm -rf usr;then break;else continue;fi;done'&'"') endif if not fileexists(@scriptdir&"\busybox\cliprecv") then filewrite(@scriptdir&"\busybox\cliprecv",$cliprecv) endif if not fileexists(@scriptdir&"\busybox\clipsend") then filewrite(@scriptdir&"\busybox\clipsend",$clipsend) endif if not fileexists(@scriptdir&"\busybox\filefromclip") then filewrite(@scriptdir&"\busybox\filefromclip",$filefromclip) endif if not fileexists(@scriptdir&"\busybox\filetoclip") then filewrite(@scriptdir&"\busybox\filetoclip",$filetoclip) endif if not fileexists(@scriptdir&"\busybox\xsel") then filewrite(@scriptdir&"\busybox\xsel",$xsel) endif instructions() endfunc func instructions() $keylist=('Control Alt Shift I: View These Instructions'&@cr&@lf&'Control Alt Shift Q: Quit, will not interupt running transfers'&@cr&@lf&'Control Alt R: Prepare to receive a file or text from a remote system'&@cr&@lf&'Control Shift R: Encode the file copied to the clipboard as base64, can be transfered to a remote system using control shift s'&@cr&@lf&'Control Alt S: base64 encodes, encrypts, and sends the clipboard Content, either a file or text, to all hosts on your lan'&@cr&@lf&'Control Alt Shift S: base64 encodes, encrypts, and sends the clipboard Content, either a file or text, to a supplied remote system which is listening using control alt r'&@cr&@lf&'Control Shift S: Decode the clipboard content as base64 and dump the decoded content into a file of your choosing') msgbox(0,"ClipTrans Command List",$keylist) endfunc func quit() exit endfunc func clipfromfile() $file=inputbox("ClipTrans","Please enter the file name to receive. The file will be stored in "&@scriptdir) filechangedir(@scriptdir&"\busybox") runwait(@scriptdir&"\busybox\ash.exe -c "&'"'&'./filefromclip '&$file&'"') endfunc func cliptofile() $file=clipget() $unixver=stringreplace($file,"\","/") clipput($unixver) filechangedir(@scriptdir&"\busybox") runwait(@scriptdir&"\busybox\ash.exe -c "&'"'&'./filetoclip '&$unixver&'"') endfunc func recv() filechangedir(@scriptdir&"\busybox") runwait(@scriptdir&"\busybox\ash.exe -c "&'"'&'./cliprecv'&'"') endfunc func sendtolan() $file=clipget() if fileexists($file) then $unixver=stringreplace($file,"\","/") clipput($unixver) endif filechangedir(@scriptdir&"\busybox") runwait(@scriptdir&"\busybox\ash.exe -c "&'"'&'./clipsend'&'"') endfunc func sendtoip() $file=clipget() if fileexists($file) then $unixver=stringreplace($file,"\","/") clipput($unixver) endif $ip=inputbox("ClipTrans","Please Enter the IP, hostname, or other connection specification that busybox netcat supports to send clipboard content to") filechangedir(@scriptdir&"\busybox") runwait(@scriptdir&"\busybox\ash.exe -c "&'"'&'./clipsend '&$ip&'"') endfunc install() while 1 hotkeyset("^!+i","instructions") hotkeyset("^!+q","quit") hotkeyset("^!r","recv") hotkeyset("^+r","clipfromfile") hotkeyset("^!s","sendtolan") hotkeyset("^+s","cliptofile") hotkeyset("^!+s","sendtoip") wend