"""Read copied PE data and Ghidra text; never load/execute the Parsec DLL.""" from pathlib import Path import hashlib, json, re, struct, bisect import pefile ROOT=Path(__file__).resolve().parent AN=ROOT.parent/'analysis/parsec' OUT=AN/'research/settings' OUT.mkdir(parents=True,exist_ok=True) BIN=AN/'binaries/runtime/parsecd-150-104a.dll' SHA='8c8c4299ddf503b2c25c0905b0a0820f3e8238c252e9ace37bf25964ef4a8f6f' assert hashlib.sha256(BIN.read_bytes()).hexdigest()==SHA pe=pefile.PE(str(BIN)); im=pe.get_memory_mapped_image(); base=pe.OPTIONAL_HEADER.ImageBase def string(ptr): if not ptr:return '' r=ptr-base if not 0<=r