Created
March 11, 2010 15:01
-
-
Save dsc/329205 to your computer and use it in GitHub Desktop.
shadyurl.sh -- Don't just shorten your URLs via the command line, also make them suspicious and frightening.
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 | |
# @author [email protected] | |
if test "$1"; then | |
LONG_URL="$1" | |
else | |
read LONG_URL | |
fi | |
SHADY="http://www.shadyurl.com/create.php?myUrl=" | |
function uri () { | |
python -c "import urllib; print urllib.quote('$1')" | |
} | |
# Look for: | |
# <div id="output"> ... <a href="$LONG_URL">$LONG_URL</a> ... <a href="http://5z8.info/malicious-cookie_b8z7i_hot-older-goats.mov"> | |
curl -s --url "${SHADY}$(uri "${LONG_URL}")" | \ | |
sed -nE -e "/<div id='output'>/ {s|^.*<a href='${LONG_URL}'>${LONG_URL}</a> <p>is now</p> <a href='([^']+)'.*\$|\\1|g;p;}" |
11 years ago, oh.
probably still works however the website appears to be down
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you give an example of use?