[安洵杯 2019]吹着贝斯扫二维码
-
首先把图片移动到
image
目录中,代码如下:import os import shutil for root, dirs, files in os.walk("."): for file in files: if not file.endswith(".zip") and not file.endswith(".py"): shutil.copy(file, f"./images/{file}.jpg")
- 随便打开一张图片,发现图片的序号了,一共有36张图片,拼图的难度太大了,我试了一下,我反正是拼不出来。我们根据序号写个代码自动拼图就好了。
-
拼图代码:
import re import os import binascii from PIL import Image def get_img_path(number): for root, dirs, files in os.walk("./images"): for file in files: img_path = os.path.join(root, file) with open(img_path, "rb") as f: data = f.read() hex_str = binascii.b2a_hex(data[-4:]).decode() count = re.findall("ffd9(.*?)$", hex_str)[0] if len(count) == 2: ret = chr(int(count, 16)) elif len(count) == 4: ret = "".join(chr(int(count[i:i+2], 16)) for i in range(0, len(count), 2)) if int(ret) == number: return img_path width = 134 height = 130 new_img = Image.new("RGB", size=(134*6, 130*6)) for y in range(6): for x in range(1, 7): number = y * 6 + x img_path = get_img_path(number) img = Image.open(img_path) new_img.paste(img, (width * (x - 1), height * y)) new_img.show()
4.扫描二维码
BASE Family Bucket ??? 85->64->85->13->16->32
没有base13的,所以猜测为rot13
复制这个然后使用解开:
解压密码:ThisIsSecret!233
解压flag.zip,拿到flag:flag{Qr_Is_MeAn1nGfuL}