docs: analyse de Peugeot Update 1.6.1 et squelette du dépôt
- API Majestic (devices, getAvailableUpdate, téléchargements Range/licence) - déroulé fonctionnel et machine à états de l'app d'origine - format de la clé USB (FAT32, license/, extraction tar) - extracteur asar minimal en lecture seule (tools/asar_extract.py) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
commit
f1cd91210d
6 files changed
+324
No files matched your search
@@ -0,0 +1,44 @@
|
||||
"""Minimal read-only asar extractor: copies selected files out of an asar archive.
|
||||
|
||||
usage: python -I asar_extract.py <app.asar> <out_dir> [prefix ...]
|
||||
Only entries whose path starts with one of the prefixes are written.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
|
||||
|
||||
def walk(node, path=""):
|
||||
for name, child in node.get("files", {}).items():
|
||||
p = f"{path}/{name}" if path else name
|
||||
if "files" in child:
|
||||
yield from walk(child, p)
|
||||
else:
|
||||
yield p, child
|
||||
|
||||
|
||||
def main():
|
||||
asar, out, *prefixes = sys.argv[1:]
|
||||
with open(asar, "rb") as f:
|
||||
_, header_size, _, json_len = struct.unpack("<4I", f.read(16))
|
||||
header = json.loads(f.read(json_len))
|
||||
base = 8 + header_size
|
||||
n = 0
|
||||
for p, e in walk(header):
|
||||
if prefixes and not any(p.startswith(x) for x in prefixes):
|
||||
continue
|
||||
if e.get("unpacked") or "offset" not in e:
|
||||
continue
|
||||
dest = os.path.normpath(os.path.join(out, p))
|
||||
if not dest.startswith(os.path.normpath(out) + os.sep):
|
||||
continue # path traversal guard
|
||||
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||
f.seek(base + int(e["offset"]))
|
||||
with open(dest, "wb") as o:
|
||||
o.write(f.read(e["size"]))
|
||||
n += 1
|
||||
print(f"{n} files extracted")
|
||||
|
||||
|
||||
main()
|
||||
Reference in new issue
Block a user