Feb 13, 2012

HTS Programming Mission 11


If you are copy-pasting this thing and thinking that getting points will make you more cool amongst your friends then you can just fuck off. You will remain dumb then.
You can understand the algorithm I used and implement in your own way

In NISER, means where I am currently studying uses Linux in the terminals .I found the hardest thing in this challenge is to solve n submit the challenge in 3 seconds. Damn man! The page loading time is if late then you are undone :P

So I use a shell script (similar like batch files in windows to directly open my account, retrieve my challenge , download, process and submit it)

You have to give your username and password here and just run the shell script and if you don’t know what is shell script you can ask you mother Google.

If you have solved in another way, please send me your solution to share with the world

#!/bin/bash
USER=""
PASS=""
if [ -z "$PASS" ]; then echo "You need to set your username and password in the script."; exit 1; fi
wget -q -O .login.html http://www.hackthissite.org/user/login --post-data="username=$USER&password=$PASS&btn_submit=Login" --save-cookies=.cookies.txt --keep-session-cookies --referer http://www.hackthissite.org/
grep "Image Validation" .login.html >/dev/null && echo "Error: You need to log out/in in a web browser" && exit 1
wget -q -O -  http://www.hackthissite.org/missions/prog/11/  --load-cookies=.cookies.txt --keep-session-cookies --referer http://www.hackthissite.org/missions/programming/ > out.txt

TEXT=`cat out.txt | grep "Generated String:" | cut -f 2 -d : | cut -f 1 -d "<" | tr -d [:blank:]`
SHIFT=`cat out.txt | grep "Generated String:" | cut -f 3 -d : | cut -f 1 -d "<" | tr -d [:blank:]`

echo "If this doesn't work, you'll need to add this separator:"
echo $TEXT

for EACH in `echo $TEXT | tr "," "\n" | tr ")" "\n" | tr "#" "\n"| tr "'" "\n"| tr "." "\n"| tr "&" "\n"| tr "(" "\n"| tr "!" "\n"| tr "%" "\n"| tr "$" "\n"| tr "+" "\n"| tr "-" "\n"| tr "/" "\n"| tr "*" "\n"| tr "@" "\n"| tr "^" "\n"| tr "\"" "\n"`
do
let EACH=$EACH-$SHIFT
STRING="$STRING$(printf "\\$(printf "%03o" $EACH)")"
done
echo The string is $STRING
wget -q -O -  http://www.hackthissite.org/missions/prog/11/index.php --post-data="solution=$STRING"  --load-cookies=.cookies.txt --keep-session-cookies --referer http://www.hackthissite.org/missions/prog/11/ > out2.txt
grep "answer is wrong" out2.txt | html2text
grep -i successfully out2.txt | html2text
grep -i "already completed" out2.txt | html2text

rm .login.html; rm .cookies.txt; rm out.txt; rm out2.txt


No comments:

Post a Comment