33 lines
1 KiB
Python
33 lines
1 KiB
Python
|
|
from pathlib import Path
|
||
|
|
import json
|
||
|
|
|
||
|
|
from tools.poc_crusader_usecode_parser import parse_ir
|
||
|
|
|
||
|
|
|
||
|
|
def dump_variant(label: str, extracted_root: str, class_name: str, slot: int) -> None:
|
||
|
|
ir = parse_ir(class_name, slot, extracted_root)
|
||
|
|
print(f"=== {label} {class_name} slot=0x{slot:02X} ===")
|
||
|
|
print(json.dumps(ir["class"], indent=2))
|
||
|
|
print(json.dumps(ir["event"], indent=2))
|
||
|
|
for op in ir["ops"]:
|
||
|
|
print(
|
||
|
|
json.dumps(
|
||
|
|
{
|
||
|
|
"offset": op["offset"],
|
||
|
|
"mnemonic": op["mnemonic"],
|
||
|
|
"operands": op["operands"],
|
||
|
|
"raw_bytes": op["raw_bytes"],
|
||
|
|
},
|
||
|
|
separators=(",", ":"),
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def main() -> None:
|
||
|
|
root = Path(__file__).resolve().parent
|
||
|
|
dump_variant("remorse", str(root / "USECODE" / "EUSECODE_extracted"), "CHANGER", 0x07)
|
||
|
|
dump_variant("regret", str(root / "USECODE" / "REGRET" / "REGRET_USECODE_extracted"), "CHANGER", 0x07)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|