Home

Previous Entry | Next Entry

fetch_urls_from_tinyurl.sh

  • Mar. 16th, 2008 at 12:05 AM


#!/bin/bash
# Fetch URLs from tinyurl.com
# Make sure you have curl and bc installed before you run this.
#
# Joel Franusic 2008 - Public Domain Sofware

MIN=1
MAX=10000
SLEEP_MAX=3
l=(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z)

for((n=$MIN; n<$MAX; n++)); do
r=`echo "obase=36;$n" | bc`
num=''
echo -n "$n "
for c in $r; do
c=${c#0} # remove zero padding, yay variable mangling!
num=$num${l[$c]};
done
echo -n "$num "
result=`curl -s -I "http://tinyurl.com/$num" | grep -o -e 'http.*'`
echo -n "$result"
echo ''
sleep $((RANDOM%$SLEEP_MAX))
done

Tags: