内容仅供个人记录学习使用,转载会注明出处。如有侵权,请联系,立即删除。
010打开,显示CRC不匹配
python脚本爆破
脚本来自博客园大佬:https://www.cnblogs.com/lixiongji/p/14013484.html
import zlib
import struct
with open(r'C:\Users\ASUS\Desktop\一叶障目\1.png','rb') as image_data:
bin_data = image_data.read()
data = bytearray(bin_data[12:29]) #这段数据就是png图中IHDR段的16进制数据,不包括开始的length和最后CRC
crc32key = eval(str(bin_data[29:33]).replace(r'\x', '').replace("b'", '0x').replace("'", ''))
#理论上0xffffffff,但考虑到屏幕实际,0x0fff就差不多了
n = 4096
#高和宽一起爆破
for w in range(n):
# q为8字节,i为4字节,h为2字节
width = bytearray(struct.pack('>i', w))
for h in range(n):
height = bytearray(struct.pack('>i', h))
for x in range(4):
data[x+4] = width[x]
data[x+8] = height[x]
crc32result = zlib.crc32(data)
if crc32result == crc32key:
print("width:%s height:%s" % (bytearray(width).hex(),bytearray(height).hex()))
exit()
width:00000141 height:0000034c
修改宽高值
flag{66666}