Files
2026-11-23 04:26:37 +02:00

22 lines
881 B
Python

#!/usr/bin/env python3
"""List the hotfix push IDs (and row counts) a client DBCache.bin holds.
DBCache v9 (build 70334): 'XFTH', version, build, 32-byte hash; then entries of
'XFTH', u32 ?, i32 push_id, u32 unique_id, u32 table_hash, i32 record_id,
u32 size, u32 status, <size> bytes. Usage: dbcache_pushes.py DBCache.bin
"""
import struct, sys
from collections import Counter
def pushes(path):
b = open(path, 'rb').read()
assert b[:4] == b'XFTH' and struct.unpack_from('<I', b, 4)[0] == 9, 'not a v9 DBCache'
at, rows = 44, Counter()
while at < len(b):
assert b[at:at + 4] == b'XFTH', f'bad entry at {at}'
_, push, _, _, _, size, _ = struct.unpack_from('<IiIIiII', b, at + 4)
rows[push] += 1
at += 32 + size
return rows
if __name__ == '__main__':
for push, count in sorted(pushes(sys.argv[1]).items()): print(push, count)