Extend event effects through add-building strip
This commit is contained in:
parent
4945430149
commit
b2da02befa
7 changed files with 3319 additions and 1161 deletions
|
|
@ -11,7 +11,7 @@ from pathlib import Path
|
|||
|
||||
TABLE_BASE_VA = 0x00610398
|
||||
ROW_STRIDE = 0x6E
|
||||
ROW_COUNT = 520
|
||||
MAX_ROW_COUNT = 2048
|
||||
IMAGE_BASE = 0x00400000
|
||||
|
||||
|
||||
|
|
@ -27,17 +27,20 @@ def load_lng_labels(path: Path) -> dict[int, str]:
|
|||
def extract_rows(exe_bytes: bytes, labels: dict[int, str]) -> list[dict[str, object]]:
|
||||
table_offset = TABLE_BASE_VA - IMAGE_BASE
|
||||
rows: list[dict[str, object]] = []
|
||||
for row_index in range(ROW_COUNT):
|
||||
for row_index in range(MAX_ROW_COUNT):
|
||||
row = exe_bytes[
|
||||
table_offset + row_index * ROW_STRIDE : table_offset + (row_index + 1) * ROW_STRIDE
|
||||
]
|
||||
if len(row) < ROW_STRIDE:
|
||||
break
|
||||
descriptor_id = struct.unpack_from("<I", row, 0x04)[0]
|
||||
if descriptor_id != row_index:
|
||||
break
|
||||
label_id = struct.unpack_from("<H", row, 0x6A)[0]
|
||||
rows.append(
|
||||
{
|
||||
"row_index": row_index,
|
||||
"descriptor_id": struct.unpack_from("<I", row, 0x04)[0],
|
||||
"descriptor_id": descriptor_id,
|
||||
"selector_order": struct.unpack_from("<f", row, 0x00)[0],
|
||||
"target_mask_bits": row[0x65],
|
||||
"label_id": label_id,
|
||||
|
|
@ -62,12 +65,12 @@ def main() -> None:
|
|||
artifact = {
|
||||
"table_base_va": f"0x{TABLE_BASE_VA:08x}",
|
||||
"row_stride_hex": f"0x{ROW_STRIDE:02x}",
|
||||
"descriptor_count": ROW_COUNT,
|
||||
"binary_path_hint": str(args.exe),
|
||||
"language_path_hint": str(args.lng),
|
||||
"binary_sha256": hashlib.sha256(exe_bytes).hexdigest(),
|
||||
"descriptors": extract_rows(exe_bytes, labels),
|
||||
}
|
||||
artifact["descriptors"] = extract_rows(exe_bytes, labels)
|
||||
artifact["descriptor_count"] = len(artifact["descriptors"])
|
||||
args.out.write_text(json.dumps(artifact, indent=2) + "\n", encoding="utf-8")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue