[青少年CTF]Crypto-继续扫吧要有耐心

1)题目链接

题目链接

2)解题思路

2.1、下载文件,解压缩得到1857张二维码图片,使用python中pyzbar模块进行批量二维码解码。
from pyzbar.pyzbar import decode
from PIL import Image

ss=[]
for i in range(1,1858):
    f='F:\Ctf-Files\ctf-file\附件\\'+str(i)+'.png'
    d= decode(Image.open(f))[0].data.decode()
    d=d.replace('.','').replace('-','').replace('/','').replace('=','=\n')		#扫描出一串base64编码字符串,其中包含干扰字符(.-/)需要替换掉
    print(d,end='')

[青少年CTF]Crypto-继续扫吧要有耐心_第1张图片

2.2、通过两次base64解码得到19串md5编码,使用在线md5解码发现为单个字符串,使用hashlib模块对md5编码进行强匹配。

字符串中包含:abcdefghijklmnopqrst{}-

import re,hashlib,string

str_map=string.ascii_lowercase+string.digits+'{'+'}'+'-'
s='7694f4a66316e53c8cdd9d9954bd611d03c7c0ace395d80182db07ae2c30f0347b8b965ad4bca0e41ab51de7b31363a14a8a08f09d37b73795649038408b5f33e358efa489f58062f10dd7316b65649e8fa14cdd754f91cc6554c9e71929cce7f95b70fdc3088560732a5ac135644506cfcd208495d565ef66e7dff9f98764da1679091c5a880faf6fb5e6087eb1b2dc0cc175b9c0f1b6a831c399e2697726618277e0910d750195b448797616e091ad8fa14cdd754f91cc6554c9e71929cce70cc175b9c0f1b6a831c399e2697726611679091c5a880faf6fb5e6087eb1b2dc0cc175b9c0f1b6a831c399e269772661336d5ebc5436534e61d16e63ddfca3278fa14cdd754f91cc6554c9e71929cce71679091c5a880faf6fb5e6087eb1b2dc4a8a08f09d37b73795649038408b5f3392eb5ffee6ae2fec3ad71c777531578f336d5ebc5436534e61d16e63ddfca3274a8a08f09d37b73795649038408b5f33c9f0f895fb98ab9159f51fd0297e236da87ff679a2f3e71d9181a67b7542122c0cc175b9c0f1b6a831c399e269772661cfcd208495d565ef66e7dff9f98764daa87ff679a2f3e71d9181a67b7542122c8fa14cdd754f91cc6554c9e71929cce7e1671797c52e15f763380b45e841ec32cbb184dd8e05c9709e5dcaedaa0495cf'
ss=re.findall('.{32}',s)
for i in ss:
    for j in str_map:
        if i == hashlib.md5(j.encode()).hexdigest():
            i = j
            print(i,end='')

flag:qsnctf{06adfa6a-f6cb-c84a04fe}

你可能感兴趣的:(python)