美文网首页
Python Challenge[19]

Python Challenge[19]

作者: Recgat | 来源:发表于2017-02-15 21:50 被阅读0次

[Level 19]


Title: please!

查看源码,邮件的附件?试着下载indain.wav文件,不存在。下面的一段字符串,使用base64解码输出为indian.wav,是一段声音:杂音+sorry+杂音。

import base64
with open('indian.txt','rb') as input,open('indian.wav','wb') as output:
  base64.decode(input,output)

跳转到sorry.html,显示- "what are you apologizing for?"

想了很久,技穷了。印度地图海洋和陆地的颜色颠倒了,还有源码中提示Maybe my computer is out of order.。好吧,这两点真没发现。

import wave
with wave.open('indian.wav') as iw, wave.open('new.wav','w') as new:
  new.setnchannels(iw.getnchannels())
  new.setsampwidth(iw.getsampwidth())
  new.setframerate(iw.getframerate())
  data = iw.readframes(iw.getnframes())
  new.writeframes(data[::-1])

声音是不同了,但有点问题。需要将音频每一帧反转:

for i in range(iw.getnframes()):
  new.writeframes(iw.readframes(1)[::-1])

可以听出关键词idiotidiot.html给出了过关链接,[Level 20]

小结

wave模块的方法还是比较简单明了的。

Python Challenge Wiki

1. 使用email获取音频

import email
message = open('email.txt', 'rb').read().decode()
mail = email.message_from_string(message)
audio = mail.get_payload(0).get_payload(decode=True)
with open('indian.wav', 'wb') as f:
  f.write(audio)

2. 反转之外

frames = iw.readframes(iw.getnframes())
iw2.setsampwidth(iw.getsampwidth())
iw2.setframerate(iw.getframerate()//2)
iw2.writeframes(frames[::2])

或者

h.setsampwidth(w.getsampwidth()//2)
h.setframerate(w.getframerate()*2)
wave.big_endiana = 1
h.writeframes(frames)

有趣!

More

相关文章

  • Python Challenge[19]

    [Level 19] Title: please! 查看源码,邮件的附件?试着下载indain.wav文件,不存在...

  • Python挑战:00~03关

    Python Challenge Python Challenge 00 网址: http://www.pytho...

  • Python挑战:04-05关

    Python Challenge Python Challenge 04 现在,我们来挑战第四关,从第三关的结果,...

  • The Python Challenge(5)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 根据页面源码提示: 再点击页面图片显示: 可知是需要...

  • The Python Challenge(8)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 页面和源码中无任何提示,但图片中有一条很明显的灰度线...

  • The Python Challenge(9)

    问题链接 问题链接如下: 答案链接 答案链接如下: 登陆用户名密码为huge和file。 解题思路 阅读源码有如下...

  • The Python Challenge(2)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 将页面给定的字符串根据给定规则进行替换即可,规则如下...

  • The Python Challenge(3)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 根据页面提示: 阅读源码,有如下内容: 编写代码从中...

  • The Python Challenge(4)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 根据页面提示: 并结合页面源码中的内容,有如下代码:...

  • The Python Challenge(6)

    问题链接 问题链接如下: 答案链接 答案链接如下: 解题思路 根据页面源码提示: python中发音类似的术语有p...

网友评论

      本文标题:Python Challenge[19]

      本文链接:https://www.haomeiwen.com/subject/silfwttx.html