$db = new ossim_db(); $conn = $db->connect(); if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) { $data['status'] = 'error'; $data['data'] = _('Error! Sensor not allowed'); } $db->close(); } } if ($data['status'] == 'error') { $data['status'] = 'error'; $data['data'] = _('We found the followings errors:') . "<div style='padding-left: 15px; text-align:left;'>" . $data['data'] . '</div>'; echo json_encode($data); 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 {
* along with this package; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * * * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ require_once dirname(__FILE__) . '/../../conf/config.inc'; Session::logcheck('environment-menu', 'EventsHidsConfig'); $lk_name = $_SESSION['lk_name']; $file = $_SESSION['_current_file']; $editable = Ossec::is_editable($file); $node = explode('</span>', strip_tags($_POST['node'], '<span>')); $node_name = preg_replace('/<span>/', '', $node[0]); $_SESSION['_current_node'] = $node_name; $lk_value = strip_tags($_POST['lk_value']); $_SESSION['_current_level_key'] = $lk_value; $tree = $_SESSION['_tree']; $child = Ossec::get_child($tree, $lk_name, $lk_value); $_SESSION['_current_branch'] = $child; $parents = $child['parents']; $ac_data = Ossec::get_ac_type($parents); echo implode('##__##', $ac_data) . '##__##'; $node_type = Ossec::get_node_type($node_name, $child); $_SESSION["_current_node_type"] = $node_type; $sf_data = array('handler' => 'modify', 'lk_value' => $lk_value); /*
} $db->close(); } if (ossim_error()) { echo '2###' . _('We found the followings errors') . ": <div style='padding-left: 15px; text-align:left;'>" . ossim_get_error_clean() . '</div>'; exit; } //Current sensor $_SESSION['ossec_sensor'] = $sensor_id; echo '1###'; try { $rules = Ossec::get_rule_files($sensor_id, FALSE); $options_e .= "<optgroup label='" . _('Editable rule file') . "'>\n"; $options_ne .= "<optgroup label='" . _('Rules files read-only') . "'>\n"; foreach ($rules as $rule) { if (Ossec::is_editable($rule)) { $options_e .= "<option style='text-align: left;' value='{$rule}'>{$rule}</option>\n"; } else { $options_ne .= "<option style='text-align: left;' value='{$rule}'>{$rule}</option>\n"; } } $options_e .= "</optgroup>\n"; $options_ne .= "</optgroup>\n"; $rule_options = $options_e . "\n" . $options_ne; } catch (Exception $e) { $rule_options = "<option value=''>" . _('No rule files found') . "</option>"; } ?> <div id='tree_container_top'> <select id='rules' name='rules'> <?php
ossim_valid($cache, 'true | false', 'illegal:' . _('Cache')); if (!ossim_error()) { $db = new ossim_db(); $conn = $db->connect(); if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) { ossim_set_error(_('Error! Sensor not allowed')); } $db->close(); } if (ossim_error()) { echo "<option value=''>" . _('No rule files found') . '</option>'; exit; } try { $rules = Ossec::get_rule_files($sensor_id, $cache); $options_e .= "<optgroup label='" . _('Editable rule file') . "'>\n"; $options_ne .= "<optgroup label='" . _('Rules files read-only') . "'>\n"; foreach ($rules as $rule) { $selected = $rule == $file ? ' selected="selected"' : ''; if (Ossec::is_editable($v)) { $options_e .= "<option style='text-align: left;' {$selected} value='{$rule}'>{$rule}</option>\n"; } else { $options_ne .= "<option style='text-align: left;' {$selected} value='{$rule}'>{$rule}</option>\n"; } } $options_e .= "</optgroup>\n"; $options_ne .= "</optgroup>\n"; echo $options_e . "\n" . $options_ne; } catch (Exception $e) { echo "<option value=''>" . _('No rule files found') . "</option>"; }