ipsw-parser 1.7.3__tar.gz → 1.8.0__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 (39) hide show
  1. ipsw_parser-1.8.0/.github/workflows/python-publish.yml +38 -0
  2. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/PKG-INFO +1 -2
  3. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/_version.py +3 -3
  4. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/build_identity.py +9 -12
  5. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/dsc.py +2 -3
  6. ipsw_parser-1.8.0/ipsw_parser/process.py +31 -0
  7. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser.egg-info/PKG-INFO +1 -2
  8. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser.egg-info/SOURCES.txt +5 -1
  9. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser.egg-info/requires.txt +0 -1
  10. ipsw_parser-1.8.0/ipsw_parser.egg-info/scm_file_list.json +31 -0
  11. ipsw_parser-1.8.0/ipsw_parser.egg-info/scm_version.json +8 -0
  12. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/requirements.txt +0 -1
  13. ipsw_parser-1.8.0/tests/test_process.py +40 -0
  14. ipsw_parser-1.7.3/.github/workflows/python-publish.yml +0 -31
  15. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/.gitattributes +0 -0
  16. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  17. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  18. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/.github/workflows/codeql.yml +0 -0
  19. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/.github/workflows/python-app.yml +0 -0
  20. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/.gitignore +0 -0
  21. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/.pre-commit-config.yaml +0 -0
  22. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/CODE_OF_CONDUCT.md +0 -0
  23. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/LICENSE +0 -0
  24. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/README.md +0 -0
  25. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/__init__.py +0 -0
  26. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/__main__.py +0 -0
  27. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/archive.py +0 -0
  28. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/build_manifest.py +0 -0
  29. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/component.py +0 -0
  30. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/exceptions.py +0 -0
  31. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/firmware.py +0 -0
  32. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser/ipsw.py +0 -0
  33. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser.egg-info/dependency_links.txt +0 -0
  34. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser.egg-info/entry_points.txt +0 -0
  35. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/ipsw_parser.egg-info/top_level.txt +0 -0
  36. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/pyproject.toml +0 -0
  37. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/pytest.ini +0 -0
  38. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/setup.cfg +0 -0
  39. {ipsw_parser-1.7.3 → ipsw_parser-1.8.0}/tests/test_archive_backends.py +0 -0
@@ -0,0 +1,38 @@
1
+ # This workflow uploads a Python Package to PyPI using Trusted Publishing (OIDC).
2
+ # No API tokens or passwords are stored: PyPI verifies the workflow's identity.
3
+ # See: https://docs.pypi.org/trusted-publishers/
4
+
5
+ name: Upload Python Package
6
+
7
+ on:
8
+ release:
9
+ types: [created]
10
+
11
+ jobs:
12
+ deploy:
13
+
14
+ runs-on: ubuntu-latest
15
+
16
+ environment:
17
+ name: pypi
18
+ url: https://pypi.org/p/ipsw_parser
19
+
20
+ permissions:
21
+ id-token: write # required for Trusted Publishing (OIDC)
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0 # full history + tags so setuptools_scm can derive the version
27
+ - name: Set up Python
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: '3.x'
31
+ - name: Install dependencies
32
+ run: |
33
+ python -m pip install --upgrade pip
34
+ pip install build
35
+ - name: Build
36
+ run: python -m build
37
+ - name: Publish package distributions to PyPI
38
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipsw-parser
3
- Version: 1.7.3
3
+ Version: 1.8.0
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>
@@ -697,7 +697,6 @@ Description-Content-Type: text/markdown
697
697
  License-File: LICENSE
698
698
  Requires-Dist: construct>=2.9.29
699
699
  Requires-Dist: coloredlogs
700
- Requires-Dist: plumbum
701
700
  Requires-Dist: pyimg4>=0.8.8
702
701
  Requires-Dist: requests
703
702
  Requires-Dist: remotezip2
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.7.3'
22
- __version_tuple__ = version_tuple = (1, 7, 3)
21
+ __version__ = version = '1.8.0'
22
+ __version_tuple__ = version_tuple = (1, 8, 0)
23
23
 
24
- __commit_id__ = commit_id = 'g8dd49a707'
24
+ __commit_id__ = commit_id = 'gfea62ccb1'
@@ -9,12 +9,12 @@ from tempfile import TemporaryDirectory
9
9
  from typing import Optional
10
10
 
11
11
  import requests
12
- from plumbum import ProcessExecutionError, local
13
12
  from pyimg4 import IM4P
