Skip to content

Instantly share code, notes, and snippets.

@dsc
Created March 11, 2010 15:01
Show Gist options
  • Save dsc/329205 to your computer and use it in GitHub Desktop.
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 dsc@less.ly
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;}"
@Fl1yd
Copy link

Fl1yd commented Nov 15, 2020

Can you give an example of use?

@Fl1yd
Copy link

Fl1yd commented Nov 15, 2020

11 years ago, oh.

@ozzyisgreat
Copy link

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