-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add links to pbget, and pbgets (and to the manpage) relicensed from GPLv3 to GPLv2
- Loading branch information
1 parent
bcf852c
commit 649b7ba
Showing
6 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pbput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pbput.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/sh | ||
# | ||
# pbput, pbputs, pbget - put and get binary files to/from pastebin.com | ||
# Copyright (C) 2010 Dustin Kirkland <dustin.kirkland@gmail.com> | ||
# | ||
# Authors: Dustin Kirkland <dustin.kirkland@gmail.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
PROG=$(basename $0) | ||
URL="http://pastebin.com" | ||
TEMPLATE="$PROG.XXXXXXXXXX" | ||
[ -d "$TMPDIR" ] && TEMPLATE="$TMPDIR/$TEMPLATE" || TEMPLATE="/tmp/$TEMPLATE" | ||
|
||
# Create a secure tempfiles | ||
TEMP=$(mktemp $TEMPLATE) | ||
TEMP2=$(mktemp $TEMPLATE) | ||
trap "rm -f $TEMP $TEMP2 2>/dev/null || true" EXIT HUP INT QUIT TERM | ||
|
||
case "$PROG" in | ||
pbget) | ||
url=$(echo "$1" | sed -e "s:.com/:.com/download.php?i=:") | ||
wget -q -O- "$url" | base64 -d | lzma -d > "$TEMP" | ||
# Support secure uploads | ||
if gpg -d "$TEMP" >"$TEMP2" 2>/dev/null; then | ||
# Upload was encrypted | ||
mv -f "$TEMP2" "$TEMP" | ||
fi | ||
if LC=C file "$TEMP" | grep -qs "^$TEMP: POSIX tar archive"; then | ||
# Download is a tarball; unpack safely | ||
[ -d "$2" ] && DIR="$2" || DIR=$(mktemp -d $TEMPLATE) | ||
tar -C "$DIR" -xvf "$TEMP" 2>/dev/null || cat "$TEMP" | ||
echo "INFO: Output is in [$DIR]" | ||
else | ||
# Upload came from stdin, so display on stdout | ||
cat "$TEMP" | ||
fi | ||
;; | ||
pbput|pbputs) | ||
if [ -r "$1" ]; then | ||
# Read file from argument | ||
tar cf "$TEMP" "$1" | ||
else | ||
# Read from standard in | ||
cat /dev/stdin > "$TEMP" | ||
fi | ||
if [ "$PROG" = "pbputs" ]; then | ||
mv -f "$TEMP" "$TEMP".in | ||
cat "$TEMP".in | gpg -c > "$TEMP" | ||
rm -f "$TEMP".in | ||
fi | ||
lzma -9 -f -c "$TEMP" | base64 | pastebinit -b "$URL" | ||
;; | ||
*) | ||
echo "ERROR" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
.TH pbput 1 "6 Oct 2010" bikeshed "bikeshed" | ||
.SH NAME | ||
pbput - compress and encode arbitrary files to pastebin.com | ||
|
||
pbputs - compress, encrypt, encode arbitrary files to pastebin.com | ||
|
||
pbget - decode and decompress arbitrary files from pastebin.com | ||
|
||
.SH SYNOPSIS | ||
\fBpbput\fP [FILENAME] | ||
|
||
cat foo | \fBpbput\fP | ||
|
||
\fBpbputs\fP [FILENAME] | ||
|
||
cat foo | \fBpbputs\fP | ||
|
||
\fBpbget\fP URL [DIRECTORY] | ||
|
||
.SH DESCRIPTION | ||
\fBpbput\fP is a program that can upload text files, binary files or entire directory structures to a pastebin, such as pastebin.com. | ||
|
||
\fBpbget\fP is a program that be used to retrieve content uploaded to a pastebin by \fBpbput\fP. | ||
|
||
\fBpbputs\fP operates exactly like \fBpbput\fP, except the user is prompted for a symmetric passphrase for encrypting the content with \fBgpg\fP(1) before uploading. \fBpbget\fP will automatically prompt the receiving user for the pre-shared passphrase. | ||
|
||
\fBpbput\fP and \fBpbputs\fP can take its input either on STDIN, or as a FILENAME argument. | ||
- If STDIN is used, then the receiving user's \fBpbget\fP will simply paste the input on STDOUT. | ||
- If a FILENAME or DIRECTORY is passed as an argument, then it is first archived using \fBtar\fP(1) to preserve the file and directory attributes | ||
|
||
\fBpbget\fP takes a URL as its first, mandatory argument. Optionally, it takes a DIRECTORY as a second parameter. If the incoming data is in fact a file or file structure in a \fBtar\fP(1) archive, then that data will be extracted in the specified DIRECTORY. If no DIRECTORY is specified, then a temporary directory is created using \fBmktemp\fP(1). | ||
|
||
In any case the uploaded/downloaded data is optionally \fBtar\fP(1) archived, always \fBlzma\fP(1) compressed, optionally \fBgpg\fP(1) encrypted, and always \fBbase64\fP(1) encoded. \fIhttp://pastebin.com\fP is used by default. | ||
|
||
.SH EXAMPLES | ||
$ pbput /sbin/init | ||
http://pastebin.com/BstNzasK | ||
$ pbget http://pastebin.com/BstNzasK | ||
sbin/init | ||
INFO: Output is in [/tmp/pbget.bG67DwY6Zl] | ||
|
||
$ cat /etc/lsb-release | pbput | ||
http://pastebin.com/p43gJv6Z | ||
$ pbget http://pastebin.com/p43gJv6Z | ||
DISTRIB_ID=Ubuntu | ||
DISTRIB_RELEASE=11.04 | ||
DISTRIB_CODENAME=natty | ||
DISTRIB_DESCRIPTION="Ubuntu 11.04" | ||
|
||
$ pbputs /etc/shadow | ||
Enter passphrase: | ||
http://pastebin.com/t2ZaCYr3 | ||
$ pbget http://pastebin.com/t2ZaCYr3 | ||
Enter passphrase: | ||
root:09cc6d2d9d63371a425076e217f77698:15096:0:99999:7::: | ||
daemon:*:15089:0:99999:7::: | ||
bin:*:15089:0:99999:7::: | ||
sys:*:15089:0:99999:7::: | ||
.... | ||
|
||
.SH SEE ALSO | ||
\fBpastebinit\fP(1)\fP, \fBlzma\fP(1), \fBbase64\fP(1), \fBtar\fP(1), \fBgpg\fP(1), \fBmktemp\fP(1) | ||
|
||
.SH AUTHOR | ||
This manpage and the utility was written by Dustin Kirkland <kirkland@ubuntu.com> for Ubuntu systems (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or later published by the Free Software Foundation. | ||
|
||
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL, or on the web at \fIhttp://www.gnu.org/licenses/gpl.txt\fP. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pbput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pbput.1 |