[安洵杯 2019]吹着贝斯扫二维码

[安洵杯 2019]吹着贝斯扫二维码

  1. 首先把图片移动到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")
    

  1. 随便打开一张图片,发现图片的序号了,一共有36张图片,拼图的难度太大了,我试了一下,我反正是拼不出来。我们根据序号写个代码自动拼图就好了。

请添加图片描述


  1. 拼图代码:

    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}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值