Created
November 17, 2022 02:56
-
-
Save iDigitalFlame/5489d8db0f684d1ee48486bfcb12443a to your computer and use it in GitHub Desktop.
Registry ".pol" file reader/writer to assist with debugging complex setups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from sys import argv | |
if len(argv) <= 1: | |
raise ValueError(f"{argv[0]} <Registry.pol> <Output.pol>") | |
with open(argv[1], "rb") as f: | |
b = f.read() | |
r = b.split(b"]\x00[\x00") | |
r[0], r[-1] = r[0][10:], r[-1][:-2] | |
for x in range(0, len(r)): | |
k = r[x].split(b";\x00") | |
print(x + 1, k[0].decode("UTF-16-LE"), ":", k[1].decode("UTF-16-LE")) | |
if len(argv) > 2: | |
i = r[:1543] + r[1550:] # Customize Range here | |
v = b"PReg\x01\x00\x00\x00[\x00" + (b"]\x00[\x00".join(i)) + b"]\x00" | |
with open(argv[2], "wb") as f: | |
f.write(v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment