Skip to content

Instantly share code, notes, and snippets.

@blacktop
Last active November 24, 2018 22:10
Show Gist options
  • Save blacktop/0ca84b26c03ceaa5b7e5c395fc40bf81 to your computer and use it in GitHub Desktop.
Save blacktop/0ca84b26c03ceaa5b7e5c395fc40bf81 to your computer and use it in GitHub Desktop.
from macho import MachO
m = MachO.from_file('kernelcache.release.iphone11.decompressed')
print('CPU: {}, Subtype: {}'.format(m.header.cputype.name.upper(), m.header.cpusubtype))
print('Build Version: {}'.format(m.load_commands[22].body))
print('Source Version: {}'.format(m.load_commands[23].body))
for lc in m.load_commands:
if hasattr(lc.type, 'segment_64'):
if hasattr(lc.body, 'sections'):
for sec in lc.body.sections:
print('{}.{}'.format(sec.seg_name, sec.sect_name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment