diff --git a/malboxes/malboxes.py b/malboxes/malboxes.py index b7f2821..fb1cd98 100644 --- a/malboxes/malboxes.py +++ b/malboxes/malboxes.py @@ -501,6 +501,11 @@ def registry(profile_name, reg_mod, fd): Adds a registry key modification to a profile with PowerShell commands. """ if reg_mod["modtype"] == "add": + # Creates registry path if it doesn't exist + reg_key_line = 'if ( -not (Test-Path "{0}") ){{New-Item "{0}" -Force}}\r\n' \ + .format(reg_mod["key"]) + fd.write(reg_key_line) + command = "New-ItemProperty" line = '{} -Path "{}" -Name "{}" -Value "{}" -PropertyType "{}"\r\n' \ .format(command, reg_mod["key"], reg_mod["name"], reg_mod["value"], @@ -560,7 +565,7 @@ def document(profile_name, modtype, docpath, fd): line = '{0} -Path "{1}"\r\n'.format(command, docpath) print("Removing file: {}".format(docpath)) else: - print("Directory modification type invalid.") + print("Document modification type invalid.") print("Valid ones are: add, delete.") fd.write(line)