purrito(1)                                           purr(1)
                             /\_/\
                            ( o.o )
                             > ^ <


NAME

	purrito: ultra fast, minimalistic, encrypted command line paste-bin
	purr: POSIX shell client to paste to bsd.ac
	meow: POSIX shell client to paste encrypted paste to bsd.ac
	meowd: POSIX shell client to decrypt encrypted paste from bsd.ac


CLIENT

	: ${P_SERVER=bsd.ac}
	: ${P_PORT=42069}
	: ${P_MAXTIME=30}
	: ${_PL=week} # can be set to day/week/month/<lifetime-in-minutes>

	# POSIX shell client to upload standard message
	purr() {
		curl --silent --max-time "${P_MAXTIME}" --data-binary "@${1:-/dev/stdin}" "${P_SERVER}:${P_PORT}/${_PL}"
	}

	# POSIX shell client to upload encrypted message
	meow() {
		# we need to generate a 256 byte random key
		# for using the aes-256-cbc cipher
		key="$(openssl rand -hex 32)"
		iv="$(openssl rand -hex 16)"
		# calculate its encryption and upload it
		url="$(openssl enc -aes-256-cbc -K ${key} -iv ${iv} -e -base64 -A < ${1:-/dev/stdin} | purr)"
		printf %s\\n "${url%\/*}/paste.html#${url##*\/}_${key}_${iv}"
		unset key iv url
	}

	# POSIX shell client to decrypt the message
	meowd() {
		url="$1"
		baseurl="${url%\/*}"
		vals="${url##*\#}"
		paste=$(printf %s\\n "${vals}" | cut -d'_' -f1)
		key=$(printf %s\\n "${vals}" | cut -d'_' -f2)
		iv=$(printf %s\\n "${vals}" | cut -d'_' -f3)
		curl --max-time "${P_MAXTIME}" --write-out "\n" --silent "${baseurl}/${paste}" | openssl enc -aes-256-cbc -base64 -d -K ${key} -iv ${iv}
		unset url baseurl vals paste key iv
	}

USAGE

	~$ purr c00lfile.txt
	https://bsd.ac/purrit0

	~$ purr < h0tfile.txt
	https://bsd.ac/purri1o

	~$ echo Hello world. | purr
	https://bsd.ac/d4nklit

	~$ purr
	This is my input
	it can span multiple lines
	<Ctrl-d to exit>
	https://bsd.ac/curlpr0


LIMITS

	max paste size: 64KB


SOURCE

	https://github.com/PurritoBin/PurritoBin