File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,58 @@ $ curl -X PUT --upload-file ./eicar.com https://transfer.sh/eicar.com/scan
175175``` bash
176176$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal
177177```
178+
179+ ### Upload encrypted password protected files
180+
181+ By default files upload for only 1 download, you can specify download limit using -D flag like ` transfer-encrypted -D 50 %file/folder% `
182+
183+ #### One line for bashrc
184+ ``` bash
185+ transfer-encrypted () { if [ $# -eq 0 ]; then echo " No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>" >&2 ; return 1; fi ; while getopts " :D:" opt; do case $opt in D) max_downloads=$OPTARG ;; \? ) echo " Invalid option: -$OPTARG " >&2 ;; esac ; done ; shift " $(( OPTIND - 1 )) " ; file=" $1 " ; file_name=$( basename " $file " ) ; if [ ! -e " $file " ]; then echo " $file : No such file or directory" >&2 ; return 1; fi ; if [ -d " $file " ]; then file_name=" $file_name .zip" ; (cd " $file " && zip -r -q - .) | openssl aes-256-cbc -pbkdf2 -e > " tmp-$file_name " && cat " tmp-$file_name " | curl -H " Max-Downloads: $max_downloads " -w ' \n' --upload-file " tmp-$file_name " " https://transfer.sh/$file_name " | tee /dev/null; rm " tmp-$file_name " ; else cat " $file " | openssl aes-256-cbc -pbkdf2 -e > " tmp-$file " && cat " tmp-$file " | curl -H " Max-Downloads: $max_downloads " -w ' \n' --upload-file - " https://transfer.sh/$file_name " | tee /dev/null; rm " tmp-$file " ; fi ; }
186+ ```
187+ #### Human readable code
188+ ``` bash
189+ transfer-encrypted () {
190+ if [ $# -eq 0 ]; then
191+ echo " No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>" >&2
192+ return 1
193+ fi
194+
195+ while getopts " :D:" opt; do
196+ case $opt in
197+ D)
198+ max_downloads=$OPTARG
199+ ;;
200+ \? )
201+ echo " Invalid option: -$OPTARG " >&2
202+ ;;
203+ esac
204+ done
205+
206+ shift " $(( OPTIND - 1 )) "
207+ file=" $1 "
208+ file_name=$( basename " $file " )
209+
210+ if [ ! -e " $file " ]; then
211+ echo " $file : No such file or directory" >&2
212+ return 1
213+ fi
214+
215+ if [ -d " $file " ]; then
216+ file_name=" $file_name .zip"
217+ (cd " $file " && zip -r -q - .) | openssl aes-256-cbc -pbkdf2 -e > " tmp-$file_name " && cat " tmp-$file_name " | curl -H " Max-Downloads: $max_downloads " -w ' \n' --upload-file " tmp-$file_name " " https://transfer.sh/$file_name " | tee /dev/null
218+ rm " tmp-$file_name "
219+ else
220+ cat " $file " | openssl aes-256-cbc -pbkdf2 -e > " tmp-$file " && cat " tmp-$file " | curl -H " Max-Downloads: $max_downloads " -w ' \n' --upload-file - " https://transfer.sh/$file_name " | tee /dev/null
221+ rm " tmp-$file "
222+ fi
223+ }
224+ ```
225+ #### Decrypt using
226+ ``` bash
227+ curl -s https://transfer.sh/some/file | openssl aes-256-cbc -pbkdf2 -d > output_filename
228+ ```
229+
178230## Uploading and copy download command
179231
180232Download commands can be automatically copied to the clipboard after files are uploaded using transfer.sh.
You can’t perform that action at this time.
0 commit comments