lets welcome scotty in this toolbox
This commit is contained in:
49
web/scotty
Executable file
49
web/scotty
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
_help() {
|
||||
echo '# Scotty v.5
|
||||
|
||||
Scotty is the most simple network file transfer utility. It provides
|
||||
no security what so ever.
|
||||
|
||||
To expose a file/folder for anyone to catch:
|
||||
* scotty up [folder/file name]
|
||||
* Pick the hostname from the printed list, and send it to the receiver.
|
||||
|
||||
To download the exposed folder/file:
|
||||
* scotty down [sender host name]
|
||||
* Download happens to the current working directory.
|
||||
* By default, any existing file is overwritten.
|
||||
|
||||
Add tar options by modifying a variable:
|
||||
* SCOTTY_TAR="pass your tar options here" scotty ...
|
||||
|
||||
Scotty uses port '$PORT' to transfer files. Downloading host needs
|
||||
to see the uploader directly.
|
||||
'
|
||||
exit
|
||||
}
|
||||
|
||||
PORT=60006
|
||||
[[ -z "$2" ]] && _help
|
||||
[[ "$1" = "-h" ]] && _help
|
||||
|
||||
PV=cat
|
||||
which pv &> /dev/null && PV=pv
|
||||
|
||||
[[ "$1" = up ]] && {
|
||||
echo Beam me up, Scotty. Waiting for someone to beam $( hostname ) down...
|
||||
printf "\n| %15s | %s\n" IP Hostname
|
||||
for addr in $( hostname -I ); do
|
||||
printf "| %15s | %s\n" $addr $( dig +short -x $addr )
|
||||
done
|
||||
echo Scotty, beam $( hostname ) down | nc -l -p $PORT
|
||||
echo Transporter locking to signature
|
||||
tar -cv $SCOTTY_TAR "$2" | $PV | nc -l -p $PORT
|
||||
}
|
||||
[[ "$1" = down ]] && {
|
||||
nc -w 10 "$2" $PORT
|
||||
sleep 0.5
|
||||
nc -w 10 "$2" $PORT | $PV | tar -x $SCOTTY_TAR
|
||||
}
|
||||
true
|
||||
Reference in New Issue
Block a user