27 lines
931 B
Python
27 lines
931 B
Python
#!/usr/bin/env python3
|
|
import sys, re
|
|
|
|
def around(path, needle, before=300, after=700):
|
|
d = open(path, 'rb').read()
|
|
i = d.find(needle)
|
|
if i < 0:
|
|
print(' (not found)')
|
|
return
|
|
chunk = d[max(0, i-before): i+after]
|
|
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, needle in (
|
|
('/mnt/f/efi/Paravis/Boot/g4d/antiv', b'/efi/Paravis/KRD'),
|
|
('/mnt/f/efi/Paravis/Boot/g4d/acroDD', b'/efi/Paravis/Utilities/ADD'),
|
|
('/mnt/f/efi/Paravis/Boot/g4d/acroBA', b'/efi/Paravis/Utilities/ABA'),
|
|
('/mnt/f/efi/Paravis/Boot/g4d/phdm', b'/efi/Paravis/Utilities/phdm.krn'),
|
|
('/mnt/f/efi/Paravis/Boot/g4d/mint64r', b'/efi/Paravis/Linux/x64/vmlinuz'),
|
|
):
|
|
print('=====================', path.split('/')[-1])
|
|
around(path, needle)
|
|
print()
|