#!/bin/bash
url="http://www.hacker.org/challenge/misc/minuteman.php"
temp="/home/brian/.temp_compare_page_file"
temp_md5sum="$temp.md5"
curl "$url" 2>/dev/null > $temp
if [ ! -e $temp_md5sum ]
then
md5sum $temp > $temp_md5sum
else
if ! md5sum --status -c $temp_md5sum
then
cp $temp /home/brian/Desktop/OHSHIT
else
rm $temp
fi
fi
Basically, each time this script is run, it fetches the web page in question, and compares the md5sum of the file to an existing md5sum. If it doesn't match, it copies it to my desktop and renames it OHSHIT.
After a few hours of running every minute, OHSHIT magically popped up on my desktop.
i did a php script that just compared the string in the HTTP response.
if it is it searches for "is" and ":" and sends the word after it as solution. it almost worked when i used it except the fact that i forgot to remove the space after "is"/":"
require 'net/http'
text = nil
begin
text = Net::HTTP.get_response('www.hacker.org','/challenge/misc/minuteman.php').body
sleep 10
end while text =~ /back later/
File.open("answer.txt", "w") { |f| f.puts text }
Then I picked up the answer in the file the next day.
I'm exploiting the fact that the begin/end block is ran at least once (even though the 'text' variable is still 'nil' before the first iteration). This is worth mentioning because it wouldn't work if the while condition was attached to a single statement/expression.
Mine was almost the same as aurora's. Running with PHP on command line after some time I had the answer written in the console. But I needed several days because the script stopped execution a few times due to network timeouts.
the script got the page with wget and then did a diff with the default "come back later" page. is the diff wasnt equal the output of diff was written to a file.