aboutsummaryrefslogtreecommitdiffstats
apaste: the apaste program

apaste
Software
skarnet.org

The apaste program

apaste is a program that reads one or more files, or its standard input, and sends the data to an apasted server.

Interface

     apaste [ -S | -s ] [ -C cadir ] [ -d server[:port] ] [ -r rtimeout ] [ -w wtimeout ] file...
  • apaste connects to a remote server via a plaintext or TLS-secured connection, expecting to find an apasted server at the other end.
  • For every file given as argument, it sends the contents of file over the network. If file is - (dash), then apaste's stdin is transmitted until EOF.
  • The server answers with a blob of six printable characters, named a slug. Depending on the server configuration, it may embed the slug in a complete URL, for easy copy-paste into a browser; or it may embed it in another way.
  • apaste prints the slug to its stdout, then exits 0.

Exit codes

0
Success. The data has been recorded by the server and available in some way as indicated by the slug.
100
Bad usage. apaste was run in an incorrect way.
111
System call failed. This usually signals an issue with the underlying operating system, or with the network in some way.

Options

-S
Normal, plain text connection to the server, even if the built-in default is TLS. The built-in default can be changed via the --with-default-tls or --without-default-tls options to configure.
-s
TLS connection to the server, even if the built-in default is plain text. The built-in default can be changed via the --with-default-tls or --without-default-tls options to configure.
-C cadir
When using a TLS connection, use cadir as the directory containing the hashed names of the trust anchor certificates (used for verifying the server's certificate chain). The built-in default can be changed via the --with-default-cadir option to configure.
-d server[:port]
Connect to server server, port port. The built-in defaults can be changed via the --with-default-server, --with-default-port, and --with-default-tlsport options to configure.
-r rtimeout
If the server isn't answering with a slug within rtimeout milliseconds, give up. The default is 0, meaning infinite: apaste will wait forever for a server reply if necessary.
-w wtimeout
If the server hasn't accepted all the data within wtimeout milliseconds, give up. The default is 0, meaning infinite: apaste will take as much time as it needs to send its data.

Example usage

  • $ echo Blah blah. | apaste -
  • # apaste /etc/shadow (Just kidding. Don't do that.)

Notes

  • apaste is only a wrapper around s6-tcpclient (for plain connections) or s6-tlsclient (for TLS-tunneled connections), and apastec that is the real client. The point of apaste is to provide a short command line with good compiled-in defaults; make sure your defaults are correct at configure time when building the apaste package.
  • -, i.e. stdin, cannot be mentioned several times as an argument. It can be transmitted with other files, but cannot be duplicated.