14
13
 
15
14
  from ipsw_parser.archive import Archive
16
15
  from ipsw_parser.component import Component
17
16
  from ipsw_parser.dsc import split_dsc
17
+ from ipsw_parser.process import ProcessExecutionError, run
18
18
 
19
19
  logger = logging.getLogger(__name__)
20
20
 
@@ -29,8 +29,6 @@ def extract_as(archive: Archive, member_name, output_path, chunk_size=64 * 1024)
29
29
 
30
30
 
31
31
  def _extract_dmg(dmg: Path, output: Path, sub_path: Optional[Path] = None, pem_db: Optional[str] = None) -> None:
32
- ipsw = local["ipsw"]
33
- hdiutil = local["hdiutil"]
34
32
  # darwin system statistically have problems cleaning up after detaching the mountpoint
35
33
  with TemporaryDirectory() as temp_dir:
36
34
  temp_dir = Path(temp_dir)
@@ -52,9 +50,9 @@ def _extract_dmg(dmg: Path, output: Path, sub_path: Optional[Path] = None, pem_d
52
50
  temp_pem_db.write_text(requests.get(pem_db, verify=False).text)
53
51
  pem_db = temp_pem_db
54
52
  args += ["--pem-db", pem_db]
55
- ipsw(args)
53
+ run("ipsw", *args)
56
54
 
57
- hdiutil("attach", "-mountpoint", mnt, dmg)
55
+ run("hdiutil", "attach", "-mountpoint", mnt, dmg)
58
56
 
59
57
  try:
60
58
  src = mnt if sub_path is None else mnt / sub_path
@@ -63,17 +61,16 @@ def _extract_dmg(dmg: Path, output: Path, sub_path: Optional[Path] = None, pem_d
63
61
  # when overwriting the same files, some of them don't contain write permissions
64
62
  pass
65
63
 
66
- hdiutil("detach", "-force", mnt)
64
+ run("hdiutil", "detach", "-force", mnt)
67
65
 
68
66
 
69
67
  def _decode_sandbox_profiles(kernel_output: Path, output: Path, profile_type: Optional[str] = None) -> None:
70
- ipsw = local["ipsw"]
71
68
  args = ["sb", "list", kernel_output]
72
69
  if profile_type is not None:
73
70
  args += ["--type", profile_type]
74
71
 
75
72
  output.mkdir(exist_ok=True, parents=True)
76
- profile_names = ipsw(*args).splitlines()
73
+ profile_names = run("ipsw", *args).splitlines()
77
74
 
78
75
  def decode_worker(profile_name: str) -> None:
79
76
  profile_path = (output / profile_name).with_suffix(".sb")
@@ -81,7 +78,7 @@ def _decode_sandbox_profiles(kernel_output: Path, output: Path, profile_type: Op
81
78
  if profile_type is not None:
82
79
  decode_args += ["--type", profile_type]
83
80
  try:
84
- profile = ipsw(*decode_args)
81
+ profile = run("ipsw", *decode_args)
85
82
  except ProcessExecutionError as e:
86
83
  logger.warning(f"failed to decode sandbox profile {profile_name}: {e}")
87
84
  return
@@ -111,7 +108,7 @@ def _extract_kernelcache(build_identity: "BuildIdentity", output: Path) -> Path:
111
108
  kernel_output.write_bytes(im4p.payload.output().data)
112
109
  try:
113
110
  # In case the kernel is a FAT image, extract the arm64 macho
114
- local["ipsw"]("macho", "lipo", "-a", "arm64", kernel_output)
111
+ run("ipsw", "macho", "lipo", "-a", "arm64", kernel_output)
115
112
  next(iter(kernel_output.parent.glob("*.arm64"))).rename(kernel_output)
116
113
  except ProcessExecutionError:
117
114
  pass
@@ -196,7 +193,7 @@ class BuildIdentity(UserDict):
196
193
 
197
194
  with TemporaryDirectory() as temp_dir:
198
195
  kernel_output = Path(temp_dir) / "kernel"
199
- local["ipsw"]("macho", "lipo", "-a", arch, kernel_output)
196
+ run("ipsw", "macho", "lipo", "-a", arch, kernel_output)
200
197
  return Path(next(kernel_output.parent.glob(f"*.{arch}"))).read_bytes()
201
198
 
202
199
  def extract_sandbox_profiles(self, output: Path) -> None:
@@ -229,7 +226,7 @@ class BuildIdentity(UserDict):
229
226
  logger.error("Failed to extract sandbox profiles: %s", e)
230
227
  try:
231
228
  _decode_sandbox_profiles(kernel_output, sandbox_profiles / "protobox", profile_type="protobox")
232
- except (ProcessExecutionError, FileNotFoundError) as e:
229
+ except (ProcessExecutionError, FileNotFoundError, OSError) as e:
233
230
  logger.error("Failed to extract sandbox profiles: %s", e)
234
231
 
235
232
  for cryptex in ("App", "OS"):
@@ -3,14 +3,13 @@ import plistlib
3
3
  from datetime import datetime
4
4
  from pathlib import Path
5
5
 
6
- from plumbum import local
6
+ from ipsw_parser.process import run
7
7
 
8
8
  logger = logging.getLogger(__name__)
9
9
 
10
10
 
11
11
  def split_dsc(root: Path) -> None:
12
12
  """Split dyld shared caches found under ``root`` using ``ipsw dyld split``."""
13
- ipsw = local["ipsw"]
14
13
  dsc_paths = [
15
14
  root / "System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64",
16
15
  root / "System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64e",
@@ -23,7 +22,7 @@ def split_dsc(root: Path) -> None:
23
22
  continue
24
23
 
25
24
  logger.info(f"splitting DSC: {dsc}")
26
- ipsw("dyld", "split", dsc, "-o", root)
25
+ run("ipsw", "dyld", "split", dsc, "-o", root)
27
26
 
28
27
 
29
28
  def get_device_support_path(product_type: str, product_version: str, product_build_version: str) -> Path:
@@ -0,0 +1,31 @@
1
+ import os
2
+ import subprocess
3
+ from typing import Union
4
+
5
+
6
+ class ProcessExecutionError(OSError):
7
+ """An external tool exited with a non-zero status."""
8
+
9
+ def __init__(self, argv: list[str], returncode: int, stdout: str, stderr: str) -> None:
10
+ self.argv = argv
11
+ self.returncode = returncode
12
+ self.stdout = stdout
13
+ self.stderr = stderr
14
+ message = f"Unexpected exit code: {returncode}\nCommand line: {' '.join(argv)}"
15
+ for name, output in (("Stdout", stdout), ("Stderr", stderr)):
16
+ if output.strip():
17
+ message += f"\n{name}: {output.strip()}"
18
+ super().__init__(message)
19
+
20
+
21
+ def run(tool: str, *args: Union[str, "os.PathLike[str]"]) -> str:
22
+ """Run an external tool to completion and return what it printed to stdout.
23
+
24
+ :raises FileNotFoundError: if the tool is not installed.
25
+ :raises ProcessExecutionError: if it exits with a non-zero status.
26
+ """
27
+ argv = [tool, *(os.fspath(arg) for arg in args)]
28
+ result = subprocess.run(argv, capture_output=True, text=True, errors="replace")
29
+ if result.returncode != 0:
30
+ raise ProcessExecutionError(argv, result.returncode, result.stdout, result.stderr)
31
+ return result.stdout
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipsw-parser
3
- Version: 1.7.3
3
+ Version: 1.8.0
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>
@@ -697,7 +697,6 @@ Description-Content-Type: text/markdown
697
697
  License-File: LICENSE
698
698
  Requires-Dist: construct>=2.9.29
699
699
  Requires-Dist: coloredlogs
700
- Requires-Dist: plumbum
701
700
  Requires-Dist: pyimg4>=0.8.8
702
701
  Requires-Dist: requests
703
702
  Requires-Dist: remotezip2
@@ -23,10 +23,14 @@ ipsw_parser/dsc.py
23
23
  ipsw_parser/exceptions.py
24
24
  ipsw_parser/firmware.py
25
25
  ipsw_parser/ipsw.py
26
+ ipsw_parser/process.py
26
27
  ipsw_parser.egg-info/PKG-INFO
27
28
  ipsw_parser.egg-info/SOURCES.txt
28
29
  ipsw_parser.egg-info/dependency_links.txt
29
30
  ipsw_parser.egg-info/entry_points.txt
30
31
  ipsw_parser.egg-info/requires.txt
32
+ ipsw_parser.egg-info/scm_file_list.json
33
+ ipsw_parser.egg-info/scm_version.json
31
34
  ipsw_parser.egg-info/top_level.txt
32
- tests/test_archive_backends.py
35
+ tests/test_archive_backends.py
36
+ tests/test_process.py
@@ -1,6 +1,5 @@
1
1
  construct>=2.9.29
2
2
  coloredlogs
3
- plumbum
4
3
  pyimg4>=0.8.8
5
4
  requests
6
5
  remotezip2
@@ -0,0 +1,31 @@
1
+ {
2
+ "files": [
3
+ ".gitattributes",
4
+ ".github/ISSUE_TEMPLATE/bug_report.md",
5
+ ".github/ISSUE_TEMPLATE/feature_request.md",
6
+ ".github/workflows/codeql.yml",
7
+ ".github/workflows/python-app.yml",
8
+ ".github/workflows/python-publish.yml",
9
+ ".gitignore",
10
+ ".pre-commit-config.yaml",
11
+ "CODE_OF_CONDUCT.md",
12
+ "LICENSE",
13
+ "README.md",
14
+ "ipsw_parser/__init__.py",
15
+ "ipsw_parser/__main__.py",
16
+ "ipsw_parser/archive.py",
17
+ "ipsw_parser/build_identity.py",
18
+ "ipsw_parser/build_manifest.py",
19
+ "ipsw_parser/component.py",
20
+ "ipsw_parser/dsc.py",
21
+ "ipsw_parser/exceptions.py",
22
+ "ipsw_parser/firmware.py",
23
+ "ipsw_parser/ipsw.py",
24
+ "ipsw_parser/process.py",
25
+ "pyproject.toml",
26
+ "pytest.ini",
27
+ "requirements.txt",
28
+ "tests/test_archive_backends.py",
29
+ "tests/test_process.py"
30
+ ]
31
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.8.0",
3
+ "distance": 0,
4
+ "node": "gfea62ccb12a1c3ea2004c6aae209a5fc767bc3ef",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-10-11"
8
+ }
@@ -1,6 +1,5 @@
1
1
  construct>=2.9.29
2
2
  coloredlogs
3
- plumbum
4
3
  pyimg4>=0.8.8
5
4
  requests
6
5
  remotezip2
@@ -0,0 +1,40 @@
1
+ import sys
2
+ from pathlib import Path
3
+
4
+ import pytest
5
+
6
+ from ipsw_parser.process import ProcessExecutionError, run
7
+
8
+
9
+ def test_run_returns_stdout() -> None:
10
+ assert run(sys.executable, "-c", "import sys; print('out'); print('err', file=sys.stderr)").splitlines() == ["out"]
11
+
12
+
13
+ def test_run_accepts_path_arguments(tmp_path: Path) -> None:
14
+ script = tmp_path / "script with space.py"
15
+ script.write_text("import sys; print(sys.argv[1])")
16
+
17
+ assert run(sys.executable, script, tmp_path).strip() == str(tmp_path)
18
+
19
+
20
+ def test_run_reports_a_failing_tool_with_its_output() -> None:
21
+ with pytest.raises(ProcessExecutionError) as excinfo:
22
+ run(sys.executable, "-c", "import sys; print('partial'); print('the reason', file=sys.stderr); sys.exit(3)")
23
+
24
+ error = excinfo.value
25
+ assert error.returncode == 3
26
+ assert error.stdout.strip() == "partial"
27
+ assert error.stderr.strip() == "the reason"
28
+ assert "Unexpected exit code: 3" in str(error)
29
+ assert "the reason" in str(error)
30
+
31
+
32
+ def test_a_failing_tool_is_an_oserror() -> None:
33
+ # Callers that guard an extraction with `except OSError` keep catching a failed tool
34
+ with pytest.raises(OSError):
35
+ run(sys.executable, "-c", "raise SystemExit(1)")
36
+
37
+
38
+ def test_run_of_a_missing_tool_raises_file_not_found() -> None:
39
+ with pytest.raises(FileNotFoundError):
40
+ run("ipsw-parser-no-such-tool")
@@ -1,31 +0,0 @@
1
- # This workflows will upload a Python Package using Twine when a release is created
2
- # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3
-
4
- name: Upload Python Package
5
-
6
- on:
7
- release:
8
- types: [created]
9
-
10
- jobs:
11
- deploy:
12
-
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - uses: actions/checkout@v4
17
- - name: Set up Python
18
- uses: actions/setup-python@v4
19
- with:
20
- python-version: '3.x'
21
- - name: Install dependencies
22
- run: |
23
- python -m pip install --upgrade pip
24
- pip install build setuptools wheel twine
25
- - name: Build and publish
26
- env:
27
- TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28
- TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29
- run: |
30
- python -m build
31
- twine upload dist/*
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes