* 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'); //Current sensor $sensor_id = $_SESSION['ossec_sensor']; $db = new ossim_db(); $conn = $db->connect(); $s_data = Ossec_utilities::get_sensors($conn, $sensor_id); $sensor_opt = $s_data['sensor_opt']; $db->close(); //Check available sensors if (!is_array($s_data['sensors']) || empty($s_data['sensors'])) { $styles = 'width: 90%; text-align:left; margin: 50px auto;'; echo ossim_error(_('There is no sensor available'), AV_INFO, $styles); exit; } $conf = $GLOBALS['CONF']; $idm_enabled = $conf->get_conf('enable_idm'); $_SESSION['_idm'] = $idm_enabled; session_write_close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html>
$db->close(); Util::response_bad_request($error_msg); } try { $data['status'] = 'success'; $data['data'] = _('Your request has been processed'); //Getting assets with Windows OS $tables = ', host_properties hp, user_component_filter f'; $filters = array('where' => 'hp.host_id=host.id AND hp.property_ref=3 AND (hp.value LIKE "windows%" OR hp.value LIKE "microsoft%") AND f.asset_id = host.id AND f.asset_type="asset" AND f.session_id = "' . session_id() . '"'); list($assets_w_os, $total_windows) = Asset_host::get_list($conn, $tables, $filters, FALSE); $total_deployed = 0; $deployment_stats = array(); if ($total_windows > 0) { //HIDS sensors $s_data = Ossec_utilities::get_sensors($conn); $hids_sensors = $s_data['sensors']; foreach ($assets_w_os as $asset_id => $a_data) { $deployment_stats[$asset_id] = array('status' => 'success', 'data' => ''); //Getting HIDS sensor and Windows IP $sensor_id = NULL; $hids_agents = Asset_host::get_related_hids_agents($conn, $asset_id); $aux_ip_address = explode(',', $a_data['ips']); $aux_ip_address = array_flip($aux_ip_address); $default_ip_address = array_pop(array_keys($aux_ip_address)); if (is_array($hids_agents) && !empty($hids_agents)) { //Case 1: HIDS Agents was previously deployed $hids_agent = array_pop($hids_agents); $sensor_id = $hids_agent['sensor_id']; $agent_id = $hids_agent['agent_id']; if (Asset_host_ips::valid_ip($hids_agent['ip_cidr']) && array_key_exists($hids_agent['ip_cidr'], $aux_ip_address)) {