def modify_feed(test_values, request): """ Modify the Debian OVAL feed, setting a test tag value """ backup_data = file.read_xml_file(file_path=custom_debian_oval_feed_path, namespaces=vd.XML_FEED_NAMESPACES, xml_header=True) modified_data = insert_xml_tag(pattern=insert_pattern, tag=test_values[0], value=test_values[1], data=str(backup_data)) file.write_file(file_path=custom_debian_oval_feed_path, data=modified_data) vd.clean_vuln_and_sys_programs_tables() control_service('restart', daemon='wazuh-modulesd') vd.set_system(system='BUSTER') yield file.write_file(file_path=custom_debian_oval_feed_path, data=backup_data) vd.clean_vuln_and_sys_programs_tables() truncate_file(LOG_FILE_PATH)
def modify_feed(test_data, request): """ Modify the redhat OVAL feed, setting a test field value """ backup_data = file.read_xml_file(file_path=custom_redhat_oval_feed_path, namespaces=vd.XML_FEED_NAMESPACES, xml_header=True) modified_data = replace_regex(pattern=test_data['pattern'], new_value=test_data['update'], data=str(backup_data), replace_group=True) file.write_file(file_path=custom_redhat_oval_feed_path, data=modified_data) vd.clean_vuln_and_sys_programs_tables() control_service('restart', daemon='wazuh-modulesd') vd.set_system(system='RHEL8') yield file.write_file(file_path=custom_redhat_oval_feed_path, data=backup_data) vd.clean_vuln_and_sys_programs_tables() file.truncate_file(LOG_FILE_PATH)
def remove_tag_feed(request): """ It allows to modify the feed by removing a certain tag and loading the new feed configuration """ backup_data = file.read_xml_file(file_path=custom_canonical_oval_feed_path, namespaces=vd.XML_FEED_NAMESPACES) data_removed_tag = replace_regex(request.param['pattern'], '', str(backup_data)) file.write_file(file_path=custom_canonical_oval_feed_path, data=data_removed_tag) vd.clean_vuln_and_sys_programs_tables() control_service('restart', daemon='wazuh-modulesd') vd.set_system(system='BIONIC') yield request.param file.write_file(file_path=custom_canonical_oval_feed_path, data=backup_data) vd.clean_vuln_and_sys_programs_tables() file.truncate_file(LOG_FILE_PATH)