ipsw-parser 1.8.2__tar.gz → 1.8.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.
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/PKG-INFO +2 -2
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/_version.py +3 -3
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/ipsw.py +38 -35
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser.egg-info/PKG-INFO +2 -2
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser.egg-info/requires.txt +1 -1
- ipsw_parser-1.8.3/ipsw_parser.egg-info/scm_version.json +8 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/requirements.txt +1 -1
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/tests/test_archive_backends.py +34 -1
- ipsw_parser-1.8.2/ipsw_parser.egg-info/scm_version.json +0 -8
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/.gitattributes +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/.github/workflows/codeql.yml +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/.github/workflows/python-app.yml +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/.github/workflows/python-publish.yml +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/.gitignore +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/.pre-commit-config.yaml +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/CODE_OF_CONDUCT.md +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/LICENSE +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/README.md +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/__init__.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/__main__.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/archive.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/build_identity.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/build_manifest.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/component.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/dsc.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/exceptions.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/firmware.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser/process.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser.egg-info/SOURCES.txt +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser.egg-info/dependency_links.txt +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser.egg-info/entry_points.txt +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser.egg-info/scm_file_list.json +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/ipsw_parser.egg-info/top_level.txt +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/pyproject.toml +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/pytest.ini +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/setup.cfg +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/tests/test_dsc.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/tests/test_process.py +0 -0
- {ipsw_parser-1.8.2 → ipsw_parser-1.8.3}/tests/test_sandbox_profiles.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ipsw-parser
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.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>
|
|
@@ -695,7 +695,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
695
695
|
Requires-Python: >=3.9
|
|
696
696
|
Description-Content-Type: text/markdown
|
|
697
697
|
License-File: LICENSE
|
|
698
|
-
Requires-Dist:
|
|
698
|
+
Requires-Dist: bytestruct>=0.1.0
|
|
699
699
|
Requires-Dist: coloredlogs
|
|
700
700
|
Requires-Dist: pyimg4>=0.8.8
|
|
701
701
|
Requires-Dist: requests
|
|
@@ -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.8.
|
|
22
|
-
__version_tuple__ = version_tuple = (1, 8,
|
|
21
|
+
__version__ = version = '1.8.3'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 8, 3)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'gc9b1581ba'
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from contextlib import contextmanager
|
|
3
|
+
from dataclasses import dataclass, field
|
|
3
4
|
from functools import cached_property
|
|
4
5
|
from pathlib import Path
|
|
5
|
-
from typing import Optional
|
|
6
|
+
from typing import Annotated, Optional
|
|
6
7
|
from zipfile import ZipFile
|
|
7
8
|
|
|
8
|
-
from
|
|
9
|
+
from bytestruct import BinaryStruct, Bytes, Const
|
|
9
10
|
from remotezip2 import RemoteZip
|
|
10
11
|
|
|
11
12
|
from ipsw_parser.archive import Archive, ArchiveMember, DirectoryArchive, ZipArchive
|
|
@@ -15,23 +16,39 @@ from ipsw_parser.firmware import Firmware
|
|
|
15
16
|
|
|
16
17
|
logger = logging.getLogger(__name__)
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class CpioOdcHeader(BinaryStruct):
|
|
22
|
+
"""A POSIX.1 portable ("odc") cpio header: every field is zero-padded octal ASCII."""
|
|
23
|
+
|
|
24
|
+
c_magic: Annotated[bytes, Bytes(6), Const(b"070707")] = field(default=b"070707", init=False)
|
|
25
|
+
c_dev: Annotated[bytes, Bytes(6)]
|
|
26
|
+
c_ino: Annotated[bytes, Bytes(6)]
|
|
27
|
+
c_mode: Annotated[bytes, Bytes(6)]
|
|
28
|
+
c_uid: Annotated[bytes, Bytes(6)]
|
|
29
|
+
c_gid: Annotated[bytes, Bytes(6)]
|
|
30
|
+
c_nlink: Annotated[bytes, Bytes(6)]
|
|
31
|
+
c_rdev: Annotated[bytes, Bytes(6)]
|
|
32
|
+
c_mtime: Annotated[bytes, Bytes(11)]
|
|
33
|
+
c_namesize: Annotated[bytes, Bytes(6)]
|
|
34
|
+
c_filesize: Annotated[bytes, Bytes(11)]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _build_cpio_odc_header(ino: int, mode: int, nlink: int, namesize: int, filesize: int = 0) -> bytes:
|
|
38
|
+
"""Build an odc cpio header; device, owner, rdev and mtime are always zero."""
|
|
39
|
+
zero6 = b"0" * 6
|
|
40
|
+
return CpioOdcHeader(
|
|
41
|
+
c_dev=zero6,
|
|
42
|
+
c_ino=f"{ino:06o}".encode(),
|
|
43
|
+
c_mode=f"{mode:06o}".encode(),
|
|
44
|
+
c_uid=zero6,
|
|
45
|
+
c_gid=zero6,
|
|
46
|
+
c_nlink=f"{nlink:06o}".encode(),
|
|
47
|
+
c_rdev=zero6,
|
|
48
|
+
c_mtime=b"0" * 11,
|
|
49
|
+
c_namesize=f"{namesize:06o}".encode(),
|
|
50
|
+
c_filesize=f"{filesize:011o}".encode(),
|
|
51
|
+
).build()
|
|
35
52
|
|
|
36
53
|
|
|
37
54
|
class IPSW:
|
|
@@ -105,13 +122,7 @@ class IPSW:
|
|
|
105
122
|
filename = subpath
|
|
106
123
|
filename = f"{filename}\0".encode()
|
|
107
124
|
mode = e.external_attr >> 16
|
|
108
|
-
result +=
|
|
109
|
-
"c_ino": f"{inode:06o}",
|
|
110
|
-
"c_nlink": f"{nlink:06o}",
|
|
111
|
-
"c_mode": f"{mode:06o}",
|
|
112
|
-
"c_namesize": f"{len(filename):06o}",
|
|
113
|
-
"c_filesize": f"{e.file_size:011o}",
|
|
114
|
-
})
|
|
125
|
+
result += _build_cpio_odc_header(inode, mode, nlink, len(filename), e.file_size)
|
|
115
126
|
inode += 1
|
|
116
127
|
result += filename
|
|
117
128
|
if not e.file_size:
|
|
@@ -123,15 +134,7 @@ class IPSW:
|
|
|
123
134
|
filename = b"TRAILER!!!\0"
|
|
124
135
|
inode = 0
|
|
125
136
|
mode = 0
|
|
126
|
-
result += (
|
|
127
|
-
cpio_odc_header.build({
|
|
128
|
-
"c_ino": f"{inode:06o}",
|
|
129
|
-
"c_mode": f"{mode:06o}",
|
|
130
|
-
"c_nlink": f"{nlink:06o}",
|
|
131
|
-
"c_namesize": f"{len(filename):06o}",
|
|
132
|
-
})
|
|
133
|
-
+ filename
|
|
134
|
-
)
|
|
137
|
+
result += _build_cpio_odc_header(inode, mode, nlink, len(filename)) + filename
|
|
135
138
|
return result
|
|
136
139
|
|
|
137
140
|
def read(self, path: str) -> bytes:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ipsw-parser
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.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>
|
|
@@ -695,7 +695,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
695
695
|
Requires-Python: >=3.9
|
|
696
696
|
Description-Content-Type: text/markdown
|
|
697
697
|
License-File: LICENSE
|
|
698
|
-
Requires-Dist:
|
|
698
|
+
Requires-Dist: bytestruct>=0.1.0
|
|
699
699
|
Requires-Dist: coloredlogs
|
|
700
700
|
Requires-Dist: pyimg4>=0.8.8
|
|
701
701
|
Requires-Dist: requests
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import plistlib
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from zipfile import ZipFile
|
|
3
|
+
from zipfile import ZipFile, ZipInfo
|
|
4
4
|
|
|
5
5
|
from ipsw_parser.archive import DirectoryArchive, ZipArchive
|
|
6
6
|
from ipsw_parser.ipsw import IPSW
|
|
@@ -68,3 +68,36 @@ def test_directory_extractall_copies_requested_members(tmp_path: Path) -> None:
|
|
|
68
68
|
|
|
69
69
|
assert (output / "Firmware" / "devel-file.bin").read_bytes() == b"dev"
|
|
70
70
|
assert not (output / "Release" / "normal-file.bin").exists()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _cpio_header(ino: int, mode: int, namesize: int, filesize: int) -> bytes:
|
|
74
|
+
return f"070707000000{ino:06o}{mode:06o}000000000000000001000000{0:011o}{namesize:06o}{filesize:011o}".encode()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_bootability_builds_odc_cpio_archive(tmp_path: Path) -> None:
|
|
78
|
+
archive_path = tmp_path / "sample.ipsw"
|
|
79
|
+
with ZipFile(archive_path, "w") as archive:
|
|
80
|
+
archive.writestr("BuildManifest.plist", _build_manifest())
|
|
81
|
+
for name, mode, data in (
|
|
82
|
+
("BootabilityBundle/Restore/Bootability/payload.bin", 0o100644, b"hello"),
|
|
83
|
+
("BootabilityBundle/Restore/Bootability/empty", 0o100600, b""),
|
|
84
|
+
("BootabilityBundle/Restore/Firmware/Bootability.dmg.trustcache", 0o100644, b"trust"),
|
|
85
|
+
("Firmware/unrelated.bin", 0o100644, b"ignored"),
|
|
86
|
+
):
|
|
87
|
+
info = ZipInfo(name)
|
|
88
|
+
info.external_attr = mode << 16
|
|
89
|
+
archive.writestr(info, data)
|
|
90
|
+
|
|
91
|
+
with ZipFile(archive_path) as archive:
|
|
92
|
+
bootability = IPSW(ZipArchive(archive)).bootability
|
|
93
|
+
|
|
94
|
+
assert bootability == (
|
|
95
|
+
_cpio_header(1, 0o100644, 12, 5)
|
|
96
|
+
+ b"payload.bin\0hello"
|
|
97
|
+
+ _cpio_header(2, 0o100600, 6, 0)
|
|
98
|
+
+ b"empty\0"
|
|
99
|
+
+ _cpio_header(3, 0o100644, 23, 5)
|
|
100
|
+
+ b"Bootability.trustcache\0trust"
|
|
101
|
+
+ _cpio_header(0, 0, 11, 0)
|
|
102
|
+
+ b"TRAILER!!!\0"
|
|
103
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|