Python Challenge Solutions
    Level 0
    Level 1
    Level 2
    Level 3
    Level 4
    Level 5
    Level 6
    Level 7
    Level 8
    Level 9
    Level 10

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 "" cannot be displayed because it contains errors.

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

$ curl -u huge:file
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