Python Challenge level 19: “please!”

For level 19 I used two scripts.

Hint 1: there is an email in the source with an attached file

#!/usr/bin/env python
import email
mail=email.message_from_file(open('19.txt'))
for part in mail.walk():
    if part.get_content_maintype()=='audio':
        audio=part.get_payload(decode=1)
        open('19_indian.wav', 'wb').write(audio)

The only understandable thing in the file was the word “sorry”, and that page is not really useful. Theres more to the riddle than meets the ear.

Hint 2: the colors of the map seem to be inverted.

After trying reversing the info (utter jibberish), the hint is to be reinterpreted as “inverted India”, which I take as “inverted endian”. Nice longshot. And correct, for what it’s worth.

#!/usr/bin/env python
import array,wave
wi = wave.open('19_indian.wav','rb')
wo = wave.open('19_indian_inv.wav', 'wb')
wo.setparams(wi.getparams())
a = array.array('i')
a.fromstring(wi.readframes(wi.getnframes()))
a.byteswap()
wo.writeframes(a.tostring())
wi.close(),wo.close()

This part of the challenge was completely unexpected. I hadn’t even used the wave module untill today! And we get a nice file with these lyrics:

you are an idiot

And with a message from Leopold, we go to Level 20.

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.

7 Comments »

 
  • ana says:

    despite this is from 2007 , i am learning python and find this code very interesting. thanks for sharing :)
    ana

  • Maia Gantner says:

    Hi Ana,

    I have to agree with you that this post is quite interesting. Since I’m new to Challenge 19, I’m sure this info will help me a lot. Thanks for sharing it.

  • You are absolutely right. This code are very helpful. Thanks for sharing this.

  • Good catch with the colors being inverted and taking that as a hint.

    I’ve always loved coding. Never got too much into Python though. I still remember the days of Coding in BASIC, lol.

  • trancoso says:

    I have to learn Python really soon i see, intersesting code!

  • QuantTrader says:

    Hi!

    wonderful blog out there with lots of interesting stuff man! Good work.
    I got stuck on this one.. When I save the wav file it is still in text format (I use “wb” parameter) and this happens even if I run your piece of code.. Do you have any insights what can be wrong?
    Thanks :)

  • loans direct says:

    By making use of a great an internet vendor, buyers make it quite possible that would store around for the particular the number one terms and for the entire sort kind of payday loan that suits we optimal, without being limited by geographical location.

 

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>