sceutils 0.1.0__py3-none-any.whl
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.
- sceutils/__init__.py +57 -0
- sceutils/__main__.py +57 -0
- sceutils/axfs.py +308 -0
- sceutils/decrypt_cpupdate.py +136 -0
- sceutils/emmc_extract.py +231 -0
- sceutils/extract_idstorage.py +27 -0
- sceutils/find_imported_by.py +35 -0
- sceutils/keys.py +57 -0
- sceutils/keys_external.py +333 -0
- sceutils/keys_internal.py +121 -0
- sceutils/keys_proto.py +137 -0
- sceutils/module_info.py +138 -0
- sceutils/pup_fiction.py +379 -0
- sceutils/pup_info.py +100 -0
- sceutils/scedecrypt.py +52 -0
- sceutils/scetypes.py +692 -0
- sceutils/sceutils.py +94 -0
- sceutils/self2elf.py +242 -0
- sceutils/selfinfo.py +249 -0
- sceutils/ud0_extract_pup.py +42 -0
- sceutils/unpack_bootimage_new.py +19 -0
- sceutils/util.py +72 -0
- sceutils-0.1.0.dist-info/METADATA +106 -0
- sceutils-0.1.0.dist-info/RECORD +31 -0
- sceutils-0.1.0.dist-info/WHEEL +5 -0
- sceutils-0.1.0.dist-info/entry_points.txt +3 -0
- sceutils-0.1.0.dist-info/licenses/LICENSE +21 -0
- sceutils-0.1.0.dist-info/top_level.txt +2 -0
- unarzl/__init__.py +25 -0
- unarzl/__main__.py +29 -0
- unarzl/arzl.py +497 -0
sceutils/util.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import struct
|
|
3
|
+
import sys
|
|
4
|
+
from importlib import import_module
|
|
5
|
+
from typing import Literal
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _make_unpacker(fmt):
|
|
9
|
+
size = struct.calcsize(fmt)
|
|
10
|
+
unpacker = struct.Struct(fmt)
|
|
11
|
+
|
|
12
|
+
def f(data, off=0):
|
|
13
|
+
return unpacker.unpack(data[off:off + size])[0]
|
|
14
|
+
return f
|
|
15
|
+
|
|
16
|
+
u8 = _make_unpacker("<B")
|
|
17
|
+
u16 = _make_unpacker("<H")
|
|
18
|
+
u32 = _make_unpacker("<I")
|
|
19
|
+
u64 = _make_unpacker("<Q")
|
|
20
|
+
|
|
21
|
+
u8b = _make_unpacker(">B")
|
|
22
|
+
u16b = _make_unpacker(">H")
|
|
23
|
+
u32b = _make_unpacker(">I")
|
|
24
|
+
u64b = _make_unpacker(">Q")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def c_str(data):
|
|
28
|
+
return data[:data.find(b"\x00")].decode("utf8")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
FSTYPE = [
|
|
33
|
+
"unknown0",
|
|
34
|
+
"os0",
|
|
35
|
+
"unknown2",
|
|
36
|
+
"unknown3",
|
|
37
|
+
"vs0_chmod",
|
|
38
|
+
"unknown5",
|
|
39
|
+
"unknown6",
|
|
40
|
+
"unknown7",
|
|
41
|
+
"pervasive8",
|
|
42
|
+
"boot_slb2",
|
|
43
|
+
"vs0",
|
|
44
|
+
"devkit_cp",
|
|
45
|
+
"motionC",
|
|
46
|
+
"bbmc",
|
|
47
|
+
"unknownE",
|
|
48
|
+
"motionF",
|
|
49
|
+
"touch10",
|
|
50
|
+
"touch11",
|
|
51
|
+
"syscon12",
|
|
52
|
+
"syscon13",
|
|
53
|
+
"pervasive14",
|
|
54
|
+
"unknown15",
|
|
55
|
+
"vs0_tarpatch",
|
|
56
|
+
"sa0",
|
|
57
|
+
"pd0",
|
|
58
|
+
"pervasive19",
|
|
59
|
+
"unknown1A",
|
|
60
|
+
"psp_emulist",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
def make_filename(hdr, filetype, typecount):
|
|
64
|
+
magic, version, flags, moffs, metaoffs = struct.unpack("<IIIIQ", hdr[0:24])
|
|
65
|
+
if magic == 0x454353 and version == 3 and flags == 0x30040:
|
|
66
|
+
meta = hdr[metaoffs:]
|
|
67
|
+
t = u8(meta, 4)
|
|
68
|
+
if t < 0x1C:
|
|
69
|
+
name = f"{FSTYPE[t]}-{typecount[t]:02}.pkg"
|
|
70
|
+
typecount[t] += 1
|
|
71
|
+
return name
|
|
72
|
+
return f"unknown-0x{filetype:x}.pkg"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sceutils
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Utilities for PlayStation Vita SCE files
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: pycryptodomex>=3.23.0
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
sceutils
|
|
12
|
+
========
|
|
13
|
+
|
|
14
|
+
Utilities for working with PlayStation Vita SCE / SELF / PUP files.
|
|
15
|
+
|
|
16
|
+
Requirements
|
|
17
|
+
------------
|
|
18
|
+
|
|
19
|
+
* Python 3.11+
|
|
20
|
+
* pycryptodomex
|
|
21
|
+
|
|
22
|
+
Installation
|
|
23
|
+
------------
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
pip install .
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Usage
|
|
30
|
+
-----
|
|
31
|
+
|
|
32
|
+
### As a command line tool
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
sceutils --help
|
|
36
|
+
sceutils selfinfo file.self
|
|
37
|
+
sceutils self2elf -i eboot.bin -o eboot.elf -K keys_external.py
|
|
38
|
+
sceutils pup_fiction PSP2UPDATE.pup output keys_external.py
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The ARZL helper is also available directly:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
unarzl kernel_boot_loader.self.seg03 nsbl.bin
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### As a library
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from sceutils import self2elf, read_self_info, scedecrypt, unarzl, keys
|
|
51
|
+
|
|
52
|
+
keys.use_keys("keys_external.py")
|
|
53
|
+
|
|
54
|
+
with open("eboot.bin", "rb") as inf, open("eboot.elf", "wb") as outf:
|
|
55
|
+
self2elf(inf, outf)
|
|
56
|
+
|
|
57
|
+
with open("eboot.bin", "rb") as inf:
|
|
58
|
+
info = read_self_info(inf)
|
|
59
|
+
|
|
60
|
+
with open("kernel_boot_loader.self.seg03", "rb") as f:
|
|
61
|
+
nsbl = unarzl(f.read())
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Modules
|
|
65
|
+
-------
|
|
66
|
+
|
|
67
|
+
pup_fiction
|
|
68
|
+
-----------
|
|
69
|
+
### usage:
|
|
70
|
+
* `sceutils pup_fiction PUP_filename output_folder keys_file`
|
|
71
|
+
|
|
72
|
+
### examples:
|
|
73
|
+
* `sceutils pup_fiction PSP2UPDATE.pup 368 keys_external.py`
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
self2elf
|
|
78
|
+
--------
|
|
79
|
+
### usage:
|
|
80
|
+
* `sceutils self2elf -i [input self] -o [output elf] -k [RIF file] [-K keys_external.py]`
|
|
81
|
+
* `sceutils self2elf -i [input self] -o [output elf] -z [zRIF]`
|
|
82
|
+
|
|
83
|
+
### examples:
|
|
84
|
+
* `sceutils self2elf -i eboot.bin -o eboot.elf -z [zRIF here] [-K keys_external.py]`
|
|
85
|
+
* `sceutils self2elf -i eboot.bin -o eboot.elf -k [RIF] [-K keys_external.py]`
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
selfinfo
|
|
90
|
+
--------
|
|
91
|
+
### usage:
|
|
92
|
+
* `sceutils selfinfo [input self] [-K keys_external.py]`
|
|
93
|
+
|
|
94
|
+
Prints the SCE header, SELF header, app info, control info, ELF headers,
|
|
95
|
+
segment metadata and (when possible) module imports/exports.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
axfs
|
|
100
|
+
----
|
|
101
|
+
### usage:
|
|
102
|
+
* `sceutils axfs [list|tar] image_name [output_name]`
|
|
103
|
+
|
|
104
|
+
### examples:
|
|
105
|
+
* `sceutils axfs list fsimage.img`
|
|
106
|
+
* `sceutils axfs tar fsimage.img [fsimage.tar]`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
sceutils/__init__.py,sha256=95tgh27PQQKCx52_etSIBj3EUNPoOQ7BmFISrGWVMFw,1181
|
|
2
|
+
sceutils/__main__.py,sha256=453MYrq9Lz13S9ykpvmX7TQIbJ7KurkXmcxzF5YVo9Q,1297
|
|
3
|
+
sceutils/axfs.py,sha256=DO8lv6eJgMlClKDCLw7IhmKZ_oplmF85FrWA_G0SxNk,11529
|
|
4
|
+
sceutils/decrypt_cpupdate.py,sha256=foXCVfgmIaqDzGkc-EdaEQ3YLrjmwO9Zv239levWt_s,5389
|
|
5
|
+
sceutils/emmc_extract.py,sha256=IDLuMRgfJF6qACCok3NyZLqIciCxtRPhopx1PdKd6Gg,6853
|
|
6
|
+
sceutils/extract_idstorage.py,sha256=r779X0luAZFieUZc9FxQKqTaXU9EN3PKQZfHysvLiOU,653
|
|
7
|
+
sceutils/find_imported_by.py,sha256=uuDUrmTF2E5doeNo_e-yXmh3XEK-juIzVcbTqI8YxWk,1054
|
|
8
|
+
sceutils/keys.py,sha256=fjgZMibj8XI5gKT_s3Fl-lRhLk5HbFafQVezXZF0V7I,1978
|
|
9
|
+
sceutils/keys_external.py,sha256=PZVYfzcD2RrchQX8KmnxfyDIUTsboyYiX8uOBMJMhXc,7869
|
|
10
|
+
sceutils/keys_internal.py,sha256=UhfPrXJCIMqclNlDCuQfEUuscqKQk_lt7gMP3jpVVMU,2898
|
|
11
|
+
sceutils/keys_proto.py,sha256=0Igh2q5oDiFHpjuQLh4K16rXaSfLyZ8SzJ0orFPY_UI,3417
|
|
12
|
+
sceutils/module_info.py,sha256=HLl2EJ-qwp6HrfG1VLtN-hrfkYKMP7zU-HfZ7WbfXkw,5009
|
|
13
|
+
sceutils/pup_fiction.py,sha256=60AqdDOKfdmrRbsjSC-xdBNm0BgTtNXyCZPGvPj7viA,12722
|
|
14
|
+
sceutils/pup_info.py,sha256=UtEKrtMDY_JllFMW0EJKVqo_ISVx9hN5Jaz5TYcs5u0,2480
|
|
15
|
+
sceutils/scedecrypt.py,sha256=1YlSRIWYWefgvmNZD-mxf9hXwZHq_qCvbbqqVtTBnYo,1715
|
|
16
|
+
sceutils/scetypes.py,sha256=48g7_p7G8RrD72XrW-Evz7zxj1x0g3E_jKqShrj07Aw,18157
|
|
17
|
+
sceutils/sceutils.py,sha256=d4omfaoaNjuK0QZXeoJbgf7slvFMoG8TsXqYL9gkkXA,4065
|
|
18
|
+
sceutils/self2elf.py,sha256=9ivS3Bkbrh5NqR1grB2HQknKy6aocUF1wXqpC2ocLzQ,7914
|
|
19
|
+
sceutils/selfinfo.py,sha256=9XDC0ja-ScbkfzmKenVl4QNhIoYUp_649K5NXp-8GPU,7854
|
|
20
|
+
sceutils/ud0_extract_pup.py,sha256=fMVTL73qDx6JSdXqLxDB3Z7X3YVihXwLoAYPuiaXdao,1220
|
|
21
|
+
sceutils/unpack_bootimage_new.py,sha256=X1yfffCQAdthHThOjuLZVYhR1dtrWM5t0W6QEPKET5o,373
|
|
22
|
+
sceutils/util.py,sha256=7GI3j9UKa2GavIoPp1LznwhXANKak5z_jIX6D9N_lIM,1448
|
|
23
|
+
sceutils-0.1.0.dist-info/licenses/LICENSE,sha256=zDwoivyULWWhRP9c0twkTtTpUhUvMDJgQsvmu83NsDs,1075
|
|
24
|
+
unarzl/__init__.py,sha256=lWihepfw_je_4tibtsap74kAp19_7vYcEx9d2QY2RRc,463
|
|
25
|
+
unarzl/__main__.py,sha256=Pbw4NmAc5D_iP2CJsA7HUZLyyJtozpmGjrdGZUQ1UR4,714
|
|
26
|
+
unarzl/arzl.py,sha256=tui-eEYXBSendN3wnv6VG2FeuEI5UE3epOjcLLUY0sk,16442
|
|
27
|
+
sceutils-0.1.0.dist-info/METADATA,sha256=smejdfJF3VDoI2zQOS2j1scvCewEdv1TR9OyBG4DdSk,2121
|
|
28
|
+
sceutils-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
29
|
+
sceutils-0.1.0.dist-info/entry_points.txt,sha256=sjA2HX7g5F7ELj7mWToESNPQtFw4QbKuU6_eEcuYHw4,82
|
|
30
|
+
sceutils-0.1.0.dist-info/top_level.txt,sha256=uM7-OJkk3iJ2iiyUXmo-RgmfiDPYmJK7lkS9fWCOCy4,16
|
|
31
|
+
sceutils-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 molecule
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
unarzl/__init__.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from .arzl import (
|
|
2
|
+
ARZL_MAGIC,
|
|
3
|
+
ArlzBufferOverflowError,
|
|
4
|
+
ArlzError,
|
|
5
|
+
ArlzInvalidDataError,
|
|
6
|
+
arzl_arm_filter,
|
|
7
|
+
arzl_decode,
|
|
8
|
+
arzl_decompress,
|
|
9
|
+
sce_arlz_arm_filter,
|
|
10
|
+
sce_arlz_decode,
|
|
11
|
+
unarzl,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"ARZL_MAGIC",
|
|
16
|
+
"ArlzError",
|
|
17
|
+
"ArlzInvalidDataError",
|
|
18
|
+
"ArlzBufferOverflowError",
|
|
19
|
+
"arzl_decode",
|
|
20
|
+
"arzl_decompress",
|
|
21
|
+
"arzl_arm_filter",
|
|
22
|
+
"unarzl",
|
|
23
|
+
"sce_arlz_decode",
|
|
24
|
+
"sce_arlz_arm_filter",
|
|
25
|
+
]
|
unarzl/__main__.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from .arzl import unarzl
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main(argv: list[str] | None = None) -> int:
|
|
8
|
+
parser = argparse.ArgumentParser(
|
|
9
|
+
prog="unarzl",
|
|
10
|
+
description="Decompress an ARZL-compressed PlayStation Vita segment.",
|
|
11
|
+
)
|
|
12
|
+
parser.add_argument("input", help="input file (or - for stdin)")
|
|
13
|
+
parser.add_argument("output", help="output file")
|
|
14
|
+
args = parser.parse_args(argv)
|
|
15
|
+
|
|
16
|
+
if args.input == "-":
|
|
17
|
+
data = sys.stdin.buffer.read()
|
|
18
|
+
else:
|
|
19
|
+
with open(args.input, "rb") as f:
|
|
20
|
+
data = f.read()
|
|
21
|
+
|
|
22
|
+
output = unarzl(data)
|
|
23
|
+
with open(args.output, "wb") as f:
|
|
24
|
+
f.write(output)
|
|
25
|
+
return 0
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if __name__ == "__main__":
|
|
29
|
+
raise SystemExit(main())
|