Created
August 26, 2012 17:54
-
-
Save that4chanwolf/3482081 to your computer and use it in GitHub Desktop.
Uploader
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 | |
# upload.sh (goput|omploadr|imgur) file | |
if [ "x${1}" = 'x' ]; then | |
echo 'need host' | |
exit | |
fi | |
if [ "x{$2}" = "x" ]; then | |
echo 'need filename' | |
exit | |
fi | |
case $1 in | |
omploadr) | |
curl --silent -i -F name=file1 -F file1="@${2}" http://ompldr.org/upload | | |
grep -Eo 'http://.+\.(png|jpg|gif)' | |
;; | |
goput) | |
curl --silent -i -F name=file1 -F file="@${2}" http://goput.it/gp5/handle.php | | |
grep -Eo 'value="http://.+"' | | |
sed -e 's/^value="//' -e 's/"$//' | |
;; | |
imgur) | |
HASH=`curl --silent -i -F name=file -F file="@${2}" http://imgur.com/upload | grep -Eo '\[\\".+\\"\]' | sed -e 's/^\[\\"//' -e 's/\\"\]//'` | |
echo "http://imgur.com/${HASH}" | |
;; | |
*) | |
echo 'Oh shit nigger, what are you doing?' | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mfw