Skip to content

Commit

Permalink
Merge pull request #26 from doronz88/feature/kernelcache-thin
Browse files Browse the repository at this point in the history
build_identity: always extract kernelcache thin image
  • Loading branch information
doronz88 authored Aug 20, 2024
2 parents ce5f068 + a707826 commit 705f3a6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ipsw_parser/build_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import List, Mapping, Optional

from cached_property import cached_property
from plumbum import local
from plumbum import ProcessExecutionError, local
from pyimg4 import IM4P

from ipsw_parser.component import Component
Expand Down Expand Up @@ -162,10 +162,15 @@ def extract(self, output: Path) -> None:
kernel_output = output / 'System/Library/Caches/com.apple.kernelcaches' / kernel_path.parts[-1]

logger.info(f'extracting kernel into: {kernel_output}')
# kernel_output.write_bytes(kernel_component.data)
im4p = IM4P(kernel_component.data)
im4p.payload.decompress()
kernel_output.write_bytes(im4p.payload.output().data)
try:
# In case the kernel is a FAT image, extract the arm64 macho
local['ipsw']('macho', 'lipo', '-a', 'arm64', kernel_output)
list(kernel_output.parent.glob('*.arm64'))[0].rename(kernel_output)
except ProcessExecutionError:
pass

for cryptex in ('App', 'OS'):
name = {
Expand Down

0 comments on commit 705f3a6

Please sign in to comment.