ipsw-parser 1.3.7__tar.gz → 1.3.8__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.7 → ipsw_parser-1.3.8}/.github/workflows/python-app.yml +2 -3
  2. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/PKG-INFO +5 -3
  3. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/__main__.py +13 -5
  4. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/_version.py +2 -2
  5. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/build_identity.py +19 -10
  6. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/build_manifest.py +2 -3
  7. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/ipsw.py +5 -5
  8. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser.egg-info/PKG-INFO +5 -3
  9. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser.egg-info/requires.txt +1 -0
  10. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/pyproject.toml +5 -4
  11. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/requirements.txt +1 -0
  12. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/.gitattributes +0 -0
  13. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  14. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  15. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/.github/workflows/codeql.yml +0 -0
  16. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/.github/workflows/python-publish.yml +0 -0
  17. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/.gitignore +0 -0
  18. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/.pre-commit-config.yaml +0 -0
  19. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/CODE_OF_CONDUCT.md +0 -0
  20. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/LICENSE +0 -0
  21. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/README.md +0 -0
  22. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/__init__.py +0 -0
  23. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/component.py +0 -0
  24. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/exceptions.py +0 -0
  25. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/firmware.py +0 -0
  26. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser/img4.py +0 -0
  27. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser.egg-info/SOURCES.txt +0 -0
  28. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser.egg-info/dependency_links.txt +0 -0
  29. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser.egg-info/entry_points.txt +0 -0
  30. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/ipsw_parser.egg-info/top_level.txt +0 -0
  31. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/pytest.ini +0 -0
  32. {ipsw_parser-1.3.7 → ipsw_parser-1.3.8}/setup.cfg +0 -0
@@ -13,8 +13,8 @@ jobs:
13
13
 
14
14
  strategy:
15
15
  matrix:
16
- python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12" ]
17
- os: [ macos-latest ]
16
+ python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
17
+ os: [ ubuntu-latest, macos-latest, windows-latest ]
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v2
@@ -24,7 +24,6 @@ jobs:
24
24
  python-version: ${{ matrix.python-version }}
25
25
  - name: Install dependencies
26
26
  run: |
27
- brew install blacktop/tap/ipsw
28
27
  python3 -m pip install --upgrade pip
29
28
  python3 -m pip install pre-commit
30
29
  - name: Run pre-commit hooks
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipsw-parser
3
- Version: 1.3.7
3
+ Version: 1.3.8
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>
@@ -685,12 +685,13 @@ Keywords: ios,cli,firmware,ipsw
685
685
  Classifier: Development Status :: 5 - Production/Stable
686
686
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
687
687
  Classifier: Programming Language :: Python :: 3
688
- Classifier: Programming Language :: Python :: 3.8
689
688
  Classifier: Programming Language :: Python :: 3.9
690
689
  Classifier: Programming Language :: Python :: 3.10
691
690
  Classifier: Programming Language :: Python :: 3.11
691
+ Classifier: Programming Language :: Python :: 3.12
692
+ Classifier: Programming Language :: Python :: 3.13
692
693
  Classifier: Programming Language :: Python :: 3 :: Only
693
- Requires-Python: >=3.8
694
+ Requires-Python: >=3.9
694
695
  Description-Content-Type: text/markdown
695
696
  License-File: LICENSE
696
697
  Requires-Dist: construct>=2.9.29
@@ -699,6 +700,7 @@ Requires-Dist: coloredlogs
699
700
  Requires-Dist: cached_property
700
701
  Requires-Dist: plumbum
701
702
  Requires-Dist: pyimg4>=0.8.6
703
+ Requires-Dist: requests
702
704
  Provides-Extra: test
703
705
  Requires-Dist: pytest; extra == "test"
704
706
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  import logging
3
3
  from pathlib import Path
4
- from typing import IO
4
+ from typing import IO, Optional
5
5
  from zipfile import ZipFile
6
6
 
7
7
  import click
@@ -21,6 +21,12 @@ logging.getLogger('urllib3.connectionpool').disabled = True
21
21
 
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
+ PEM_DB_ENV_VAR = 'IPSW_PARSER_PEM_DB'
25
+
26
+ pem_db_option = click.option('--pem-db', envvar=PEM_DB_ENV_VAR,
27
+ help='Path DB file url (can be either a filesystem path or an HTTP URL). '
28
+ 'Alternatively, use the IPSW_PARSER_PEM_DB envvar.')
29
+
24
30
 
