#!/bin/bash #QUERY_STRING=`echo -ne "email=alt@mw.jikos.cz&prefix=554"` mkdir /tmp/etg.$$ cd /tmp/etg.$$ echo $QUERY_STRING|egrep -q "^[a-zA-Z0-9\.-]*$" || { echo -ne "Content-Type: text/plain\r\n\r\nInvalid characters in input\r\n"; exit; } #wget -qsO allpage http://$QUERY_STRING.tk/ [ "$QUERY_STRING" ] || { echo -ne "Content-Type: text/plain\r\n\r\nUsage:\r\n\r\nhttp://.horky.net/\r\n"; exit; } curl -isS http://$QUERY_STRING.tk/ > allpage REDIR=`cat allpage|egrep "^Location:.*bn01a\.taloha"` [ "$REDIR" = "" ] || { REDIRURL=`echo -n $REDIR|head -n 1|tr -d "\r\n"|sed -e "s/^Location: //"` echo -e "Content-Type: text/html" echo -e echo -e "Page http://$QUERY_STRING.tk/ not found.
" echo -ne "Click here to register." exit } PAGE=`cat allpage | grep "dot_tk_frame_content" | cut -f2 -d'"'` [ -e $PAGE ] && { echo -e "Location: http://$QUERY_STRING.tk/" echo -e echo -e "Page doesn't seem to be a redirect.
" echo -e "Click here to open original .tk page." exit } echo -e "Location: $PAGE" echo -e echo -e "Page is redirected. Destination: $PAGE" cd .. rm -rf /tmp/etg.$$