美文网首页程序员
Python Challenge[26]

Python Challenge[26]

作者: Recgat | 来源:发表于2017-02-28 22:14 被阅读0次

[Level 26]


Title: be a man - apologize!

Hurry up, I'm missing the boat

源码中有一提示:you've got his e-mail,指的是[Level 19]中的leopold.moz@pythonchallenge.com。但没想出来有什么用。

这个邮件存在,需要我们以sorryapology(或其他?)为主题发个邮件过去。邮件回复:

Never mind that.
Have you found my broken zip?
md5: bbb8b499a0eef99b52c7f13f4e78c24b
Can you believe what one mistake can lead to?

一个错误,什么错误?缺少了一个字节,穷举验证:

import hashlib
data = open('mybroken.zip','rb').read()
for i in range(len(data)):
  for j in range(256):
    new = data[:i]+bytes([j])+data[i+1:]
    if hashlib.md5(new).hexdigest()=='bbb8b499a0eef99b52c7f13f4e78c24b':
      open('repaired.zip','wb').write(new)
      exit()

打开修复的压缩包里的图片,显示speed,但 speed.html 不存在。网页中的提示派上用场了,speedboat才对,[Level 27]

小结

或许还应注意到:

bytes(iterable_of_ints) -> bytes
bytes(int) -> bytes object of size given by the parameter initialized with null bytes

Python Challenge Wiki

Pythonic 的方式发送邮件:

import email.message, smtplib
apology = email.message.Message()
apology.add_header('To', 'leopold.moz@pythonchallenge.com')
apology.add_header('From', from_addr)
apology.add_header('Subject', 'Apology')
apology.set_payload('Sorry!')

server = smtplib.SMTP_SSL('smtp.gmail.com')
server.login(from_addr, pw)
server.sendmail(apology['from'], apology['to'], apology.as_string())
server.quit()

More

相关文章

  • Python Challenge[26]

    [Level 26] Title: be a man - apologize! Hurry up, I'm mis...

  • 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[26]

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