Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"""Read only loader entrypoints and loader bytes from the named local APKs."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import json
|
||||
import zipfile
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
files = sorted(root.glob("*.apk")) + [
|
||||
root / "analysis/device_current.apk",
|
||||
root / "analysis/device_after_two_mods.apk",
|
||||
]
|
||||
rows = []
|
||||
for path in files:
|
||||
if not path.is_file():
|
||||
continue
|
||||
with zipfile.ZipFile(path) as archive:
|
||||
names = archive.namelist()
|
||||
row = {"apk": str(path.relative_to(root)), "loaders": [], "air_descriptors": []}
|
||||
for name in names:
|
||||
if name == "assets/MYRDyd.swf":
|
||||
data = archive.read(name)
|
||||
row["loaders"].append({"name": name, "size": len(data), "sha256": hashlib.sha256(data).hexdigest()})
|
||||
if name.endswith("META-INF/AIR/application.xml"):
|
||||
data = archive.read(name)
|
||||
xml = ET.fromstring(data)
|
||||
row["air_descriptors"].append({"name": name, "entrypoints": [element.text for element in xml.iter() if element.tag.endswith("}content")], "text": data.decode("utf-8")})
|
||||
row["swf_candidates"] = [n for n in names if n.lower().endswith(".swf") and ("myrdyd" in n.lower() or "myrloader" in n.lower())]
|
||||
rows.append(row)
|
||||
destination = Path(__file__).with_name("apk_entrypoints_20261107_01.json")
|
||||
with destination.open("x", encoding="utf-8") as out:
|
||||
json.dump(rows, out, indent=2, ensure_ascii=False)
|
||||
for row in rows:
|
||||
print(json.dumps({**row, "air_descriptors": [{k:v for k,v in d.items() if k != "text"} for d in row["air_descriptors"]]}, ensure_ascii=True))
|
||||
Reference in New Issue
Block a user