alexanderepstein / Bash-Snippets

A collection of small bash scripts for heavy terminal users
MIT License
9.67k stars 842 forks source link

One-time file sharing #151

Closed Logic-gate closed 6 years ago

Logic-gate commented 6 years ago

Issue Label:

Description: "One time" file sharing

~# curl -F 'file=@Screenshot_20160729_014.png' http://ki.tc/file/u/
{
  "file": {
    "_id": 14811131, 
    "file": [
      "File Name: Screenshot_20160729_014.png", 
      "Content Type: image/png"
    ], 
    "link": "http://ki.tc/file/1093d", 
    "time": "Sun, 26 Nov 2017 12:22:13 GMT"
  }
}

Link will yield downloadable content. After it has been accessed, the record will be deleted forever.

~# wget http://ki.tc/file/1093d
--2017-11-26 15:22:25--  http://ki.tc/file/1093d
Resolving ki.tc... 174.138.62.140
Connecting to ki.tc|174.138.62.140|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 526178 (514K) [image/png]
Saving to: ‘1093d’

1093d                                100%[======================================================================>] 513.85K   490KB/s    in 1.0s    

2017-11-26 15:22:27 (490 KB/s) - ‘1093d’ saved [526178/526178]
~# wget http://ki.tc/file/1093d
--2017-11-26 15:24:07--  http://ki.tc/file/1093d
Resolving ki.tc... 174.138.62.140
Connecting to ki.tc|174.138.62.140|:80... connected.
HTTP request sent, awaiting response... 400 BAD REQUEST
2017-11-26 15:24:07 ERROR 400: BAD REQUEST.

^deleted


Note, if accessed from a browser, the file name will be represented correctly.

navanchauhan commented 6 years ago

Nice concept. It won’t be long before bash snippets become Mr Robot’s toolbox. Il look into this after my exams (7th December )

navanchauhan commented 6 years ago

I might be able to make a concept soon though

alexanderepstein commented 6 years ago

Would make sense to integrate this into the transfer component as it already does file sharing. An option like -o for one time would make sense. The idea being transfer fileToTransfer would use transfer.sh while transfer -o fileToTransfer would use ki.tc

Logic-gate commented 6 years ago

Heads up...an update

## [0.3.4] - 2017-12-01
###/file , [+]/otf
[+]  Increased upload limit to 100mb
[+]  Sha256 checksum
[+]  Web app at ki.tc/otf
[+]  Malformed url in api response and web app - used for sharing via services that request header info as you share
[+]  Increased path to length=7
[+]  Implemented chunk based file upload method for larger files; testing showed a slight advantage of previous technique  
Logic-gate commented 6 years ago

An update...final one.

curl -F 'file=@Screenshot_20160729_014.png' http://ki.tc/file/u/
{
  "file": {
    "_id": "loosening.seismograph.selected", 
    "file": [
      "File Name: Screenshot_20160729_014.png", 
      "Content Type: image/png"
    ], 
    "link": "http://ki.tc/file/loosening.seismograph.selected", 
    "malformed": "http ://ki.tc/file/loosening.seismograph.selected", 
    "sha256": "98ad20a92f29c8b0e815f266c661975cfc11375e7d92a3b55bf13f78057736cc", 
    "time": "Sat, 09 Dec 2017 10:46:28 GMT"
  }
}

Opted for random readable end paths; rationale: easier to read > easier to memorize > easier to verbally share.

How it works:

Generate random longitude and latitude, pass it to what3words api > get the 3 words.

alexanderepstein commented 6 years ago

Sorry this is taking longer than I wanted, I will have this done over the next 3 days or so

Logic-gate commented 6 years ago

Sure...

Check the documentation here http://ki.tc/otf/documentation the path is not set, also...it would be prudent to add local encryption prior to transmission. I can vouch for my service--records are terminated once accessed, but since it lacks ssl, I cant vouch for adequate transmission.

alexanderepstein commented 6 years ago

I am first going just get the one time file sharing working afterwards I will add encryption before upload and decryption upon download

alexanderepstein commented 6 years ago

First version in this commit d1b4c46491e61974a9582c7aec9af0b392524c23

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because it has been inactive for 30 days.