Last active
August 29, 2015 14:10
-
-
Save fmagin/94c06189753cc6e1a1fc to your computer and use it in GitHub Desktop.
You give the script the four letter identifier after sprunge.us/ and an optional filename( if noone is given it defaults to the letter identifier), and it downloads it. Utilizes AES decryption with static key for imrpoved privacy for personal files
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
#!/bin/bash | |
decrypt="openssl enc -aes-256-cbc -base64 -d -k $key" | |
url="sprunge.us/$1" | |
file="$(curl $url | $decrypt)" | |
if [ "${file:0:9}" == "Filename:" ]; then | |
echo Filename found | |
firstline=$(echo "$file" | head -1) | |
filename=${firstline:9} | |
content=$(echo "$file" | tail -n +2) | |
echo "$content" > $filename | |
echo "Saved to $filename" | |
else | |
if [ -z $2 ]; then | |
filename=$1 | |
else | |
filename=$2 | |
fi | |
echo $file > $filename | |
echo "Saved to $filename" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
more quotes, less subprocesses
untested, but should work