25
31
  @click.group()
26
32
  def cli() -> None:
@@ -47,7 +53,8 @@ def info(file) -> None:
47
53
  @cli.command('extract')
48
54
  @click.argument('file', type=click.Path(exists=True, file_okay=True, dir_okay=False))
49
55
  @click.argument('output', type=click.Path(exists=False))
50
- def extract(file: IO, output: str) -> None:
56
+ @pem_db_option
57
+ def extract(file: IO, output: str, pem_db: Optional[str]) -> None:
51
58
  """ Extract .ipsw into filesystem layout """
52
59
  output = Path(output)
53
60
 
@@ -55,16 +62,17 @@ def extract(file: IO, output: str) -> None:
55
62
  output.mkdir(parents=True, exist_ok=True)
56
63
 
57
64
  ipsw = IPSW(ZipFile(file))
58
- ipsw.build_manifest.build_identities[0].extract(output)
65
+ ipsw.build_manifest.build_identities[0].extract(output, pem_db=pem_db)
59
66
  ipsw.archive.extractall(
60
67
  path=output, members=[f for f in ipsw.archive.filelist if f.filename.startswith('Firmware')])
61
68
 
62
69
 
63
70
  @cli.command('device-support')
64
71
  @click.argument('file', type=click.Path(exists=True, file_okay=True, dir_okay=False))
65
- def device_support(file: IO) -> None:
72
+ @pem_db_option
73
+ def device_support(file: IO, pem_db: Optional[str]) -> None:
66
74
  """ Create DeviceSupport directory """
67
- IPSW(ZipFile(file)).create_device_support()
75
+ IPSW(ZipFile(file)).create_device_support(pem_db=pem_db)
68
76
 
69
77
 
70
78
  if __name__ == '__main__':
@@ -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.7'
16
- __version_tuple__ = version_tuple = (1, 3, 7)
15
+ __version__ = version = '1.3.8'
16
+ __version_tuple__ = version_tuple = (1, 3, 8)
@@ -3,8 +3,9 @@ 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, Optional
6
+ from typing import Optional
7
7
 
8
+ import requests
8
9
  from cached_property import cached_property
9
10
  from plumbum import ProcessExecutionError, local
10
11
  from pyimg4 import IM4P
@@ -14,7 +15,7 @@ from ipsw_parser.component import Component
14
15
  logger = logging.getLogger(__name__)
15
16
 
16
17
 
17
- def _extract_dmg(buf: bytes, output: Path, sub_path: Optional[Path] = None) -> None:
18
+ def _extract_dmg(buf: bytes, output: Path, sub_path: Optional[Path] = None, pem_db: Optional[str] = None) -> None:
18
19
  ipsw = local['ipsw']
19
20
  hdiutil = local['hdiutil']
20
21
  # darwin system statistically have problems cleaning up after detaching the mountpoint
@@ -28,7 +29,15 @@ def _extract_dmg(buf: bytes, output: Path, sub_path: Optional[Path] = None) -> N
28
29
  logger.debug('Found Apple Encrypted Archive. Decrypting...')
29
30
  dmg_aea = Path(str(dmg) + '.aea')
30
31
  dmg_aea.write_bytes(buf)
31
- ipsw('fw', 'aea', dmg_aea, '-o', temp_dir)
32
+ args = ['fw', 'aea', dmg_aea, '-o', temp_dir]
33
+ if pem_db is not None:
34
+ if '://' in pem_db:
35
+ # create a local file containing it
36
+ temp_pem_db = temp_dir / 'pem-db.json'
37
+ temp_pem_db.write_text(requests.get(pem_db, verify=False).text)
38
+ pem_db = temp_pem_db
39
+ args += ['--pem-db', pem_db]
40
+ ipsw(args)
32
41
  else:
33
42
  dmg.write_bytes(buf)
34
43
 
@@ -85,7 +94,7 @@ class BuildIdentity(UserDict):
85
94
  return self['Info'].get('MacOSVariant')
86
95
 
87
96
  @cached_property
88
- def manifest(self) -> Mapping:
97
+ def manifest(self) -> dict:
89
98
  return self['Manifest']
90
99
 
91
100
  @cached_property
@@ -101,7 +110,7 @@ class BuildIdentity(UserDict):
101
110
  def get_component(self, name: str, **args) -> Component:
102
111
  return Component(self, name, **args)
103
112
 
