其他分享
首页 > 其他分享> > BMZCTF:真正的CTFer

BMZCTF:真正的CTFer

作者:互联网

http://bmzclub.cn/challenges#%E7%9C%9F%E6%AD%A3%E7%9A%84CTFer

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
修改了图片宽高,通过脚本爆破CRC还原下图片的原始的宽高

import struct
import zlib

def hexStr2bytes(s):
    b = b""
    for i in range(0,len(s),2):
        temp = s[i:i+2]
        b +=struct.pack("B",int(temp,16))
    return b

str1="49484452"#Chunk[0] IHDR
str2="0806000000"#Bit depth、ColorType、Compression method、Filter method、Interlace method
bytes1=hexStr2bytes(str1)
bytes2=hexStr2bytes(str2)
wid,hei = 1308,1280#当前宽高

crc32 = "0x6f03ad71"#图片原来的CRC

for w in range(wid,wid+2000):
    for h in range(hei,hei+2000):
        width = hex(w)[2:].rjust(8,'0')
        height = hex(h)[2:].rjust(8,'0')
        bytes_temp=hexStr2bytes(width+height)
        if eval(hex(zlib.crc32(bytes1+bytes_temp+bytes2))) == eval(crc32):
            print(hex(w),hex(h))

在这里插入图片描述
修改宽高
在这里插入图片描述
得到完整图片

在这里插入图片描述
在这里插入图片描述

flag{d2b5543c2f8aa8229057872dd85ce5a9}

标签:wid,BMZCTF,temp,hex,宽高,CTFer,crc32,hexStr2bytes,真正
来源: https://blog.csdn.net/mochu7777777/article/details/111144417