• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Asset_host类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Asset_host的典型用法代码示例。如果您正苦于以下问题:PHP Asset_host类的具体用法?PHP Asset_host怎么用?PHP Asset_host使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Asset_host类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_asset_info

function get_asset_info($conn, $asset_id)
{
    $asset = Asset_host::get_object($conn, $asset_id);
    //Asset Type
    $asset_type = $asset->get_external() ? _('External') : _('Internal');
    //Asset IPs
    $asset_ips = $asset->get_ips();
    $ips = $asset_ips->get_ips();
    //Asset Sensors
    $asset_sensors = $asset->get_sensors();
    $sensors = $asset_sensors->get_sensors();
    //Asset Nets
    $networks = $asset->get_nets($conn);
    //Asset Devices
    $asset_devices = $asset->get_devices();
    $devices = array();
    foreach ($asset_devices->get_devices() as $dt_id => $dt_data) {
        foreach ($dt_data as $dst_id => $d_name) {
            $device_id = $dt_id;
            $device_id .= $dst_id > 0 ? ': ' . $dst_id : '';
            $devices[$device_id] = $d_name;
        }
    }
    $os_data = $asset->get_os();
    $data = array('id' => $asset_id, 'hostname' => $asset->get_name(), 'ips' => $ips, 'descr' => html_entity_decode($asset->get_descr(), ENT_QUOTES, 'UTF-8'), 'asset_type' => $asset_type, 'fqdn' => $asset->get_fqdns(), 'asset_value' => $asset->get_asset_value(), 'icon' => base64_encode($asset->get_icon()), 'os' => $os_data['value'], 'model' => $asset->get_model(), 'sensors' => $sensors, 'networks' => $networks, 'devices' => $devices);
    return $data;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:27,代码来源:get_asset_info.php


示例2: get_asset_tags

/**
 * @param $conn
 * @param $asset_id
 *
 * @return array
 */
function get_asset_tags($conn, $asset_id)
{
    if (!Asset_host::is_allowed($conn, $asset_id)) {
        $error = _('Asset Not Allowed');
        Util::response_bad_request($error);
    }
    return get_tags($conn, $asset_id);
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:14,代码来源:get_asset_tags.php


示例3: get_asset_groups

function get_asset_groups($conn, $asset_id)
{
    if (!Asset_host::is_allowed($conn, $asset_id)) {
        $error = _('Asset Not Allowed');
        Util::response_bad_request($error);
    }
    try {
        $asset = Asset_host::get_object($conn, $asset_id);
        $num = $asset->get_num_group($conn);
    } catch (Exception $e) {
        $num = '-';
    }
    return $num;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:14,代码来源:get_status_groups.php


示例4: jgraph_attack_graph

function jgraph_attack_graph($target, $hosts, $type = "Bar3D", $width = 450, $height = 250)
{
    global $security_report;
    global $datapath;
    global $base_dir;
    global $date_from, $date_to;
    if (!strcmp($target, "ip_src")) {
        if (!($fp = @fopen("{$base_dir}/tmp/ip_src.xml", "w"))) {
            print "Error: <b>{$datapath}</b> directory must exists and be <br/>\n";
            print "writable by the user the webserver runs as";
            exit;
        }
    } else {
        if (!($fp = @fopen("{$base_dir}/tmp/ip_dst.xml", "w"))) {
            print "Error: <b>{$datapath}</b> directory must exists and be <br/>\n";
            print "writable by the user the webserver runs as";
            exit;
        }
    }
    fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" . "<CategoryDataset>\n  <Series name=\"{$target}\">\n");
    $list = $security_report->AttackHost($target, $hosts, "event", $date_from, $date_to);
    foreach ($list as $l) {
        $ip = $l[0];
        $ctx = $l[2] != '' ? $l[2] : Session::get_default_ctx();
        $occurrences = $l[1];
        $_names_aux = Asset_host::get_name_by_ip($security_report->ossim_conn, $ip, $ctx);
        $hostname = array_shift($_names_aux);
        if (strlen($hostname) > MAX_HOSTNAME_LEN) {
            $hostname = $ip;
        }
        fwrite($fp, "    <Item>\n      <Key>{$hostname}</Key>\n      <Value>{$occurrences}</Value>\n    </Item>\n");
    }
    fwrite($fp, "  </Series>\n</CategoryDataset>\n\n");
    fclose($fp);
    echo "\n<applet archive=\"../java/jcommon-0.9.5.jar,../java/jfreechart-0.9.20.jar,../java/jossim-graph.jar\" code=\"net.ossim.graph.applet.OssimGraphApplet\" width=\"{$width}\" height=\"{$height}\" alt=\"You should see an applet, not this text.\">\n    <param name=\"graphType\" value=\"{$type}\">";
    if (!strcmp($target, "ip_src")) {
        echo "   <param name=\"xmlDataUrl\" value=\"{$datapath}/ip_src.xml\">";
    } else {
        echo "   <param name=\"xmlDataUrl\" value=\"{$datapath}/ip_dst.xml\">";
    }
    echo "\n    <param name=\"alpha\" value=\"0.42f\">\n    <param name=\"legend\" value=\"false\">\n    <param name=\"tooltips\" value=\"false\">\n    <param name=\"orientation\" value=\"HORIZONTAL\">\n</applet>\n";
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:42,代码来源:jgraphs.php


示例5: ossim_db

$db = new ossim_db();
$conn = $db->connect();
$filters = array('limit' => "{$from}, {$maxrows}", 'order_by' => "{$order} {$torder}");
if ($search_str != '') {
    $filters['where'] = 'hostname LIKE "%' . $search_str . '%"';
}
// Get object from session
$asset_object = unserialize($_SESSION['asset_detail'][$group_id]);
if (!is_object($asset_object)) {
    throw new Exception(_('Error retrieving the asset data from memory'));
}
// Get the hosts from another groups
if ($asset_type == 'othergroups') {
    $where = " id NOT IN (SELECT host_id FROM host_group_reference WHERE host_group_id = UNHEX('" . $group_id . "')) ";
    $filters['where'] = !empty($filters['where']) ? $where . ' AND ' . $filters['where'] : $where;
    list($host_list, $total) = Asset_host::get_list($conn, '', $filters, $cache);
} else {
    list($host_list, $total) = $asset_object->get_hosts($conn, $filters, FALSE);
}
// DATA
$data = array();
foreach ($host_list as $host_id => $host_data) {
    $devices = Asset_host_devices::get_devices_to_string($conn, $host_id);
    // Asset Group details format
    if ($asset_type == 'group') {
        try {
            $asset_object->can_i_edit($conn);
            $asset_object->can_delete_host($conn);
            $delete_link = '<a href="javascript:;" onclick="del_asset_from_group(\'' . $host_id . '\');return false">';
            $delete_link .= '<img class="delete_small tipinfo" txt="' . _('Remove this asset from group') . '" src="/ossim/pixmaps/delete.png" border="0"/>';
            $delete_link .= '</a>';
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:get_hosts.php


示例6: main_page


//.........这里部分代码省略.........
    $arr = array("name" => "Name", "schedule_type" => "Schedule Type", "time" => "Time", "next_CHECK" => "Next Scan", "enabled" => "Status");
    // modified by hsh to return all scan schedules
    if (empty($arruser)) {
        $query = "SELECT t2.name as profile, t1.meth_TARGET, t1.id, t1.name, t1.schedule_type, t1.meth_VSET, t1.meth_TIMEOUT, t1.username, t1.enabled, t1.next_CHECK, t1.email\n              FROM vuln_job_schedule t1 LEFT JOIN vuln_nessus_settings t2 ON t1.meth_VSET=t2.id ";
    } else {
        $query = "SELECT t2.name as profile, t1.meth_TARGET, t1.id, t1.name, t1.schedule_type, t1.meth_VSET, t1.meth_TIMEOUT, t1.username, t1.enabled, t1.next_CHECK, t1.email\n              FROM vuln_job_schedule t1 LEFT JOIN vuln_nessus_settings t2 ON t1.meth_VSET=t2.id WHERE username in ({$user}) ";
    }
    $query .= $sql_order;
    $result = $dbconn->execute($query);
    if ($result->EOF) {
        echo "<tr><td class='empty_results' height='20' style='text-align:center;'>" . _("No Scheduled Jobs") . "</td></tr>";
    }
    if (!$result->EOF) {
        echo "<tr>";
        foreach ($arr as $order_by => $value) {
            echo "<th><a href=\"manage_jobs.php?sortby={$order_by}&sortdir={$sortdir}\">" . _($value) . "</a></th>";
        }
        if (Session::menu_perms("environment-menu", "EventsVulnerabilitiesScan")) {
            echo "<th>" . _("Action") . "</th></tr>";
        }
    }
    $colors = array("#FFFFFF", "#EEEEEE");
    $color = 0;
    while (!$result->EOF) {
        list($profile, $targets, $schedid, $schedname, $schedtype, $sid, $timeout, $user, $schedstatus, $nextscan, $servers) = $result->fields;
        $name = Av_sensor::get_name_by_id($dbconn, $servers);
        $servers = $name != '' ? $name : "unknown";
        $targets_to_resolve = explode("\n", $targets);
        $ttargets = array();
        foreach ($targets_to_resolve as $id_ip) {
            if (preg_match("/^([a-f\\d]{32})#\\d+\\.\\d+\\.\\d+\\.\\d+\\/\\d{1,2}/i", $id_ip, $found) && Asset_net::is_in_db($dbconn, $found[1])) {
                $ttargets[] = preg_replace("/^([a-f\\d]{32})#/i", "", $id_ip) . " (" . Asset_net::get_name_by_id($dbconn, $found[1]) . ")";
            } else {
                if (preg_match("/^([a-f\\d]{32})#\\d+\\.\\d+\\.\\d+\\.\\d+/i", $id_ip, $found) && Asset_host::is_in_db($dbconn, $found[1])) {
                    $ttargets[] = preg_replace("/^([a-f\\d]{32})#/i", "", $id_ip) . " (" . Asset_host::get_name_by_id($dbconn, $found[1]) . ")";
                } else {
                    $ttargets[] = preg_replace("/[a-f\\d]{32}/i", "", $id_ip);
                }
            }
        }
        $targets = implode("<BR/>", $ttargets);
        $tz = intval($tz);
        $nextscan = gmdate("Y-m-d H:i:s", Util::get_utc_unixtime($nextscan) + 3600 * $tz);
        preg_match("/\\d+\\-\\d+\\-\\d+\\s(\\d+:\\d+:\\d+)/", $nextscan, $found);
        $time = $found[1];
        switch ($schedtype) {
            case "N":
                $stt = _("Once (Now)");
                break;
            case "O":
                $stt = _("Once");
                break;
            case "D":
                $stt = _("Daily");
                break;
            case "W":
                $stt = _("Weekly");
                break;
            case "M":
                $stt = _("Monthly");
                break;
            case "Q":
                $stt = _("Quarterly");
                break;
            case "H":
                $stt = _("On Hold");
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:67,代码来源:manage_jobs.php


示例7: array

     $arrResults[$hostIP . "#" . $hostctx][] = array('service' => $service, 'port' => $service_num, 'protocol' => $service_proto, 'application' => $app, 'risk' => $risk, 'scriptid' => $scriptid, 'exception' => $eid, 'msg' => preg_replace('/(<br\\s*?\\/??>)+/i', "\n", $msg), 'pname' => $pname);
     $result->MoveNext();
 }
 //Vulnerability table configs
 $vcols = array(_("Risk"), _("Details"));
 //widths for columns
 $vwidth_array = array(20, 170);
 // 196 total
 $count = 0;
 $oldip = "";
 // iterate through the IP is the results
 foreach ($arrResults as $hostIP_ctx => $scanData) {
     list($hostIP, $hostctx) = explode("#", $hostIP_ctx);
     $host_id = key(Asset_host::get_id_by_ips($dbconn, $hostIP, $hostctx));
     if (valid_hex32($host_id)) {
         $hostname = Asset_host::get_name_by_id($dbconn, $host_id);
     } else {
         $hostname = _('unknown');
     }
     $hostIP = htmlspecialchars_decode($hostIP);
     $hostname = htmlspecialchars_decode($hostname);
     $pdf->SetLink(${"IP_" . $hostIP_ctx}, $pdf->GetY());
     //print out the host cell
     $pdf->SetFillColor(229, 229, 229);
     $pdf->SetFont('', 'B', 10);
     $pdf->Cell(95, 6, $hostIP, 1, 0, 'C', 1);
     $pdf->Cell(95, 6, $hostname, 1, 0, 'C', 1);
     //$pdf->Cell(105, 6, "",1,0,'C');
     $pdf->SetFont('', '');
     $pdf->Ln();
     // now iterate through the scan results for this IP
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:respdf.php


示例8: preg_match

    $negated_op = preg_match('/^\\!/', $_GET["search_str"]) ? '!' : '';
    $_GET["search_str"] = Util::htmlentities(preg_replace("/[^0-9A-Za-z\\!\\-\\_\\.]/", "", $_GET["search_str"]));
    // htmlentities for fortify test
    $_ips_aux = Asset_host::get_ips_by_name($conn_aux, $_GET["search_str"]);
    $_GET["search_str"] = $negated_op . implode(" OR {$negated_op}", array_keys($_ips_aux));
}
// Conversion: Searching by IP, but Host selected
if ($_GET["search_str"] != "" && in_array($_GET["submit"], $host_submit) && preg_match("/^\\!?\\d+\\.\\d+\\.\\d+\\.\\d+\$/", $_GET["search_str"])) {
    $_GET['submit'] = str_replace(" Host", " IP", $_GET['submit']);
}
// Hostname
if ($_GET["search_str"] != "" && in_array($_GET["submit"], $host_submit) && !preg_match("/\\d+\\.\\d+\\.\\d+\\.\\d+/", $_GET["search_str"])) {
    $negated_op = preg_match('/^\\!/', $_GET["search_str"]) ? 'NOT IN' : 'IN';
    $_GET["search_str"] = Util::htmlentities(preg_replace("/[^0-9A-Za-z\\!\\-\\_\\.]/", "", $_GET["search_str"]));
    // htmlentities for fortify test
    $hids = Asset_host::get_id_by_name($conn_aux, $_GET["search_str"]);
    $htype = $_GET["submit"] == _("Src or Dst Host") ? "both" : ($_GET["submit"] == _("Src Host") ? "src" : "dst");
    $_SESSION["hostid"] = array(array_shift(array_keys($hids)), $_GET["search_str"], $htype, $negated_op);
    unset($_GET["search_str"]);
}
$db_aux->close();
if ($_SESSION['view_name_changed']) {
    $_GET['custom_view'] = $_SESSION['view_name_changed'];
    $_SESSION['view_name_changed'] = "";
    $_SESSION['norefresh'] = 1;
} else {
    $_SESSION['norefresh'] = "";
}
$custom_view = $_GET['custom_view'];
ossim_valid($custom_view, OSS_NULLABLE, OSS_ALPHA, OSS_SPACE, OSS_PUNC, "Invalid: custom_view");
if (ossim_error()) {
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:vars_session.php


示例9: list_results


//.........这里部分代码省略.........
            echo "s";
        } else {
        }
        echo " " . _("found matching search criteria") . " | ";
        echo " <a href='index.php' alt='" . _("View All Reports") . "'>" . _("View All Reports") . "</a></p>";
    }
    echo "<p>";
    echo $stext;
    echo "</p>";
    echo "</div></td></tr></table>";
    $result = array();
    // get the hosts to display
    $result = $dbconn->GetArray($querys . $queryw . $queryl);
    // main query
    //echo $querys.$queryw.$queryl;
    $delete_ids = array();
    if (count($result) > 0) {
        foreach ($result as $rpt) {
            $delete_ids[] = $dreport_id = $rpt["report_id"];
        }
    }
    $_SESSION["_dreport_ids"] = implode(",", $delete_ids);
    //echo "$querys$queryw$queryl";
    if ($result === false) {
        $errMsg[] = _("Error getting results") . ": " . $dbconn->ErrorMsg();
        $error++;
        dispSQLError($errMsg, $error);
    } else {
        $data['vInfo'] = 0;
        $data['vLow'] = 0;
        $data['vMed'] = 0;
        $data['vHigh'] = 0;
        $data['vSerious'] = 0;
        $perms_where = Asset_host::get_perms_where('host.', TRUE);
        if (!empty($perms_where)) {
            $queryt = "SELECT count(lr.result_id) AS total, lr.risk, lr.hostIP, HEX(lr.ctx) AS ctx\n                        FROM vuln_nessus_latest_results lr, host, host_ip hi\n                        WHERE host.id=hi.host_id AND inet6_ntoa(hi.ip)=lr.hostIP {$perms_where} AND falsepositive='N'\n                        GROUP BY risk, hostIP, ctx";
        } else {
            $queryt = "SELECT count(lr.result_id) AS total, risk, lr.hostIP, HEX(lr.ctx) AS ctx\n                        FROM vuln_nessus_latest_results lr\n                        WHERE falsepositive='N'\n                        GROUP BY risk, hostIP, ctx";
        }
        //echo "$queryt<br>";
        $resultt = $dbconn->Execute($queryt);
        while (!$resultt->EOF) {
            $riskcount = $resultt->fields['total'];
            $risk = $resultt->fields['risk'];
            if ($risk == 7) {
                $data['vInfo'] += $riskcount;
            } else {
                if ($risk == 6) {
                    $data['vLow'] += $riskcount;
                } else {
                    if ($risk == 3) {
                        $data['vMed'] += $riskcount;
                    } else {
                        if ($risk == 2) {
                            $data['vHigh'] += $riskcount;
                        } else {
                            if ($risk == 1) {
                                $data['vSerious'] += $riskcount;
                            }
                        }
                    }
                }
            }
            $resultt->MoveNext();
        }
        if ($data['vInfo'] == 0 && $data['vLow'] == 0 && $data['vMed'] == 0 && $data['vHigh'] == 0 && $data['vSerious'] == 0) {
开发者ID:jackpf,项目名称:ossim-arc,代码行数:67,代码来源:index.php


示例10: elseif

     $ctx_src = $src_host->get_ctx();
 }
 // Src icon and bold
 $src_output = Asset_host::get_extended_name($conn, $geoloc, $s_src_ip, $ctx_src, $event_info["src_host"], $event_info["src_net"]);
 $homelan_src = $src_output['is_internal'];
 $src_img = $src_output['html_icon'];
 // Dst
 if ($no_resolv || !$dst_host) {
     $s_dst_name = $s_dst_ip;
     $ctx_dst = $ctx;
 } elseif ($dst_host) {
     $s_dst_name = $dst_host->get_name();
     $ctx_dst = $dst_host->get_ctx();
 }
 // Dst icon and bold
 $dst_output = Asset_host::get_extended_name($conn, $geoloc, $s_dst_ip, $ctx_dst, $event_info["dst_host"], $event_info["dst_net"]);
 $homelan_dst = $dst_output['is_internal'];
 $dst_img = $dst_output['html_icon'];
 // Clean icon hover tiptip
 $s_src_link = Menu::get_menu_url("../forensics/base_stat_ipaddr.php?clear_allcriteria=1&ip={$s_src_ip}", 'analysis', 'security_events', 'security_events');
 $s_dst_link = Menu::get_menu_url("../forensics/base_stat_ipaddr.php?clear_allcriteria=1&ip={$s_dst_ip}", 'analysis', 'security_events', 'security_events');
 $s_src_port = $s_src_port != 0 ? ":" . Port::port2service($conn, $s_src_port) : "";
 $s_dst_port = $s_dst_port != 0 ? ":" . Port::port2service($conn, $s_dst_port) : "";
 // Reputation info
 $rep_src_icon = Reputation::getrepimg($event_info["rep_prio_src"], $event_info["rep_rel_src"], $event_info["rep_act_src"], $s_src_ip);
 //$rep_src_bgcolor  = Reputation::getrepbgcolor($event_info["rep_prio_src"]);
 $rep_dst_icon = Reputation::getrepimg($event_info["rep_prio_dst"], $event_info["rep_rel_dst"], $event_info["rep_act_dst"], $s_dst_ip);
 //$rep_dst_bgcolor  = Reputation::getrepbgcolor($event_info["rep_prio_dst"]);
 $c_src_homelan = $homelan_src ? 'bold alarm_netlookup' : '';
 $source_link = $src_img . " <a href='{$s_src_link}' class='{$c_src_homelan}' data-title='{$s_src_ip}-{$ctx_src}' title='{$s_src_ip}'>" . $s_src_name . $s_src_port . "</a> {$rep_src_icon}";
 $source_balloon = "<div id='" . $s_src_ip . ";" . $s_src_name . ";" . $event_info["src_host"] . "' ctx='{$ctx}' id2='" . $s_src_ip . ";" . $s_dst_ip . "' class='HostReportMenu'>";
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:alarm_group_response.php


示例11: strtolower

            $me = NULL;
        }
        $_country_aux = $geoloc->get_country_by_host($conn, $user->get_ip());
        $s_country = strtolower($_country_aux[0]);
        $s_country_name = $_country_aux[1];
        $geo_code = get_country($s_country);
        $flag = !empty($geo_code) ? "<img src='" . $geo_code . "' border='0' align='top'/>" : '';
        $logon_date = gmdate('Y-m-d H:i:s', Util::get_utc_unixtime($user->get_logon_date()) + 3600 * Util::get_timezone());
        $activity_date = Util::get_utc_unixtime($user->get_activity());
        $background = Session_activity::is_expired($activity_date) ? 'background:#FFD8D6;' : '';
        $expired = Session_activity::is_expired($activity_date) ? "<span style='color:red'>(" . _('Expired') . ")</span>" : "";
        $agent = explode('###', $user->get_agent());
        if ($agent[1] == 'av report scheduler') {
            $agent = array('AV Report Scheduler', 'wget');
        }
        $host = @array_shift(Asset_host::get_name_by_ip($conn, $user->get_ip()));
        $host = $host == '' ? $user->get_ip() : $host;
        echo "  <tr id='" . $user->get_id() . "'>\n\t\t\t\t\t\t\t\t\t<td class='ops_user' {$me}><img class='user_icon' src='" . get_user_icon($user->get_login(), $pro) . "' alt='" . _('User icon') . "' title='" . _('User icon') . "' align='absmiddle'/> " . $user->get_login() . "</td>\n\t\t\t\t\t\t\t\t\t<td class='ops_ip'>" . $user->get_ip() . "</td>\n\t\t\t\t\t\t\t\t\t<td class='ops_host'>" . $host . $flag . "</td>\n\t\t\t\t\t\t\t\t\t<td class='ops_agent'><a title='" . htmlentities($agent[1]) . "' class='info_agent'>" . htmlentities($agent[0]) . "</a></td>\n\t\t\t\t\t\t\t\t\t<td class='ops_id'>" . $user->get_id() . " {$expired}</td>\n\t\t\t\t\t\t\t\t\t<td class='ops_logon'>" . $logon_date . "</td>\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<td class='ops_activity'>" . _(TimeAgo($activity_date, gmdate('U'))) . "</td>\n\t\t\t\t\t\t\t\t\t<td class='ops_actions'>{$action}</td>\t\n\t\t\t\t\t\t\t\t</tr>";
    }
}
?>
    			</tbody>
    		</table>
		</div>				
    </div>
    
    </body>
</html>

<?php 
$db->close();
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:opened_sessions.php


示例12: POST

$sensor_id = POST('sensor_id');
$asset_id = POST('asset_id');
$agent_id = POST('agent_id');
$validate = array('sensor_id' => array('validation' => "OSS_HEX", 'e_message' => 'illegal:' . _('Sensor ID')), 'asset_id' => array('validation' => "OSS_HEX", 'e_message' => 'illegal:' . _('Asset ID')), 'agent_id' => array('validation' => 'OSS_DIGIT', 'e_message' => 'illegal:' . _('Agent ID')));
$validation_errors = validate_form_fields('POST', $validate);
//Database connection
$db = new ossim_db();
$conn = $db->connect();
if (empty($validation_errors)) {
    //Extra validations
    try {
        if (Asset_host::is_in_db($conn, $asset_id) == FALSE) {
            $e_msg = _('Unable to deploy HIDS agent. This asset no longer exists in the asset inventory. Please check with your system admin for more information');
            Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
        }
        $asset = new Asset_host($conn, $asset_id);
        $asset->load_from_db($conn);
        //Check asset context
        $ext_ctxs = Session::get_external_ctxs($conn);
        $ctx = $asset->get_ctx();
        if (!empty($ext_ctxs[$ctx])) {
            $e_msg = _('Asset can only be deployed at this USM');
            //Server related to CTX
            $server_obj = Server::get_server_by_ctx($conn, $ctx);
            if ($server_obj) {
                $s_name = $server_obj->get_name();
                $s_ip = $server_obj->get_ip();
                $server = $s_name . ' (' . $s_ip . ')';
                $e_msg = sprintf(_("Unable to deploy agent to assets on a child server. Please login to %s to deploy the HIDS agents"), $server);
            }
            Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:a_deployment_form.php


示例13: while

            exit;
        }
        while (!$rs->EOF) {
            $ip = $rs->fields['ip'];
            $ctx = $rs->fields['ctx'];
            $ids = Asset_host::get_id_by_ips($conn_aux, $ip, $ctx);
            if (empty($hosts_in_db[$ip][$ctx]) && empty($ids)) {
                if ($mode == 'insert') {
                    try {
                        $id = Util::uuid();
                        $hostname = Asset_host::get_autodetected_name($ip);
                        $ips = array();
                        $ips[$ip] = array('ip' => $ip, 'mac' => NULL);
                        $sensors = array($rs->fields['sensor_id']);
                        $conn_aux = $db->connect();
                        $host = new Asset_host($conn_aux, $id);
                        Util::disable_perm_triggers($conn_aux, TRUE);
                        $host->set_name($hostname);
                        $host->set_ctx($ctx);
                        $host->set_ips($ips);
                        $host->set_sensors($sensors);
                        $host->save_in_db($conn_aux, FALSE);
                        $hosts_in_db[$ip][$ctx] = $ip;
                        ?>
                        <script type="text/javascript">                                          
                             parent.$("#ptext").html("<?php 
                        echo _('Inserting new host') . ' <strong>' . $hostname . '</strong>';
                        ?>
");
                        </script>                                  
                        <?php 
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:import_all_hosts_from_siem_ajax.php


示例14: GET

Session::logcheck("analysis-menu", "ControlPanelAlarms");
$h_id = GET('id');
$h_ip = GET('ip');
$prefix = GET('prefix');
ossim_valid($h_id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _("Asset ID"));
ossim_valid($h_ip, OSS_IP_ADDR_0, OSS_NULLABLE, 'illegal:' . _("Ip"));
ossim_valid($prefix, 'src', 'dst', 'illegal:' . _("Prefix"));
if (ossim_error()) {
    die(ossim_error());
}
$gloc = new Geolocation('/usr/share/geoip/GeoLiteCity.dat');
$data = $_SESSION['_alarm_stats'][$prefix];
/* connect to db */
$db = new ossim_db(TRUE);
$conn = $db->connect();
$h_obj = Asset_host::get_object($conn, $h_id, TRUE);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title><?php 
echo gettext("OSSIM Framework");
?>
</title>
	
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
	<meta http-equiv="Pragma" content="no-cache"/>
	
	<link rel="stylesheet" type="text/css" href="/ossim/style/av_common.css?t=<?php 
echo Util::get_css_id();
?>
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:host_info.php


示例15: POST

require_once 'av_init.php';
Session::logcheck_ajax('environment-menu', 'PolicyHosts');
//Validate Form token
$token = POST('token');
if (Token::verify('tk_delete_asset_bulk', $token) == FALSE) {
    $error = Token::create_error_message();
    Util::response_bad_request($error);
}
session_write_close();
/* connect to db */
$db = new ossim_db(TRUE);
$conn = $db->connect();
try {
    $perm_add = Session::can_i_create_assets();
    if (!$perm_add) {
        $db->close();
        $error = _('You do not have the correct permissions to delete assets. Please contact system administrator with any questions');
        Util::response_bad_request($error);
    }
    $app_name = Session::is_pro() ? 'AlienVault' : 'OSSIM';
    $num_assets = Filter_list::get_total_selection($conn, 'asset');
    //Delete all filtered asset
    Asset_host::bulk_delete($conn);
    $data['status'] = 'OK';
    $data['data'] = sprintf(_('%s assets have been permanently deleted from %s'), $num_assets, $app_name);
} catch (Exception $e) {
    $db->close();
    Util::response_bad_request($e->getMessage());
}
$db->close();
echo json_encode($data);
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:bk_delete.php


示例16: set_time_limit

if (isset($_GET['get_data'])) {
    //Setting up a high time limit.
    set_time_limit(360);
    $db = new ossim_db();
    $conn = $db->connect();
    //Setting up the file name with the hosts info
    $file = uniqid('/tmp/export_all_host_' . date('Ymd_H-i-s') . '_');
    $_SESSION['_csv_file_hosts'] = $file;
    session_write_close();
    $csv = array();
    //Export a filtered list
    $filters = array();
    $session = session_id();
    $tables = ', user_component_filter hc';
    $filters = array('where' => "hc.asset_id=host.id AND hc.asset_type='asset' AND hc.session_id = '{$session}'", 'order_by' => 'host.hostname ASC');
    $_host_list = Asset_host::get_list($conn, $tables, $filters);
    foreach ($_host_list[0] as $host) {
        $id = $host['id'];
        //Description
        $descr = $host['descr'];
        $descr = mb_convert_encoding($descr, 'UTF-8', 'HTML-ENTITIES');
        //Operating System
        $os = Asset_host_properties::get_property_from_db($conn, $host['id'], 3);
        $os = array_pop($os);
        //Latitude/Longitude
        $latitude = empty($host['location']['lat']) ? '' : $host['location']['lat'];
        $longitude = empty($host['location']['lon']) ? '' : $host['location']['lon'];
        //Devices
        $str_devices = '';
        $devices = Asset_host_devices::get_devices_to_string($conn, $id);
        if (!empty($devices)) {
开发者ID:alienfault,项目名称:ossim,代码行数:31,代码来源:export_all_assets.php


示例17: _

															<table align="center" class="noborder">
															<tr>
																<th style="background-position:top center"><?php 
echo _("Destination");
?>
																</th>
																<td class="left nobborder">
																	<select id="toselect" name="toselect[]" size="12" multiple="multiple" style="width:150px">
																	<?php 
if ($rule->to != "ANY" && $rule->to != "" && !preg_match("/\\:...\\_IP/", $rule->to)) {
    $pre_list = explode(",", $rule->to);
    foreach ($pre_list as $list_element) {
        // Asset ID: Resolve by name
        if (preg_match("/(\\!)?([0-9A-Fa-f\\-]{36})/", $list_element, $found)) {
            $uuid_aux = str_replace("-", "", strtoupper($found[2]));
            $h_obj = Asset_host::get_object($conn, $uuid_aux);
            if ($h_obj != null) {
                echo "<option value='" . $found[1] . $found[2] . "'>" . $found[1] . $h_obj->get_name() . " (" . $h_obj->get_ips()->get_ips('string') . ")</option>\n";
            } else {
                $n_obj = Asset_net::get_object($conn, $uuid_aux);
                if ($n_obj != null) {
                    echo "<option value='" . $found[1] . $found[2] . "'>" . $found[1] . $n_obj->get_name() . " (" . $n_obj->get_ips() . ")</option>\n";
                }
            }
            // Another one (HOME_NET, 12.12.12.12...)
        } else {
            echo "<option value='{$list_element}'>{$list_element}</option>\n";
        }
    }
}
?>
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:form_network.php


示例18: foreach

     foreach ($source_net_list as $source_net_group) {
         if (!check_any($source_net_group->get_net_group_id())) {
             $source .= ($source == "" ? "" : "<br/>") . "<img src='../pixmaps/theme/net_group.png' align=absbottom /> " . Net_group::get_name_by_id($conn, $source_net_group->get_net_group_id());
         }
     }
 }
 if (empty($source)) {
     $source = "<img src='../pixmaps/theme/host.png' align=absbottom />" . _('ANY');
 }
 $xml .= "<cell><![CDATA[" . $source . "]]></cell>";
 //
 $dest = "";
 if ($dest_host_list = $policy->get_hosts($conn, 'dest')) {
     foreach ($dest_host_list as $dest_host) {
         if (!check_any($dest_host->get_host_id())) {
             $dest .= ($dest == "" ? "" : "<br/>") . "<img src='../pixmaps/theme/host.png' align=absbottom /> " . Asset_host::get_name_by_id($conn, $dest_host->get_host_id());
         }
     }
 }
 if ($dest_net_list = $policy->get_nets($conn, 'dest')) {
     foreach ($dest_net_list as $dest_net) {
         if (!check_any($dest_net->get_net_id())) {
             $dest .= ($dest == "" ? "" : "<br/>") . "<img src='../pixmaps/theme/net.png' align=absbottom /> " . Asset_net::get_name_by_id($conn, $dest_net->get_net_id());
         }
     }
 }
 if ($dest_host_list = $policy->get_host_groups($conn, 'dest')) {
     foreach ($dest_host_list as $dest_host_group) {
         if (!check_any($dest_host_group->get_host_group_id())) {
             $dest .= ($dest == "" ? "" : "<br/>") . "<img src='../pixmaps/theme/host_group.png' align=absbottom /> " . Asset_group::get_name_by_id($conn, $dest_host_group->get_host_group_id());
         }
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:getpolicy.php


示例19: preg_match

$selected = "";
// src_ips from acid_event
$where = Security_report::make_where($conn, $date_from, $date_to, $plugin_list, $dDB);
$ejoin = preg_match('/plist_[a-z]+/', $where) ? preg_replace('/.*(plist_[a-z]+)\\.id .*/', ',\\1', $where) : '';
$query = "SELECT DISTINCT ip_src AS ip FROM alienvault_siem.acid_event {$ejoin} WHERE 1=1 {$where}\n    UNION SELECT DISTINCT ip_dst as ip FROM alienvault_siem.acid_event {$ejoin} WHERE 1=1 {$where}";
$rs = $conn->Execute($query);
if (!$rs) {
    Av_exception::throw_error(Av_exception::DB_ERROR, $conn->ErrorMsg());
}
$already = array();
while (!$rs->EOF) {
    $ip = inet_ntop($rs->fields['ip']);
    if (!isset($already[$ip])) {
        //Session::hostAllowed($conn,$ip) => not necessary here?
        $already[$ip]++;
        if (!Asset_host::is_ip_in_cache_cidr($conn, $ip)) {
            // geoip
            $_country_aux = $geoloc->get_country_by_host($conn, $ip);
            $s_country = strtolower($_country_aux[0]);
            $s_country_name = $_country_aux[1];
            if ($s_country == '') {
                $ips[':Unknown']++;
            } else {
                $ips["{$s_country}:{$s_country_name}"]++;
            }
        }
    }
    $rs->MoveNext();
}
//
arsort($ips);
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:Geographic.php


示例20: array_keys

         $sensors = array_keys(Asset_host_sensors::get_sensors_by_id($conn, $host_id));
     }
 } else {
     if (preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2}?\$/", $ip_cidr)) {
         // Net without ID
         $total_host += Util::host_in_net($ip_cidr);
         $name = $target;
         $perm = TRUE;
     } else {
         if (preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\$/", $ip_cidr)) {
             // Host without ID
             $total_host++;
             $name = $target;
             $perm = TRUE;
             if (count($sensors) == 0) {
                 $closetnet_id = key(Asset_host::get_closest_net($conn, $ip_cidr));
                 $sensors = array_keys(Asset_net_sensors::get_sensors_by_id($conn, $closetnet_id));
             }
         } else {
             if ($unresolved) {
                 // the target is a hostname
                 $total_host++;
                 $perm = true;
                 $name = '-';
                 if (count($sensors) == 0) {
                     $sensors = $ids;
                 }
             }
         }
     }
 }
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:simulate.php



注:本文中的Asset_host类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Assets类代码示例发布时间:2022-05-23
下一篇:
PHP AssetModel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap