Reg file fix and naming changes

Edited the utils so that it creates a blank reg file if needed and then properly exports the data.
This commit is contained in:
J-Doiron
2024-12-23 12:43:15 -08:00
parent 73f2fb2891
commit 8dc0e1107d
2 changed files with 8 additions and 4 deletions

View File

@@ -2,10 +2,14 @@
from argparse import ArgumentParser
import re
import winreg
import os
def export_registry_key(hive, subkey, input_file):
try:
if not os.path.exists(input_file):
with open(input_file, 'w') as file:
file.write("")
with winreg.OpenKey(hive,subkey) as reg_key:
with open(input_file, 'w') as reg_file:
reg_file.write(f"Windows Registry Editor Version 5.00\n\n")
@@ -33,7 +37,7 @@ def convert_dword_to_decimal(dword_hex):
return int(dword_hex, 16)
def process_registry_file(input_file, config_file):
export_registry_key()
export_registry_key(hive, subkey, input_file)
with open(input_file, 'r') as file:
lines = file.readlines()