Server : Apache/2.4.41 (Ubuntu) System : Linux journalup 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /bin/ |
#!/bin/sh # # pbput, pbputs, pbget - put and get binary files to/from pastebin.com # Copyright (C) 2010 Dustin Kirkland <[email protected]> # # Authors: Dustin Kirkland <[email protected]> # # 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="paste.ubuntu.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") wget -q -O- "$url" | grep -A 999999999 '<div class="paste"><pre>' | grep -B 999999999 "^</pre>" | sed -e "s/.*<pre>//" -e "s/^<\/pre>.*//" | 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" # Second argument indicates a target user in the gpg keyring [ -z "$2" ] && GPG_OPTS="-c" || GPG_OPTS="-s -e -r $2" else # Read from standard in cat /dev/stdin > "$TEMP" # Argument indicates a target user in the gpg keyring [ -z "$1" ] && GPG_OPTS="-c" || GPG_OPTS="-s -e -r $1" fi if [ "$PROG" = "pbputs" ]; then mv -f "$TEMP" "$TEMP".in cat "$TEMP".in | gpg $GPG_OPTS > "$TEMP" rm -f "$TEMP".in fi lzma -9 -f -c "$TEMP" | base64 | pastebinit -b "$URL" ;; *) echo "ERROR" 1>&2 exit 1 ;; esac