Friday, 24 October 2014

Upload & Share Files From Command-line



Hello All,

Today I am going to talk about a Great implementation ever done for file sharing on web. Transfer.sh offers Command-line and web file sharing service which is much better than pastebin.

Instead of following lazy steps like opening up a browser, loading "free file uploading" website, login in or signup, then browsing a desired file and uploading it, You can now share your files on web directly from Command-Line. This service is totally free of cost and no registration is required for it. This is also combined with some cryptography and encoding tools. This may help evade simple content filters.

Lets start,

Upload any single file using curl: (No Encryption)
e.g.
# curl --upload-file /home/InfoSecGyan/myfile.txt  http://transfer.sh/myfile.txt

After entering above command, you will receive urls for downloading files in output.

Upload multiple files using curl: (No Encryption)
e.g.
# curl -i -F filedata=@/home/InfoSecGyan/myfile.txt -F filedata=@/home/InfoSecGyan/myfile1.txt https://transfer.sh/

After entering above command, you will receive urls for downloading files in output


Transfer.sh also offers Encryption. You can encrypt files using gpg and upload your files. It encrypts the data before it leaves your server using the password you enter and upload it to transfer.sh.

To Encrypt and Upload File:

# cat /home/InfoSecGyan/myfile.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/myfile.txt
Enter your passphrase (Password) and press enter.

Note: If you try to access above resultant URL (https://transfer.sh/c77vJ/myfile.txt) from browser or command-line, you will receive only PGP key but not the actual requested file. You need to enter passphrase to decrypt it.

To Decrypt and Download File:

# curl https://transfer.sh/c77vJ/myfile.txt|gpg -o- > /tmp/savehere.txt
Enter passphrase you entered during encrypting file. And Done
Read the file:


Happy Sharing..!!

0 comments:

Post a Comment