From the Canyon Edge -- :-Dustin

Friday, March 2, 2012

pbput and pbget moved to the pastebinit package!

I'm quite proud to say that the pbput and pbget utilities have graduated from their incubating home in the bikeshed package and have made it into the more ubiquitous pastebinit package.  A huge thanks to Stéphane Graber for merging these useful utilities!

As of Ubuntu 12.04 LTS (precise), anywhere you have the pastebinit command, you'll also have the ability to pbput and pbget data.

"And so what does that mean?" you ask :-)
  1. Have you ever wanted to just download some raw data, maybe some code or text, from a pastebin?
  2. Or have you ever needed to pass someone some raw data, perhaps binary, perhaps text, perhaps an entire directory tree, and just wanted to give them a URL?
  3. And have you ever wanted to do that totally securely?
Well, that's exactly what (1) pbget, (2) pbput, and (3) pbputs does!

Try this on an up-to-date Ubuntu 12.04 system:

  1. $ pbget
    INFO: Output is in [/tmp/pbget.60RezTX8QF]
  2. $ bzr branch lp:pastebinit
    Branched 150 revisions.
    $ pbput pastebinit

    Note that you (the poster) might have to visit that url once manually and enter a captcha, to convince that you're not a bot.

    But you can now:

    Try it!
  3. $ pbputs supersecret.txt

    You can try downloading that one, but it's encrypted with Stephan's public key, so he's the only one who can make any sense out of it!
So how does it work?

It's really quite simple, actually...  pbput, pbget, and pbputs are all symlinks to a single shell script that at /usr/bin/pbput, which is only 74 lines of code!

When you pbput data, it's bundled into an archive using tar, optionally encrypted with gpg, compressed using lzma, encoded using base64, and then posted to a pastebin using pastebinit.

And a pbget is just unwrapping each of those, retrieving it from the pastebin using wget, decoding, decompressing it, optionally decrypting it, and exploding the archive.

If the data was posted using standard in, the output comes back in standard out.  And if the data was posted as a file or directory, it gets dumped to a new temporary directory created by mktemp.

Slick, huh?  :-)  Give it a try and let me know what you think!!!