I developed a paste sever and found another awesome project.

Recently, I released a paste server named termbin.co, It is inspired by termbin.com. It aims to paste file var command line.
For Example, I want to paste a log file form a linux server behind firewall.

➜  ~ cat test.log | nc termbin.co 9999
https://termbin.co/3h2e

And it also support common binary file. For Example:

➜  ~ cat simple_jpg.jpg | nc termbin.co 9999
https://termbin.co/t4OZ/index.jpg

because termbin.co is based on socket, No filename send to server. So server guess filetype from binary file. I use https://github.com/h2non/filetype do this job.
But there is two problem, the first issocket connection not robust. termbin.co server is host at NewYork, Some paste from china could get failure. Another is for guess filetype I must put all binary file in memory. Which could cause memory leak problem. To avoid this, I set a file size limit(current as 4MB) to termbin.co.

Today I found another awesome project named wsend. It is based on http, which is more stable. Example:

wget https://wsend.net/wsend
chmod +x wsend
./wsend file.txt
wget https://wsend.net/wsen

wsend.net didn’t open the server code. So I considered how can I trust wsend.net. Will the admin steal my file or share my file to others? And I found wsend support gpg encrypt, this repo named wsend-gpg, It allows me post a file after encrypted. Example:

➜  wsend-gpg git:(master) ✗ ./wsend-gpg README.md
gpg: gpg-agent is not available in this session

info:
info:    It appears you aren't registered
info:    Registration is free and comes with 2GB of storage space
info:    Plus get 1G of space for every friend you refer
info:
info:    Sign up now with: wsend --register
info:
info:    unregistered accounts are limited to 200MB
info:    your unregistered transfer will now continue
info:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4409  100    64  100  4345    303  20583 --:--:-- --:--:-- --:--:-- 20592
https://wsend.net/3684b2e672640690d9bc50b09a72eb34/README.md.gpg

get the gpg file and decrypt

➜  wsend-gpg git:(master) ✗ ./wget-gpg https://wsend.net/3684b2e672640690d9bc50b09a72eb34/README.md.gpg
--2018-05-23 14:15:43--  https://wsend.net/3684b2e672640690d9bc50b09a72eb34/README.md.gpg
Resolving wsend.net (wsend.net)... 66.228.37.175
Connecting to wsend.net (wsend.net)|66.228.37.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4010 (3.9K) [application/octet-stream]
Saving to: ‘README.md.gpg’

README.md.gpg                                      100%[================================================================================================================>]   3.92K  --.-KB/s    in 0.002s

2018-05-23 14:15:43 (1.87 MB/s) - ‘README.md.gpg’ saved [4010/4010]

gpg: AES256 encrypted data
gpg: gpg-agent is not available in this session
gpg: encrypted with 1 passphrase
File `README.md' exists. Overwrite? (y/N) N
Enter new filename: Helloworld.md

It is awesome, I like it very much!
And very welcome to use my termbin.co, termbin.co only need netcat installed.(which is install as default in ubuntu and macos.)

点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.