import zlib import struct filename = 'abc.png' # 这个文件放入要爆破的图片 with open(filename, 'rb') as f: all_b = f.read() crc32key = int(all_b[29:33].hex(),16) data = bytearray(all_b[12:29]) n = 4095 # 理论上0xffffffff,但考虑到屏幕实际/cpu,0x0fff就差不多了 for w in range(n): # 高和宽一起爆破 width = bytearray(struct.pack('>i', w)) #q为8字节,i为4字节,h为2字节 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("宽为:",end="") print(width) print("高为:",end="") print(height) exit(0)