Python Challenge - Level 12


Checking the source, the image is named as evil1.jpg. Try evil2 and you will see:


Change suffix to .gfx to download the file

Is it over? Try evil3.jpg, we got:

Really? "no more evils"? Let's try evil4.jpg. Depend on your browser, you may see nothing or an error message

The image "http://www.pythonchallenge.com/pc/return/evil4.jpg" cannot be displayed because it contains errors.

But, it is not 404! Let's take a closer look:

$ curl -u huge:file http://www.pythonchallenge.com/pc/return/evil4.jpg
Bert is evil! go back!

OK, Bert is evil, whoever that is.


It is hard to tell what's going on inside the file.

>>> data = open("evil2.gfx", "rb").read()
>>> data

Back to the problem's image, someone is dealing the cards into 5 stacks, and all the cards are ... 5.

>>> len(data)

Let's try to split the data into 5, but "dealing" the bytes instead of cards...

>>> for i in range(5):
...     open('%d.jpg' % i ,'wb').write(data[i::5])

Open the generated 0.jpg through 4.jpg, you should see dis, pro, port, tional

Put Everything Together

data = open("evil2.gfx", "rb").read()
for i in range(5):
    open('%d.jpg' % i ,'wb').write(data[i::5])

Next Level