challenge 17

I haven’t forgotten about the python, err, ruby challenge. Although I have been busy with a number of other things I have been chipping away at number 17. It’s quite a doozy, I became discouraged on more than one occasion. But in the end my stubbornness always brought me back.

Challenge 17 presents you with a picture of cookies,and a small inserted picture from challenge 4, the first nothings. The big hint is the cookie picture, so we look at our browser cookies. The pythonchallenge cookie says ;

info=you+should+have+followed+busynothing…;

So I went back and looked at the challenge 4 script, changed the ‘next nothing’ to ‘next busynothing’ and ran it.
After a minute or so it runs through all the busynothing numbers and stops at zero. nothing. dead end.

We have to go back to the Big Hint, cookies. Each call to the php script on the server returns a document. Each of these documents contains another cookie. And each cookie contains a very small ‘info’ value. If we collect all of these cookie crumbs together we find a message. it looks like a bzipped string, except their are a couple of illegal characters in it. When the string is fixed and unzipped we get this;

is it the 26th already? call his father and inform him that “the flowers are on their way”. he’ll understand.

code;

#!/usr/bin/ruby
crumbs = ''
nothing = 12345
url = "http://www.pythonchallenge.com/pc/def/linkedlist.php?busynothing="
require 'cgi'
require 'open-uri'
require 'bz2'

while nothing > 0
        phpCall = open(url + nothing.to_s)
        busyNothing = phpCall.read
        # get the cookie
        cookies = phpCall.meta['set-cookie']
        # get  contents of 'info'
        crumb = cookies.split(';')[0].split('=')[1]
        # collect crumbs
        crumbs += crumb
        #set the next busy nothing value
        nothing = busyNothing.split("busynothing is ")[1].to_i
end
# uncompress the resulting string
message = BZ2.bunzip2(CGI.unescape(crumbs))
puts message

The 26th, they must mean Mozart, call Mozarts father Leopold. We can use the php phone book from challenge 13 to look him up. That brings us to Leopold’s page, and the only hint there is the title;

its me. what do you want?

Weren’t we supposed to tell him something? Oh yeah, “the flowers are on the way”. I said it to the computer a couple of times and Leopold just stared at me. Hmm, maybe he’ll be more helpful if I give him a cookie;

#! /usr/bin/ruby

require 'cgi'
require 'open-uri'

message='the flowers are on their way'
url='http://www.pythonchallenge.com/pc/stuff/violin.php'
puts open(url, "Cookie" => "info=" + CGI.escape(message)).read()

To which leopold replies;

oh well, don’t you dare to forget the balloons.

It looks easy now, but it took me weeks (off and on, mostly off) to figure it out. Especially the final step, I don’t know how many dead ends I hit there.

Next: Python challenge 18, can you tell the difference?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s