104
- def populate_tss_request_parameters(self, parameters: Mapping, additional_keys: List[str] = None):
113
+ def populate_tss_request_parameters(self, parameters: dict, additional_keys: Optional[list[str]] = None) -> None:
105
114
  """ equivalent to idevicerestore:tss_parameters_add_from_manifest """
106
115
  key_list = ['ApBoardID', 'ApChipID']
107
116
  if additional_keys is None:
@@ -137,7 +146,7 @@ class BuildIdentity(UserDict):
137
146
  if requires_uid_mode is not None:
138
147
  parameters['RequiresUIDMode'] = requires_uid_mode
139
148
 
140
- def extract_dsc(self, output: Path) -> None:
149
+ def extract_dsc(self, output: Path, pem_db: Optional[str] = None) -> None:
141
150
  build_identity = self.build_manifest.build_identities[0]
142
151
  if not build_identity.has_component('Cryptex1,SystemOS'):
143
152
  return
@@ -146,16 +155,16 @@ class BuildIdentity(UserDict):
146
155
  device_support_symbols_path.mkdir(parents=True, exist_ok=True)
147
156
 
148
157
  _extract_dmg(build_identity.get_component('Cryptex1,SystemOS').data, device_support_symbols_path,
149
- sub_path=Path('System'))
158
+ sub_path=Path('System'), pem_db=pem_db)
150
159
  _split_dsc(output)
151
160
 
152
- def extract(self, output: Path) -> None:
161
+ def extract(self, output: Path, pem_db: Optional[str] = None) -> None:
153
162
  logger.info(f'extracting into: {output}')
154
163
 
155
164
  build_identity = self.build_manifest.build_identities[0]
156
165
 
157
166
  logger.info(f'extracting OS into: {output}')
158
- _extract_dmg(build_identity.get_component('OS').data, output)
167
+ _extract_dmg(build_identity.get_component('OS').data, output, pem_db=pem_db)
159
168
 
160
169
  kernel_component = build_identity.get_component('KernelCache')
161
170
  kernel_path = Path(kernel_component.path)
@@ -185,6 +194,6 @@ class BuildIdentity(UserDict):
185
194
  cryptex_path.mkdir(parents=True, exist_ok=True)
186
195
 
187
196
  logger.info(f'extracting {name} into: {cryptex_path}')
188
- _extract_dmg(build_identity.get_component(name).data, cryptex_path)
197
+ _extract_dmg(build_identity.get_component(name).data, cryptex_path, pem_db=pem_db)
189
198
 
190
199
  _split_dsc(output)
@@ -1,5 +1,4 @@
1
1
  import plistlib
2
- from typing import List
3
2
 
4
3
  from cached_property import cached_property
5
4
 
@@ -15,7 +14,7 @@ class BuildManifest:
15
14
 
16
15
  @cached_property
17
16
  def build_major(self) -> int:
18
- build_major = str()
17
+ build_major = ''
19
18
  for i in self._manifest['ProductBuildVersion']:
20
19
  if i.isdigit():
21
20
  build_major += i
@@ -25,7 +24,7 @@ class BuildManifest:
25
24
  return int(build_major)
26
25
 
27
26
  @cached_property
28
- def supported_product_types(self) -> List[str]:
27
+ def supported_product_types(self) -> list[str]:
29
28
  return self._manifest['SupportedProductTypes']
30
29
 
31
30
  @cached_property
@@ -4,7 +4,7 @@ import zipfile
4
4
  from contextlib import contextmanager
5
5
  from datetime import datetime
6
6
  from pathlib import Path
7
- from typing import List
7
+ from typing import Optional
8
8
 
9
9
  from cached_property import cached_property
10
10
  from construct import Const, Default, PaddedString, Struct
@@ -45,7 +45,7 @@ class IPSW:
45
45
  return self.read('SystemVersion.plist')
46
46
 
47
47
  @cached_property
48
- def filelist(self) -> List[zipfile.ZipInfo]:
48
+ def filelist(self) -> list[zipfile.ZipInfo]:
49
49
  return self.archive.filelist
50
50
 
51
51
  @contextmanager
@@ -105,7 +105,7 @@ class IPSW:
105
105
  def get_firmware(self, firmware_path: str) -> Firmware:
106
106
  return Firmware(firmware_path, self)
107
107
 
108
- def get_development_files(self) -> List[str]:
108
+ def get_development_files(self) -> list[str]:
109
109
  result = []
110
110
  for entry in self.archive.namelist():
111
111
  for release in ('devel', 'kasan', 'research'):
