About

Server application to share files (or program output) from command line using the most basic UNIX tools, like netcat or socat.

Usage

Client

uploading

Clients don't need any sophisticated tools. To upload to server - pipe standard output from any application to socat:

Note: termsend.pl is demo server which you can use to play with termsend. You can also use it like ordinary no paste service to share data with people.

$ echo "test string" | socat - TCP:termsend.pl:1337

Server reads data until FIN is seen or string termsend\n at the very end of transfer. socat and nmap version of netcat send FIN when stdin ends so it is advisible to use them. If you are stuck with hobbit version of netcat, you need to also append termsend\n at the very end of transfer:

$ echo "test string" | { cat -; echo 'termsend'; } | nc termsend.pl 1337

If, for some reason, you are not able to pass termsend\n, you can always use timed upload. In this mode, server will read data until there is no activity on the socket for at least 3 seconds, after that termsend assumes transfer to be complete and link is returned. This is not recommended, due to the fact that you will have to wait 3 seconds after all data is sent, and you might end up with incomplete upload when your output program stalls.

$ echo "test string" | nc termsend.pl 1338

easy to use alias

It's quite long and irritating to type these pipes everytime you want to upload something. It is recommended to create alias to work-around this tedious work.

# add this to your .bashrc or .zshrc or whatever shell you use
alias ts="socat - TCP:termsend.pl:1337"

Now you can upload anything by simply piping it to "ts" alias. Examples will explain it best:

$ ls -l | ts               # uploads list of files in current directory
$ cat error.log | ts       # uploads file 'error.log'
$ make | ts                # uploads compilation output
$ cat binary-file | ts     # uploads some binary file

After transfer is complete, server will print link which you can later use to get uploaded content (like send it to someone via IRC). If uploaded content is a simple text file, you can read it directly in terminal using curl, or if output is known to be big, curl output can be piped to less. Check out this simple example.

$ make distcheck 2>&1 | ts
uploaded       3454 bytes
uploaded       8203 bytes
uploaded       9524 bytes
uploaded      11821 bytes
uploaded      16626 bytes
uploaded      23026 bytes
uploaded      31482 bytes
uploaded      32913 bytes
uploaded      33867 bytes
uploaded      40200 bytes
uploaded    1604104 bytes
uploaded    4668396 bytes
uploaded    4690455 bytes
https://termsend.pl/o/6p3e1
$ curl https://termsend.pl/o/6p3e1 | less

In this example, we upload output of make distcheck program into server, and later we read in in less (for example on another computer).

Server will notify uploader about how much bytes were transfered every second. If information is not received for longer than 1 second, that means program did not produce any output and server didn't receive any data.

For all aliases check alias page.

Server

Information about server usage and its options can be found in man page termsend(1).

Test results

Newest termsend is tested against these operating systems and architectures. Note that test results are taken from master branch, release version always passes all these tests.

operating system tests

machine tests

sanitizers

Dependencies

Compile and install

Program uses autotools so instalation is as easy as

$ ./autogen.sh
$ ./configure
$ make
# make install

License

Program is licensed under BSD 2-clause license. See LICENSE file for details.

Contact

Michał Łyszczek michal.lyszczek@bofc.pl

See also