Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_identity: always extract kernelcache thin image #26

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading