Skip to content

Instantly share code, notes, and snippets.

@dsc
Created March 11, 2010 15:01
Show Gist options
  • Select an option

  • Save dsc/329205 to your computer and use it in GitHub Desktop.

Select an option

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.
#!/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;}"
@ozzyisgreat
Copy link

probably still works however the website appears to be down

@okineadev
Copy link

Yep

@enganese
Copy link

we need it back...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment