aboutsummaryrefslogtreecommitdiffstats
path: root/readme.md
blob: 11f106cfa7134fde9573c54faa7c26772949d214 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
[kursg-meta]: # (order: 1)

About
=====

Server application that allows you 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.

```{.sh}
# 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](https://termsend.bofc.pl/aliases.html).

Server
------

Information about server usage and its options can be found in man page
[termsend](https://termsend.bofc.pl/termsend.1.html)(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
----------------------

* parisc-polarhome-hpux-11.11 ![test-result-svg][prhpux]
* power4-polarhome-aix-7.1 ![test-result-svg][p4aix]
* i686-builder-freebsd-11.1 ![test-result-svg][x32fb]
* i686-builder-netbsd-8.0 ![test-result-svg][x32nb]
* i686-builder-openbsd-6.2 ![test-result-svg][x32ob]
* x86_64-builder-dragonfly-5.0 ![test-result-svg][x64df]
* x86_64-builder-solaris-11.3 ![test-result-svg][x64ss]
* i686-builder-linux-gnu-4.9 ![test-result-svg][x32lg]
* i686-builder-linux-musl-4.9 ![test-result-svg][x32lm]
* i686-builder-linux-uclibc-4.9 ![test-result-svg][x32lu]
* x86_64-builder-linux-gnu-4.9 ![test-result-svg][x64lg]
* x86_64-builder-linux-musl-4.9 ![test-result-svg][x64lm]
* x86_64-builder-linux-uclibc-4.9 ![test-result-svg][x64lu]
* i686-builder-qnx-6.4.0 ![test-result-svg][x32qnx]

machine tests
-------------

* aarch64-builder-linux-gnu ![test-result-svg][a64lg]
* armv5te926-builder-linux-gnueabihf ![test-result-svg][armv5]
* armv6j1136-builder-linux-gnueabihf ![test-result-svg][armv6]
* armv7a15-builder-linux-gnueabihf ![test-result-svg][armv7a15]
* armv7a9-builder-linux-gnueabihf ![test-result-svg][armv7a9]
* mips-builder-linux-gnu ![test-result-svg][m32lg]

sanitizers
----------

* -fsanitize=address ![test-result-svg][fsan]
* -fsanitize=leak ![test-result-svg][fsleak]
* -fsanitize=undefined ![test-result-svg][fsun]
* -fsanitize=thread ![test-result-svg][fsthread]

Dependencies
============

* [>=embedlog-0.5.0](https://embedlog.bofc.pl) (embedlog itself has no
  dependencies)
* pthread

Compile and install
===================

Program uses autotools so instalation is as easy as

```{.sh}
$ ./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
========

* [termsend.pl](https://termsend.pl) **termsend** functional demo
* [embedlog](https://embedlog.bofc.pl) easy to use but feature-rich logger
  for **c/c++** applications
* [mtest](https://mtest.bofc.pl) macro unit test framework for **c/c++**
* [git repository](https://git.bofc.pl/termsend) to browse sources online
* [continous integration](http://ci.termsend.bofc.pl) with test results
* [polarhome](http://www.polarhome.com) nearly free shell accounts for virtually
  any unix there is.
* [pvs studio](https://www.viva64.com/en/pvs-studio) static code analyzer with
  free licenses for open source projects

[a64lg]: http://ci.termsend.bofc.pl/badges/aarch64-builder-linux-gnu-tests.svg
[armv5]: http://ci.termsend.bofc.pl/badges/armv5te926-builder-linux-gnueabihf-tests.svg
[armv6]: http://ci.termsend.bofc.pl/badges/armv6j1136-builder-linux-gnueabihf-tests.svg
[armv7a15]: http://ci.termsend.bofc.pl/badges/armv7a15-builder-linux-gnueabihf-tests.svg
[armv7a9]: http://ci.termsend.bofc.pl/badges/armv7a9-builder-linux-gnueabihf-tests.svg
[x32fb]: http://ci.termsend.bofc.pl/badges/i686-builder-freebsd-tests.svg
[x32lg]: http://ci.termsend.bofc.pl/badges/i686-builder-linux-gnu-tests.svg
[x32lm]: http://ci.termsend.bofc.pl/badges/i686-builder-linux-musl-tests.svg
[x32lu]: http://ci.termsend.bofc.pl/badges/i686-builder-linux-uclibc-tests.svg
[x32nb]: http://ci.termsend.bofc.pl/badges/i686-builder-netbsd-tests.svg
[x32ob]: http://ci.termsend.bofc.pl/badges/i686-builder-openbsd-tests.svg
[m32lg]: http://ci.termsend.bofc.pl/badges/mips-builder-linux-gnu-tests.svg
[x64lg]: http://ci.termsend.bofc.pl/badges/x86_64-builder-linux-gnu-tests.svg
[x64lm]: http://ci.termsend.bofc.pl/badges/x86_64-builder-linux-musl-tests.svg
[x64lu]: http://ci.termsend.bofc.pl/badges/x86_64-builder-linux-uclibc-tests.svg
[x64ss]: http://ci.termsend.bofc.pl/badges/x86_64-builder-solaris-tests.svg
[prhpux]: http://ci.termsend.bofc.pl/badges/parisc-polarhome-hpux-tests.svg
[p4aix]: http://ci.termsend.bofc.pl/badges/power4-polarhome-aix-tests.svg
[x32qnx]: http://ci.termsend.bofc.pl/badges/i686-builder-qnx-tests.svg
[x64df]: http://ci.termsend.bofc.pl/badges/x86_64-builder-dragonfly-tests.svg

[fsan]: http://ci.termsend.bofc.pl/badges/fsanitize-address.svg
[fsleak]: http://ci.termsend.bofc.pl/badges/fsanitize-leak.svg
[fsun]: http://ci.termsend.bofc.pl/badges/fsanitize-undefined.svg
[fsthread]: http://ci.termsend.bofc.pl/badges/fsanitize-thread.svg