What's new
Runion

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[Sharing] Quick Secure Upload Methods

el84

Midle Weight
Депозит
$0
This is a simple way to upload a collection of files, for this example I will use https://transfer.sh, but its easy to change the script to use any other service.

The following snippet as /usr/bin/upload and give it permission to execute eg: "chmod +x /usr/bin/upload"


Bash:
Скопировать в буфер обмена
#gen pass
PASS="$(dd if=/dev/random of=/dev/stdout bs=1 count=32 2>/dev/null| base64 -w0)"

#create tmp dir
TMP_DIR="$(mktemp -d)"

#compress with pass
7z a -mhe=on -p"${PASS}" -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on "${TMP_DIR}/files.7z" $@

#uploading
LINK=$(curl -s -T "${TMP_DIR}/files.7z" https://transfer.sh)

#output
printf "\n\nLink: %s\nPass: %s\nCmd : wget ${LINK}; 7z x -p\"${PASS}\" files.7z; rm files.7z\n\n" ${LINK} ${PASS}

#remove tmp dir
rm -rf ${TMP_DIR}

With this script you can upload single file or entire directories, it will compress all the file with a random generated password and then output the link and password and a one-line command to quick download and extract.
 
Top