27 lines
774 B
Python
27 lines
774 B
Python
#!/usr/bin/env python3
|
|
import sys, re
|
|
|
|
def dump_menu(path, needle=b'set ', span=1200):
|
|
d = open(path, 'rb').read()
|
|
i = d.find(needle)
|
|
if i < 0:
|
|
print(' (no marker)')
|
|
return
|
|
chunk = d[max(0, i-200): i+span]
|
|
txt = re.sub(rb'[^\x09\x0a\x0d\x20-\x7e]+', b'\n', chunk).decode('latin1')
|
|
for line in txt.splitlines():
|
|
line = line.strip()
|
|
if line:
|
|
print(' ', line)
|
|
|
|
for path in sys.argv[1:]:
|
|
print('=====================', path.split('/')[-1])
|
|
dump_menu(path)
|
|
print()
|
|
|
|
print('=== ISO magic at 0x8001:')
|
|
for p in ('/mnt/f/efi/Paravis/Utilities/ADD', '/mnt/f/efi/Paravis/Utilities/ABA'):
|
|
with open(p, 'rb') as f:
|
|
f.seek(32769); b = f.read(8)
|
|
print(' %-4s %r' % (p.split('/')[-1], b))
|