exit; } if (!Ossec::is_editable($file)) { $data['status'] = 'error'; $data['data'] = _('Error! File not editable'); echo json_encode($data); exit; } $_SESSION['_current_file'] = $file; $lk_name = $_SESSION['lk_name']; $new_xml_data = html_entity_decode(base64_decode($new_xml_data), ENT_QUOTES, 'UTF-8'); $xml_obj = new Xml_parser($lk_name); $xml_obj->load_string($new_xml_data); if ($xml_obj->errors['status'] == FALSE) { $data['status'] = 'error'; $data['data'] = "<div id='parse_errors'>\n <span style='font-weight: bold;'>" . _('Data in XML file with wrong format') . " <a onclick=\"\$('#msg_errors').toggle();\"> [" . _('View errors') . "]</a></span>\n <br/><div id='msg_errors'>" . implode('', $xml_obj->errors['msg']) . "</div>\n </div>"; } else { try { Ossec::set_rule_file($sensor_id, $file, $new_xml_data); $array_xml = $xml_obj->xml2array(); $tree_json = Ossec_utilities::array2json($array_xml, $file); $_SESSION['_tree_json'] = $tree_json; $_SESSION['_tree'] = $array_xml; $data['data'] = _("{$file} updated successfully") . '###' . base64_encode($tree_json); } catch (Exception $e) { $data['status'] = 'error'; $data['data'] = $e->getMessage(); } } echo json_encode($data); exit;
var id = $(this).attr("id"); get_action(id); }); } }); </script> <?php } else { if ($tab == '#tab2') { $ac_key = empty($_POST['ac_key']) ? 0 : $_POST['ac_key']; try { // Agent.conf $conf_data = Ossec_agent::get_configuration_file($sensor_id); $xml_obj = new Xml_parser('key'); $xml_obj->load_string($conf_data['data']); $array_oss_cnf = $xml_obj->xml2array(); $agent_config = Ossec::get_nodes($array_oss_cnf, 'agent_config'); $ac_keys[] = array(); if (is_array($agent_config) && !empty($agent_config)) { foreach ($agent_config as $k => $ac_data) { unset($ac_data['@attributes']['key']); $keys = array_keys($ac_data['@attributes']); $ac_keys[$k] = $keys[0] . ' = "' . $ac_data['@attributes'][$keys[0]] . '"'; } } $syscheck = Ossec::get_nodes($array_oss_cnf, 'syscheck'); $syscheck = $syscheck[$ac_key]; $directories = Ossec::get_nodes($syscheck, 'directories'); $wentries = Ossec::get_nodes($syscheck, 'windows_registry'); $reg_ignores = Ossec::get_nodes($syscheck, 'registry_ignore'); $ignores = Ossec::get_nodes($syscheck, 'ignore');