Primo commit del progetto: motore Rust con parser HTML, cascata CSS, layout, raster CPU, formulari, bidi, flex, tabelle, JavaScript (Boa) con eventi e costruzione di nodi, rete HTTP/HTTPS con TLS, sotto-risorse, invio dei formulari; guscio grafico per Sailfish (QML/Silica) e per desktop (minifb, distribuito come AppImage), con 11 documenti di specifica e 91 casi di reftest.
38 lines
1.2 KiB
Python
Executable File
38 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Estrae il runtime di un'AppImage esistente (tipo 2) per riusarlo.
|
|
|
|
AppImage = [runtime ELF][immagine squashfs]. Il runtime finisce dove inizia il
|
|
superblocco squashfs: si cerca la magic "hsqs" e si valida (block_size potenza di
|
|
due, compressione 1-6), perché "hsqs" compare anche dentro il codice del runtime.
|
|
"""
|
|
import struct
|
|
import sys
|
|
|
|
|
|
def main() -> int:
|
|
if len(sys.argv) < 3:
|
|
print("uso: extract-runtime.py APPIMAGE RUNTIME_OUT", file=sys.stderr)
|
|
return 2
|
|
src, dst = sys.argv[1], sys.argv[2]
|
|
data = open(src, "rb").read()
|
|
|
|
off = 0
|
|
while True:
|
|
off = data.find(b"hsqs", off)
|
|
if off < 0:
|
|
break
|
|
if off + 28 <= len(data):
|
|
_, _, blk, _, comp, blog, _, _ = struct.unpack("<IIIIHHHH", data[off + 4 : off + 28])
|
|
if 4096 <= blk <= 1048576 and (blk & (blk - 1)) == 0 and 1 <= comp <= 6 and 12 <= blog <= 20:
|
|
open(dst, "wb").write(data[:off])
|
|
print(f"runtime: {off} byte estratti da {src}")
|
|
return 0
|
|
off += 1
|
|
|
|
print("nessun superblocco squashfs valido: non è un'AppImage di tipo 2", file=sys.stderr)
|
|
return 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|