Python Challenge level 12: “dealing evil”

Level 12 requires some hex-observation.

Hint 1: image evil1.jpg with a shuffled deck and five piles

The name evil1 seems suspicious, so maybe we can find something else poking around.

Fact 1: there are more evil?.jpg and an evil2.gfx

Fact 2: when inspected in an hex editor the gfx file seems to have several images interleaved. You don’t have to be a genius to recognize a JPEG header, but the GIF87a is much more obvious. Not everybody is used to reading binary files, but simply by watching you can get the idea that each file is shuffled every 5 bytes. So the task will be deshuffling evil2.gfx into 5 piles

Fact 3: when trying to retrieve file evil4.jpg a text appears “http://www.pythonchallenge.com/pc/return/evil4.jpg” and the source code is “Bert is evil! go back!”. This is not useful right now, but keep it in mind. It may come in handy in the future.

That’s a lot of text for one post ;) At least the task is clear. Two lines of code should suffice:

#!/usr/bin/env python
info=open("evil2.gfx").read()
[open("12_f%d.dat" %i, "w").write(info[i::5]) for i in range(5)]

My image viewer doesn’t really care for the file extension, so “.bin” suits me fine. Anyway you could allways use the file command in case yours cares.

Once we view the images, we get the link for Level 13.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Comments »

 
 

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>