Skip to content

Commit

Permalink
refactor(#1915): refactor fim framework
Browse files Browse the repository at this point in the history
  • Loading branch information
Deblintrake09 committed Nov 28, 2022
1 parent b0f831b commit e9df6ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 0 additions & 1 deletion deps/wazuh_testing/wazuh_testing/modules/fim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@
CB_REALTIME_MONITORED_FOLDERS = r'.*Folders monitored with real-time engine: (\d+)'
CB_REALTIME_WHODATA_ENGINE_STARTED = 'File integrity monitoring real-time Whodata engine started'
CB_INVALID_CONFIG_VALUE = r".*Invalid value for element '(.*)': (.*)."

CB_INTEGRITY_CONTROL_MESSAGE = r".*Sending integrity control message: (.+)$"
CB_MAXIMUM_FILE_SIZE = r".*Maximum file size limit to generate diff information configured to \'(\d+) KB\'.*"
CB_AGENT_CONNECT = r".* Connected to the server .*"
Expand Down
20 changes: 20 additions & 0 deletions deps/wazuh_testing/wazuh_testing/modules/fim/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,26 @@ def create_registry(key, subkey, arch):
logger.warning(f"Registry could not be created: {e}")


def modify_registry_value(key_h, value_name, type, value):
"""
Modify the content of a registry. If the value doesn't not exists, it will be created.
Args:
key_h (pyHKEY): the key handle of the registry.
value_name (str): the value to be set.
type (int): type of the value.
value (str): the content that will be written to the registry value.
"""
if sys.platform == 'win32':
try:
logger.info(f"Modifying value '{value_name}' of type {fim.registry_value_type[type]} and value '{value}'")
win32api.RegSetValueEx(key_h, value_name, 0, type, value)
except OSError as e:
logger.warning(f"Could not modify registry value content: {e}")
except pywintypes.error as e:
logger.warning(f"Could not modify registry value content: {e}")


def delete_registry(key, subkey, arch):
"""Delete a registry key.
Expand Down

0 comments on commit e9df6ba

Please sign in to comment.