ipsw-parser 1.3.2__tar.gz → 1.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/PKG-INFO +7 -4
  2. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/README.md +6 -3
  3. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/__main__.py +31 -5
  4. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/_version.py +2 -2
  5. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/build_identity.py +37 -16
  6. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/ipsw.py +2 -1
  7. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser.egg-info/PKG-INFO +7 -4
  8. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/.gitattributes +0 -0
  9. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  10. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  11. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/.github/workflows/codeql.yml +0 -0
  12. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/.github/workflows/python-app.yml +0 -0
  13. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/.github/workflows/python-publish.yml +0 -0
  14. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/.gitignore +0 -0
  15. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/.pre-commit-config.yaml +0 -0
  16. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/CODE_OF_CONDUCT.md +0 -0
  17. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/LICENSE +0 -0
  18. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/__init__.py +0 -0
  19. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/build_manifest.py +0 -0
  20. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/component.py +0 -0
  21. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/exceptions.py +0 -0
  22. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/firmware.py +0 -0
  23. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser/img4.py +0 -0
  24. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser.egg-info/SOURCES.txt +0 -0
  25. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser.egg-info/dependency_links.txt +0 -0
  26. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser.egg-info/entry_points.txt +0 -0
  27. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser.egg-info/requires.txt +0 -0
  28. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/ipsw_parser.egg-info/top_level.txt +0 -0
  29. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/pyproject.toml +0 -0
  30. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/pytest.ini +0 -0
  31. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/requirements.txt +0 -0
  32. {ipsw_parser-1.3.2 → ipsw_parser-1.3.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipsw-parser
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: python3 utility for parsing and extracting data from IPSW
5
5
  Author-email: doronz88 <doron88@gmail.com>
6
6
  Maintainer-email: doronz88 <doron88@gmail.com>
@@ -722,12 +722,15 @@ the split DSC.
722
722
  # Usage
723
723
 
724
724
  ```
725
- Usage: python -m ipsw_parser [OPTIONS] COMMAND [ARGS]...
725
+ Usage: ipsw-parser [OPTIONS] COMMAND [ARGS]...
726
+
727
+ CLI utility for extracting info from IPSW files
726
728
 
727
729
  Options:
728
730
  --help Show this message and exit.
729
731
 
730
732
  Commands:
731
- extract extract .ipsw into filesystem layout
732
- info parse given .ipsw basic info
733
+ device-support Create DeviceSupport directory
734
+ extract Extract .ipsw into filesystem layout
735
+ info Parse given .ipsw basic info
733
736
  ```
@@ -18,12 +18,15 @@ the split DSC.
18
18
  # Usage
19
19
 
20
20
  ```
21
- Usage: python -m ipsw_parser [OPTIONS] COMMAND [ARGS]...
21
+ Usage: ipsw-parser [OPTIONS] COMMAND [ARGS]...
22
+
23
+ CLI utility for extracting info from IPSW files
22
24
 
23
25
  Options:
24
26
  --help Show this message and exit.
25
27
 
26
28
  Commands:
27
- extract extract .ipsw into filesystem layout
28
- info parse given .ipsw basic info
29
+ device-support Create DeviceSupport directory
30
+ extract Extract .ipsw into filesystem layout
31
+ info Parse given .ipsw basic info
29
32
  ```
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  import logging
3
+ import plistlib
4
+ from datetime import datetime
3
5
  from pathlib import Path
4
6
  from typing import IO
5
7
  from zipfile import ZipFile
@@ -23,14 +25,15 @@ logger = logging.getLogger(__name__)
23
25
 
24
26
 
25
27
  @click.group()
26
- def cli():
28
+ def cli() -> None:
29
+ """ CLI utility for extracting info from IPSW files """
27
30
  pass
28
31
 
29
32
 
30
33
  @cli.command('info')
31
34
  @click.argument('file', type=click.Path(exists=True, file_okay=True, dir_okay=False))
32
- def info(file):
33
- """ parse given .ipsw basic info """
35
+ def info(file) -> None:
36
+ """ Parse given .ipsw basic info """
34
37
  ipsw = IPSW(ZipFile(file))
35
38
  print(f'SupportedProductTypes: {ipsw.build_manifest.supported_product_types}')
36
39
  print(f'ProductVersion: {ipsw.build_manifest.product_version}')
@@ -46,8 +49,8 @@ def info(file):
46
49
  @cli.command('extract')
47
50
  @click.argument('file', type=click.Path(exists=True, file_okay=True, dir_okay=False))
48
51
  @click.argument('output', type=click.Path(exists=False))
49
- def extract(file: IO, output: str):
50
- """ extract .ipsw into filesystem layout """
52
+ def extract(file: IO, output: str) -> None:
53
+ """ Extract .ipsw into filesystem layout """
51
54
  output = Path(output)
52
55
 
53
56
  if not output.exists():
@@ -59,5 +62,28 @@ def extract(file: IO, output: str):
59
62
  path=output, members=[f for f in ipsw.archive.filelist if f.filename.startswith('Firmware')])
60
63
 
61
64
 
65
+ @cli.command('device-support')
66
+ @click.argument('file', type=click.Path(exists=True, file_okay=True, dir_okay=False))
67
+ def device_support(file: IO) -> None:
68
+ """ Create DeviceSupport directory """
69
+ device_support_path = Path('~/Library/Developer/Xcode/iOS DeviceSupport').expanduser()
70
+ ipsw = IPSW(ZipFile(file))
71
+ device_support_path /= (f'{ipsw.build_manifest.supported_product_types[0]} '
72
+ f'{ipsw.build_manifest.product_version} ({ipsw.build_manifest.product_build_version})')
73
+ build_identity = ipsw.build_manifest.build_identities[0]
74
+ symbols_path = device_support_path / 'Symbols'
75
+ build_identity.extract_dsc(symbols_path)
76
+ for file in (symbols_path / 'private/preboot/Cryptexes/OS/System/Library/Caches/com.apple.dyld').iterdir():
77
+ file.unlink()
78
+ (device_support_path / 'Info.plist').write_bytes(plistlib.dumps({
79
+ 'DSC Extractor Version': '1228.0.0.0.0',
80
+ 'DateCollected': datetime.now(),
81
+ 'Version': '16.0',
82
+ }))
83
+ (device_support_path / '.finalized').write_bytes(plistlib.dumps({}))
84
+ (device_support_path / '.processed_dyld_shared_cache_arm64e').touch()
85
+ (device_support_path / '.processing_lock').touch()
86
+
87
+
62
88
  if __name__ == '__main__':
63
89
  cli()
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.3.2'
16
- __version_tuple__ = version_tuple = (1, 3, 2)
15
+ __version__ = version = '1.3.3'
16
+ __version_tuple__ = version_tuple = (1, 3, 3)
@@ -3,7 +3,7 @@ import shutil
3
3
  from collections import UserDict
4
4
  from pathlib import Path
5
5
  from tempfile import TemporaryDirectory
6
- from typing import List, Mapping
6
+ from typing import List, Mapping, Optional
7
7
 
8
8
  from cached_property import cached_property
9
9
  from plumbum import local
@@ -13,7 +13,7 @@ from ipsw_parser.component import Component
13
13
  logger = logging.getLogger(__name__)
14
14
 
15
15
 
16
- def _extract_dmg(buf: bytes, output: Path) -> None:
16
+ def _extract_dmg(buf: bytes, output: Path, sub_path: Optional[Path] = None) -> None:
17
17
  ipsw = local['ipsw']
18
18
  hdiutil = local['hdiutil']
19
19
  # darwin system statistically have problems cleaning up after detaching the mountpoint
@@ -34,7 +34,11 @@ def _extract_dmg(buf: bytes, output: Path) -> None:
34
34
  hdiutil('attach', '-mountpoint', mnt, dmg)
35
35
 
36
36
  try:
37
- shutil.copytree(mnt, output, symlinks=True, dirs_exist_ok=True)
37
+ if sub_path is None:
38
+ src = mnt
39
+ else:
40
+ src = mnt / sub_path
41
+ shutil.copytree(src, output, symlinks=True, dirs_exist_ok=True)
38
42
  except shutil.Error:
39
43
  # when overwriting the same files, some of them don't contain write permissions
40
44
  pass
@@ -42,6 +46,22 @@ def _extract_dmg(buf: bytes, output: Path) -> None:
42
46
  hdiutil('detach', '-force', mnt)
43
47
 
44
48
 
49
+ def _split_dsc(root: Path) -> None:
50
+ ipsw = local['ipsw']
51
+ dsc_paths = [
52
+ root / 'System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64',
53
+ root / 'System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64e',
54
+ root / 'private/preboot/Cryptexes/OS/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64',
55
+ root / 'private/preboot/Cryptexes/OS/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64e']
56
+
57
+ for dsc in dsc_paths:
58
+ if not dsc.exists():
59
+ continue
60
+
61
+ logger.info(f'splitting DSC: {dsc}')
62
+ ipsw('dyld', 'split', dsc, '-o', root)
63
+
64
+
45
65
  class BuildIdentity(UserDict):
46
66
  def __init__(self, build_manifest, data):
47
67
  super().__init__(data)
@@ -87,7 +107,7 @@ class BuildIdentity(UserDict):
87
107
  key_list += ['UniqueBuildID', 'Ap,OSLongVersion', 'Ap,OSReleaseType', 'Ap,ProductType', 'Ap,SDKPlatform',
88
108
  'Ap,SikaFuse', 'Ap,Target', 'Ap,TargetType', 'ApBoardID', 'ApChipID',
89
109
  'ApSecurityDomain', 'BMU,BoardID', 'BMU,ChipID', 'BbChipID', 'BbProvisioningManifestKeyHash',
90
- 'BbActivationManifestKeyHash', 'BbCalibrationManifestKeyHash',
110
+ 'BbActivationManifestKeyHash', 'BbCalibrationManifestKeyHash', 'Ap,ProductMarketingVersion',
91
111
  'BbFactoryActivationManifestKeyHash', 'BbFDRSecurityKeyHash', 'BbSkeyId', 'SE,ChipID',
92
112
  'Savage,ChipID', 'Savage,PatchEpoch', 'Yonkers,BoardID', 'Yonkers,ChipID',
93
113
  'Yonkers,PatchEpoch', 'Rap,BoardID', 'Rap,ChipID', 'Rap,SecurityDomain', 'Baobab,BoardID',
@@ -116,8 +136,19 @@ class BuildIdentity(UserDict):
116
136
  if requires_uid_mode is not None:
117
137
  parameters['RequiresUIDMode'] = requires_uid_mode
118
138
 
139
+ def extract_dsc(self, output: Path) -> None:
140
+ build_identity = self.build_manifest.build_identities[0]
141
+ if not build_identity.has_component('Cryptex1,SystemOS'):
142
+ return
143
+
144
+ device_support_symbols_path = output / 'private/preboot/Cryptexes/OS/System'
145
+ device_support_symbols_path.mkdir(parents=True, exist_ok=True)
146
+
147
+ _extract_dmg(build_identity.get_component('Cryptex1,SystemOS').data, device_support_symbols_path,
148
+ sub_path=Path('System'))
149
+ _split_dsc(output)
150
+
119
151
  def extract(self, output: Path) -> None:
120
- ipsw = local['ipsw']
121
152
  logger.info(f'extracting into: {output}')
122
153
 
123
154
  build_identity = self.build_manifest.build_identities[0]
@@ -147,14 +178,4 @@ class BuildIdentity(UserDict):
147
178
  logger.info(f'extracting {name} into: {cryptex_path}')
148
179
  _extract_dmg(build_identity.get_component(name).data, cryptex_path)
149
180
 
150
- dsc_paths = [output / 'System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64',
151
- output / 'System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64e',
152
- output / 'System/Cryptexes/OS/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64',
153
- output / 'System/Cryptexes/OS/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64e']
154
-
155
- for dsc in dsc_paths:
156
- if not dsc.exists():
157
- continue
158
-
159
- logger.info(f'splitting DSC: {dsc}')
160
- ipsw('dyld', 'split', dsc, '-o', output)
181
+ _split_dsc(output)
@@ -30,7 +30,8 @@ class IPSW:
30
30
  def __init__(self, archive: zipfile.ZipFile):
31
31
  self.archive = archive
32
32
  self._logger = logging.getLogger(__file__)
33
- self.build_manifest = BuildManifest(self, self.archive.read(next(f for f in self.archive.namelist() if f.startswith('BuildManifest') and f.endswith('.plist'))))
33
+ self.build_manifest = BuildManifest(self, self.archive.read(
34
+ next(f for f in self.archive.namelist() if f.startswith('BuildManifest') and f.endswith('.plist'))))
34
35
 
35
36
  @cached_property
36
37
  def restore_version(self) -> bytes:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipsw-parser
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: python3 utility for parsing and extracting data from IPSW
5
5
  Author-email: doronz88 <doron88@gmail.com>
6
6
  Maintainer-email: doronz88 <doron88@gmail.com>
@@ -722,12 +722,15 @@ the split DSC.
722
722
  # Usage
723
723
 
724
724
  ```
725
- Usage: python -m ipsw_parser [OPTIONS] COMMAND [ARGS]...
725
+ Usage: ipsw-parser [OPTIONS] COMMAND [ARGS]...
726
+
727
+ CLI utility for extracting info from IPSW files
726
728
 
727
729
  Options:
728
730
  --help Show this message and exit.
729
731
 
730
732
  Commands:
731
- extract extract .ipsw into filesystem layout
732
- info parse given .ipsw basic info
733
+ device-support Create DeviceSupport directory
734
+ extract Extract .ipsw into filesystem layout
735
+ info Parse given .ipsw basic info
733
736
  ```
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes