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
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.
despite this is from 2007 , i am learning python and find this code very interesting. thanks for sharing :)
ana
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.
I have to learn Python really soon i see, intersesting code!
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 :)