#!/usr/bin/env python3 """B9A read-only helper: dump words / strings / bytes from stock lk.bin (base 0x8f600000). usage: lkmem.py lk.bin w ADDR N | s ADDR | b ADDR N""" import sys, struct BASE=0x8f600000 d=open(sys.argv[1],'rb').read() def w(a): return struct.unpack_from(' {st!r}' if st else '')) elif k=='s': print(repr(s(a))) elif k=='b': print(d[a-BASE:a-BASE+int(sys.argv[4])].hex(' '))