} $more_info = array(); $ret = null; $agent = explode(",", $agent); $agent_type = null; ossim_valid($agent[0], OSS_DIGIT, 'illegal:' . _("Id agent")); if (ossim_error()) { ossim_clean_error(); $agent_name = $agent[0]; $agent_actions = " -- "; $agent_type = 0; } else { exec("sudo /var/ossec/bin/agent_control -i " . $agent[0] . " -s", $more_info, $ret); $more_info = $ret !== 0 ? _("Information from agent not available") : explode(",", $more_info[0]); $agent_name = "<a class='agent_id'><img src='../pixmaps/plus-small.png' alt='More info' align='absmiddle'/>" . $agent[0] . "</a>"; $agent_actions = get_actions($agent); $agent_type = 1; } //Agents trends $trend = array(); if ($agent[2] == "127.0.0.1") { require_once 'classes/Sensor.inc'; $db = new ossim_db(); $dbconn = $db->connect(); $name = trim(str_replace("(server)", "", $agent[1])); $sensor = Sensor::get_list($dbconn, "WHERE name = '{$name}'"); $ip = empty($sensor) ? $agent[2] : $sensor[0]->get_ip(); } else { $ip = $agent[2]; } $data = SIEM_trends_hids($ip);
} $more_info = array(); $ret = null; $agent = explode(",", $agent); $agent_type = null; ossim_valid($agent[0], OSS_DIGIT, 'illegal:' . _("Id agent")); if (ossim_error()) { ossim_clean_error(); $agent_name = $agent[0]; $agent_actions = " -- "; $agent_type = 0; } else { exec("sudo /var/ossec/bin/agent_control -i " . $agent[0] . " -s", $more_info, $ret); $more_info = $ret !== 0 ? _("Information from agent not available") : explode(",", $more_info[0]); $agent_name = "<a class='agent_id'><img src='../pixmaps/plus-small.png' alt='More info' align='absmiddle'/>" . $agent[0] . "</a>"; $agent_actions = $events_hids_config ? get_actions($agent) : " -- "; $agent_type = 1; } echo "<tr id='cont_agent_" . $agent[0] . "'>\r\n\t\t\t\t\t<td id='agent_" . $agent[0] . "'>{$agent_name}</td>\r\n\t\t\t\t\t<td>" . $agent[1] . "</td>\r\n\t\t\t\t\t<td>" . $agent[2] . "</td>\r\n\t\t\t\t\t<td>" . $agent[3] . "</td>\r\n\t\t\t\t\t<td class='agent_actions center'>{$agent_actions}</td>\r\n\t\t\t\t</tr>"; if ($agent_type === 1) { echo "<tr id='minfo_" . $agent[0] . "' style='display:none;'>\r\n\t\t\t\t\t\t<td colspan='5'>"; if (!is_array($more_info)) { echo "<div style='padding:5px; color: #D8000C; text-align:center;'>{$more_info}</div>"; } else { echo "<div style='padding: 3px 3px 5px 5px; font-weight: bold;'>" . _("Agent information") . ":</div>"; echo "<div style='float:left; width: 170px; font-weight: bold; padding:0px 3px 5px 15px;'>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Agent ID") . ":</span><br/> \r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Agent Name") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("IP address") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Status") . ":</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Operating system") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Client version") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Last keep alive") . ":</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Syscheck last started at") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . _("Rootcheck last started at") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t</div>"; echo "<div style='float:left; width: auto; padding:0px 3px 5px 15px;'>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[0] . "</span><br/> \r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[1] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[2] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[3] . "</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[4] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[5] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[6] . "</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[7] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[8] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t </div>\r\n\t\t\t\t\t\t\t\t</div>"; } echo "</td>\r\n\t\t\t\t\t</tr>"; } }
} else { exec("sudo /var/ossec/bin/agent_control -ls", $agents, $ret); if (is_array($agents)) { $agent = get_last_agent($agents); $agent_field = explode(",", $agent); if (count($agents) == 1) { $header = "<tr>\r\n\t\t\t\t\t\t\t\t\t<th style='width: 100px;'>" . _("ID") . "</th>\r\n\t\t\t\t\t\t\t\t\t<th>" . _("Name") . "</th>\r\n\t\t\t\t\t\t\t\t\t<th>" . _("IP") . "</th>\r\n\t\t\t\t\t\t\t\t\t<th>" . _("Status") . "</th>\r\n\t\t\t\t\t\t\t\t\t<th class='agent_actions'>" . _("Actions") . "</th>\r\n\t\t\t\t\t\t\t\t</tr>"; } else { $header = ''; } if (is_array($agent_field)) { $more_info = array(); $ret = null; exec("sudo /var/ossec/bin/agent_control -i " . $agent_field[0] . " -s", $more_info, $ret); $more_info = $ret !== 0 ? _("Information from agent not available") : explode(",", $more_info[0]); echo "1###" . _("Agent added sucessfully") . "###" . $agent_field[0] . "###" . $header . "<tr id='cont_agent_" . $agent_field[0] . "'>\r\n\t\t\t\t\t\t\t\t<td id='agent_" . $agent_field[0] . "'><a class='agent_id'><img src='../pixmaps/plus-small.png' alt='More info' align='absmiddle'/>" . $agent_field[0] . "</a></td>\r\n\t\t\t\t\t\t\t\t<td>" . $agent_field[1] . "</td>\r\n\t\t\t\t\t\t\t\t<td>" . $agent_field[2] . "</td>\r\n\t\t\t\t\t\t\t\t<td>" . $agent_field[3] . "</td>\r\n\t\t\t\t\t\t\t\t<td class='agent_actions center'>" . get_actions($agent_field) . "</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr id='minfo_" . $agent_field[0] . "' style='display:none;'>\r\n\t\t\t\t\t\t\t\t<td colspan='5'>"; if (!is_array($more_info)) { echo "<div style='margin:auto; padding:5px; color: #D8000C;'>{$more_info}</div>"; } else { echo "<div style='padding: 3px 3px 5px 5px; font-weight: bold;'>" . _("Agent information") . ":</div>"; echo "<div style='float:left; width: 170px; font-weight: bold; padding:0px 3px 5px 15px;'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("Agent ID") . ":</span><br/> \r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("Agent Name") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("IP address") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("Status") . ":</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("Operating system") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("Client version") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("Last keep alive") . ":</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("Syscheck last started at") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . _("Rootcheck last started at") . ":</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t</div>"; echo "<div style='float:left; width: auto; padding:0px 3px 5px 15px;'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[0] . "</span><br/> \r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[1] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[2] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[3] . "</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[4] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[5] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[6] . "</span><br/><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[7] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span>" . $more_info[8] . "</span><br/>\r\n\t\t\t\t\t\t\t\t\t\t\t </div>\r\n\t\t\t\t\t\t\t\t\t\t</div>"; } echo "</td>\r\n\t\t\t\t\t\t\t</tr>"; } } else { echo "error###" . _("Error to Add Agent") . " (3)"; } } break; case "delete_agent":
<?php $actions = get_actions($action_options); if ($actions) { echo '<h3>Actions</h3>'; echo '<table class="table table-bordered"><thead><tr> <th>ID</th> <th>Report</th> <th>Name</th> <th>Slug</th> <th>Count</th> <th>Unique</th> <th>New</th> <th>New Deliverable</th> <th>Referrals</th> <th>Count This Week</th> <th>New This Week</th> <th>New Deliverable This Week</th> <th>Status</th> <th>Style</th> <th>Department</th> <th>Campaign</th> <th>View</th> <th>Sasla</th> </tr> </thead><tbody>';
/** * Call actions on a particular placement. * the limit here is there can be only 1 parameter that can be passed to * actions so you have to pass all values via ARRAY instead of adding * multiple params...ie call_actions('play_video',$params); * $params will be passed to all functions that are registerd for * play_video as 1st parameter. */ function call_actions($place, $param) { $funcs = get_actions($place); if ($funcs) { foreach ($funcs as $func) { $output = $func($param); if ($output) { return $output; } } return false; } return false; }