@@ -113,13 +113,13 @@ class IPSW:
113
113
  result.append(entry)
114
114
  return result
115
115
 
116
- def create_device_support(self) -> None:
116
+ def create_device_support(self, pem_db: Optional[str] = None) -> None:
117
117
  device_support_path = Path('~/Library/Developer/Xcode/iOS DeviceSupport').expanduser()
118
118
  device_support_path /= (f'{self.build_manifest.supported_product_types[0]} '
119
119
  f'{self.build_manifest.product_version} ({self.build_manifest.product_build_version})')
120
120
  build_identity = self.build_manifest.build_identities[0]
121
121
  symbols_path = device_support_path / 'Symbols'
122
- build_identity.extract_dsc(symbols_path)
122
+ build_identity.extract_dsc(symbols_path, pem_db=pem_db)
123
123
  for file in (symbols_path / 'private/preboot/Cryptexes/OS/System/Library/Caches/com.apple.dyld').iterdir():
124
124
  file.unlink()
125
125
  (device_support_path / 'Info.plist').write_bytes(plistlib.dumps({
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipsw-parser
3
- Version: 1.3.7
3
+ Version: 1.3.8
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>
@@ -685,12 +685,13 @@ Keywords: ios,cli,firmware,ipsw
685
685
  Classifier: Development Status :: 5 - Production/Stable
686
686
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
687
687
  Classifier: Programming Language :: Python :: 3
688
- Classifier: Programming Language :: Python :: 3.8
689
688
  Classifier: Programming Language :: Python :: 3.9
690
689
  Classifier: Programming Language :: Python :: 3.10
691
690
  Classifier: Programming Language :: Python :: 3.11
691
+ Classifier: Programming Language :: Python :: 3.12
692
+ Classifier: Programming Language :: Python :: 3.13
692
693
  Classifier: Programming Language :: Python :: 3 :: Only
693
- Requires-Python: >=3.8
694
+ Requires-Python: >=3.9
694
695
  Description-Content-Type: text/markdown
695
696
  License-File: LICENSE
696
697
  Requires-Dist: construct>=2.9.29
@@ -699,6 +700,7 @@ Requires-Dist: coloredlogs
699
700
  Requires-Dist: cached_property
700
701
  Requires-Dist: plumbum
701
702
  Requires-Dist: pyimg4>=0.8.6
703
+ Requires-Dist: requests
702
704
  Provides-Extra: test
703
705
  Requires-Dist: pytest; extra == "test"
704
706
 
@@ -4,6 +4,7 @@ coloredlogs
4
4
  cached_property
5
5
  plumbum
6
6
  pyimg4>=0.8.6
7
+ requests
7
8
 
8
9
  [test]
9
10
  pytest
@@ -2,7 +2,7 @@
2
2
  name = "ipsw-parser"
3
3
  description = "python3 utility for parsing and extracting data from IPSW"
4
4
  readme = "README.md"
5
- requires-python = ">=3.8"
5
+ requires-python = ">=3.9"
6
6
  license = { file = "LICENSE" }
7
7
  keywords = ["ios", "cli", "firmware", "ipsw"]
8
8
  authors = [
@@ -15,13 +15,14 @@ classifiers = [
15
15
  "Development Status :: 5 - Production/Stable",
16
16
  "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
17
17
  "Programming Language :: Python :: 3",
18
- "Programming Language :: Python :: 3.8",
19
18
  "Programming Language :: Python :: 3.9",
20
19
  "Programming Language :: Python :: 3.10",
21
20
  "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
22
23
  "Programming Language :: Python :: 3 :: Only",
23
24
  ]
24
- dynamic = ["dependencies","version"]
25
+ dynamic = ["dependencies", "version"]
25
26
 
26
27
  [project.optional-dependencies]
27
28
  test = ["pytest"]
@@ -38,7 +39,7 @@ exclude = ["docs*", "tests*"]
38
39
 
39
40
  [tool.setuptools.dynamic]
40
41
  dependencies = { file = ["requirements.txt"] }
41
- version = {attr = "ipsw_parser._version.__version__"}
42
+ version = { attr = "ipsw_parser._version.__version__" }
42
43
 
43
44
  [tool.setuptools_scm]
44
45
  version_file = "ipsw_parser/_version.py"
@@ -4,3 +4,4 @@ coloredlogs
4
4
  cached_property
5
5
  plumbum
6
6
  pyimg4>=0.8.6
7
+ requests
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes