当前位置: 首页>>代码示例>>PHP>>正文


PHP Asset_host::get_name_by_id方法代码示例

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


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

示例1: get_targets

function get_targets($conn, $ip_list)
{
    $result = array();
    if (!empty($ip_list)) {
        if (is_array($ip_list) == FALSE) {
            $ip_list = explode("\n", trim($ip_list));
        }
        foreach ($ip_list as $asset) {
            $asset = trim($asset);
            if (preg_match('/^([a-f\\d]{32})#(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2})$/i', $asset, $found)) {
                $_asset_name = Asset_net::is_in_db($conn, $found[1]) ? Asset_net::get_name_by_id($conn, $found[1]) : $found[2];
                $result[$asset] = $_asset_name;
            } else {
                if (preg_match('/^([a-f\\d]{32})#(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})$/i', $asset, $found)) {
                    $_asset_name = Asset_host::is_in_db($conn, $found[1]) ? Asset_host::get_name_by_id($conn, $found[1]) : $found[2];
                    $result[$asset] = $_asset_name;
                } else {
                    if (preg_match('/^([a-f\\d]{32})#hostgroup$/i', $asset, $found)) {
                        $result[$asset] = Asset_group::get_name_by_id($conn, $found[1]);
                    } else {
                        if (preg_match('/^([a-f\\d]{32})#netgroup$/i', $asset, $found)) {
                            $result[$asset] = Net_group::get_name_by_id($conn, $found[1]);
                        } else {
                            $result[$asset] = $asset;
                        }
                    }
                }
            }
        }
    }
    return $result;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:32,代码来源:new_scan.php

示例2: 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

示例3: main_page


//.........这里部分代码省略.........
   <table style='margin-top:20px;' class='w100 transparent'><tr><td class='sec_title'>{$schedulejobs}</td></tr></table>
   <table summary="Job Schedules" class='w100 table_list'>
EOT;
    if ($sortdir == "ASC") {
        $sortdir = "DESC";
    } else {
        $sortdir = "ASC";
    }
    $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;
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:67,代码来源:manage_jobs.php

示例4: list_results


//.........这里部分代码省略.........
            $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) {
            $tdata[] = array("report_id" => "All", "host_name" => "", "scantime" => "", "username" => "", "scantype" => "", "report_key" => "", "report_type" => "", "sid" => "", "profile" => "", "hlink" => "", "plink" => "", "xlink" => "", "vSerious" => $data['vSerious'], "vHigh" => $data['vHigh'], "vMed" => $data['vMed'], "vLow" => $data['vLow'], "vInfo" => $data['vInfo']);
        } else {
            $tdata[] = array("report_id" => "All", "host_name" => "", "scantime" => "", "username" => "", "scantype" => "", "report_key" => "", "report_type" => "", "sid" => "", "profile" => "", "hlink" => "lr_reshtml.php?ipl=all&disp=html&output=full&scantype=M", "plink" => "lr_respdf.php?ipl=all&scantype=M", "xlink" => "lr_rescsv.php?ipl=all&scantype=M", "dlink" => "", "vSerious" => $data['vSerious'], "vHigh" => $data['vHigh'], "vMed" => $data['vMed'], "vLow" => $data['vLow'], "vInfo" => $data['vInfo']);
        }
        foreach ($result as $data) {
            if (!Session::hostAllowed_by_ip_ctx($dbconn, $data["hostIP"], $data["ctx"])) {
                continue;
            }
            $host_id = key(Asset_host::get_id_by_ips($dbconn, $data["hostIP"], $data["ctx"]));
            if (valid_hex32($host_id)) {
                $data['host_name'] = Asset_host::get_name_by_id($dbconn, $host_id);
            }
            $data['vSerious'] = 0;
            $data['vHigh'] = 0;
            $data['vMed'] = 0;
            $data['vLow'] = 0;
            $data['vInfo'] = 0;
            // query for reports for each IP
            $query_risk = "SELECT distinct risk, port, protocol, app, scriptid, msg, hostIP FROM vuln_nessus_latest_results WHERE hostIP = '" . $data['hostIP'];
            $query_risk .= "' AND username = '" . $data['username'] . "' AND sid =" . $data['sid'] . " AND ctx = UNHEX('" . $data['ctx'] . "') AND falsepositive='N'";
            $result_risk = $dbconn->Execute($query_risk);
            while (!$result_risk->EOF) {
                if ($result_risk->fields["risk"] == 7) {
                    $data['vInfo']++;
                } else {
                    if ($result_risk->fields["risk"] == 6) {
                        $data['vLow']++;
                    } else {
                        if ($result_risk->fields["risk"] == 3) {
                            $data['vMed']++;
                        } else {
                            if ($result_risk->fields["risk"] == 2) {
                                $data['vHigh']++;
                            } else {
                                if ($result_risk->fields["risk"] == 1) {
                                    $data['vSerious']++;
                                }
                            }
                        }
                    }
                }
                $result_risk->MoveNext();
            }
开发者ID:jackpf,项目名称:ossim-arc,代码行数:67,代码来源:index.php

示例5: ossim_get_error_clean

        }
    } else {
        $e_msg = ossim_get_error_clean();
        Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
    }
    $agents = Ossec_agent::get_list($sensor_id);
    $data = array();
    if (is_array($agents) && !empty($agents)) {
        foreach ($agents as $agent_id => $a_data) {
            if (empty($a_data)) {
                continue;
            }
            $a_unique_id = md5($agent_id);
            $agent_actions = Ossec_agent::get_actions($agent_id, $a_data);
            if (!empty($a_data['host_id'])) {
                $asset_name = Asset_host::get_name_by_id($conn, $a_data['host_id']);
            } else {
                $asset_name = '-';
            }
            //Normalize status description (See asset list filters)
            if ($a_data['status']['id'] == 1) {
                $a_data['status']['descr'] = 'Disconnected';
            }
            $t_data = array("DT_RowId" => 'cont_agent_' . $agent_id, "DT_RowData" => array('agent_key' => $a_unique_id, 'asset_id' => $a_data['host_id'], 'agent_status' => $a_data['status']), '', $agent_id, $a_data['name'], $asset_name, $a_data['ip_cidr'], "-", "-", $a_data['status']['descr'], $agent_actions);
            $data[] = $t_data;
        }
    }
} catch (Exception $e) {
    $db->close();
    Util::response_bad_request($e->getMessage());
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:dt_agents.php

示例6: 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

示例7: array

} else {
    $list = $security_report->AttackHost($target, $limit, $type, $date_from, $date_to);
}
$datax = $datay = array();
$gorientation = "h";
foreach ($list as $key => $l) {
    if ($key >= 10) {
        // ponemos un límite de resultados para la gráfica
        //break;
        $gorientation = "v";
    }
    $ip = $l[0];
    $occurrences = number_format($l[1], 0, ",", ".");
    $id = $l[2];
    $ctx = $l[3];
    $hostname = valid_hex32($id) ? Asset_host::get_name_by_id($security_report->ossim_conn, $id) : $ip;
    $datax[] = $hostname ? $hostname : $ip;
    $datay[] = $l[1];
}
require_once 'ossim_conf.inc';
$conf = $GLOBALS["CONF"];
$jpgraph = $conf->get_conf("jpgraph_path");
require_once "{$jpgraph}/jpgraph.php";
require_once "{$jpgraph}/jpgraph_bar.php";
// Setup the graph.
if ($gorientation == "v") {
    $y = 30 + count($list) * 21;
} else {
    $y = 250;
}
$graph = new Graph(400, $y, "auto");
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:attack_graph.php

示例8: origdetails

function origdetails()
{
    global $uroles, $user, $sid, $query_risk, $border, $report_id, $scantime, $scantype, $fp, $nfp, $filterip, $enableFP, $enableNotes, $output, $sortby, $dbconn, $arruser;
    global $treport, $ipl, $query_byuser, $ips_inrange, $ctx, $key;
    $colors = array("Serious" => "#FFCDFF", "High" => "#FFDBDB", "Medium" => "#FFF283", "Low" => "#FFFFC0", "Info" => "#FFFFE3");
    $images = array("Serious" => "./images/risk1.gif", "High" => "./images/risk2.gif", "Medium" => "./images/risk3.gif", "Low" => "./images/risk6.gif", "Info" => "./images/risk7.gif");
    $levels = array("Serious" => "1", "High" => "2", "Medium" => "3", "Low" => "6", "Info" => "7");
    $query_host = '';
    if ($filterip) {
        $query_host = " AND hostip='{$filterip}'";
    }
    echo "<center>";
    echo "<form>";
    echo "<table width=\"900\" class=\"noborder\" style=\"background:transparent;\">";
    echo "<tr><td style=\"text-align:left;\" class=\"nobborder\">";
    echo "<input id=\"checkboxFP\" type=\"checkbox\" onclick=\"showFalsePositives()\"> <span style=\"color:black\">" . _("View false positives") . "</span>";
    echo "</td><td class=\"nobborder\" style=\"text-align:center;\">";
    // print the icon legend
    if ($enableFP) {
        echo "<img alt='True' src='images/true.gif' border=0 align='absmiddle'> - " . _("True result") . "&nbsp;&nbsp;";
        echo "<img alt='False' src='images/false.png' border=0 align='absmiddle'> - " . _("False positive result") . "&nbsp;&nbsp;";
    }
    $feed = exists_feed_tables($dbconn);
    echo "<img alt='Info' src='images/info.png' border=0 align='absmiddle'> - " . _("Additional information is available");
    echo "</td></tr></table>";
    echo "</form>";
    echo "<br>";
    $perms_where = Session::get_ctx_where() != "" ? " AND res.ctx in (" . Session::get_ctx_where() . ")" : "";
    if ($ipl == "all") {
        $query = "select distinct res.hostIP, HEX(res.ctx) as ctx\n                    from vuln_nessus_latest_results res\n                    where falsepositive='N' \n                    {$perms_where}\n                    {$query_byuser}";
    } else {
        if (!empty($ipl) && !empty($ctx)) {
            $query = "select distinct res.hostIP, HEX(res.ctx) as ctx\n                    from vuln_nessus_latest_results res\n                    where falsepositive='N' \n                    and res.hostIP='{$ipl}'\n                    and res.ctx=UNHEX('{$ctx}')\n                    {$perms_where}\n                    {$query_byuser}";
        } else {
            if (!empty($scantime) && !empty($key)) {
                $query = "select distinct res.hostIP, HEX(res.ctx) as ctx\n                    from vuln_nessus_latest_results res, vuln_nessus_latest_reports rep\n                    where res.falsepositive='N'\n                    and res.scantime='{$scantime}' \n                    and res.hostIP=rep.hostIP\n                    and res.ctx=rep.ctx\n                    and res.username=rep.username\n                    and res.sid=rep.sid\n                    {$perms_where}\n                    and rep.report_key='{$key}' {$query_byuser}";
            }
        }
    }
    $resultp = $dbconn->execute($query);
    $host_range = array_keys($ips_inrange);
    while (list($hostip, $hostctx) = $resultp->fields) {
        $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');
        }
        if (in_array($hostip . ";" . $hostctx, $host_range)) {
            echo "<div class='hostip'>";
            echo "<br><font color='red'><b><a name='{$hostip};{$hostctx}' href='javascript:;' ctx='{$hostctx}' id='{$hostip};{$hostname}' class='HostReportMenu'>{$hostip} - {$hostname}</a></b></font>";
            echo "<br><br><table summary=\"{$hostip} - " . _("Reported Ports") . "\">";
            echo "<tr><th colspan=2>" . _("Reported Ports") . "</th></tr>";
            if (!empty($scantime) && !empty($key)) {
                $query = "select distinct res.port, res.protocol\n                from vuln_nessus_latest_results res, vuln_nessus_latest_reports rep\n                where res.falsepositive='N'\n                and res.scantime='{$scantime}' \n                and res.hostIP=rep.hostIP\n                and res.ctx=rep.ctx\n                and res.username=rep.username\n                and res.sid=rep.sid\n                and res.hostIP='{$hostip}'\n                and res.ctx='{$hostctx}'\n                and rep.report_key='{$key}' {$query_byuser}) as t group by risk";
            } else {
                $query = "select distinct res.port, res.protocol\n                            from vuln_nessus_latest_results res \n                            where hostip='{$hostip}' and ctx=UNHEX('{$hostctx}') {$query_byuser} AND port > '0' ORDER BY port ASC";
            }
            $result1 = $dbconn->execute($query);
            $k = 1;
            $pos = '';
            if (!$result1->fields) {
                print "<tr><td>" . _("No reported ports found") . "</td></tr>";
            } else {
                while (list($port, $proto) = $result1->fields) {
                    if ($k % 2) {
                        echo "<tr><td>{$port}/{$proto}</td>";
                        $pos = "open";
                    } else {
                        echo "<td>{$port}/{$proto}</td></tr>";
                        $pos = "closed";
                    }
                    $k++;
                    $result1->MoveNext();
                }
                // end while
                // close up the table
                if ($pos != "closed") {
                    echo "<td>&nbsp;</td></tr>";
                }
            }
            echo "</table><br/>";
            echo "<table width='900' summary='{$hostip} - risks'><tr>";
            echo "<th>" . _("Vuln Name") . "</th>";
            echo "<th>" . _("VulnID") . "</th>";
            echo "<th>" . _("Service") . "</th>";
            echo "<th>" . _("Severity") . "</th>";
            echo "</tr>";
            if (!empty($scantime) && !empty($key)) {
                if ($feed) {
                    $query = "select res.result_id, res.service, res.risk, res.falsepositive, res.scriptid, v.name, res.msg, rep.sid\n                        from vuln_nessus_latest_results AS res LEFT JOIN vuln_nessus_plugins AS v ON v.id=res.scriptid, vuln_nessus_latest_reports rep\n                        where res.msg<>''\n                        and res.scantime='{$scantime}' \n                        and res.hostIP=rep.hostIP\n                        and res.ctx=rep.ctx\n                        and res.hostIP='{$hostip}'\n                        and res.ctx=UNHEX('{$hostctx}')\n                        and res.username=rep.username\n                        and res.sid=rep.sid\n                        and rep.report_key='{$key}' and rep.sid>=0 {$query_byuser}\n                        UNION DISTINCT\n                        select res.result_id, res.service, res.risk, res.falsepositive, res.scriptid, v.name, res.msg, rep.sid\n                        from vuln_nessus_latest_results AS res LEFT JOIN vuln_nessus_plugins_feed AS v ON v.id=res.scriptid, vuln_nessus_latest_reports rep\n                        where res.msg<>''\n                        and res.scantime='{$scantime}' \n                        and res.hostIP=rep.hostIP\n                        and res.ctx=rep.ctx\n                        and res.hostIP='{$hostip}'\n                        and res.ctx=UNHEX('{$hostctx}')\n                        and res.username=rep.username\n                        and res.sid=rep.sid\n                        and rep.report_key='{$key}' and rep.sid<0 {$query_byuser}\n                        ";
                } else {
                    $query = "select res.result_id, res.service, res.risk, res.falsepositive, res.scriptid, v.name, res.msg, rep.sid\n                        from vuln_nessus_latest_results AS res LEFT JOIN vuln_nessus_plugins AS v ON v.id=res.scriptid, vuln_nessus_latest_reports rep\n                        where res.msg<>''\n                        and res.scantime='{$scantime}' \n                        and res.hostIP=rep.hostIP\n                        and res.ctx=rep.ctx\n                        and res.hostIP='{$hostip}'\n                        and res.ctx=UNHEX('{$hostctx}')\n                        and res.username=rep.username\n                        and res.sid=rep.sid\n                        and rep.report_key='{$key}' {$query_byuser}";
                }
            } else {
                if ($feed) {
                    $query = "select res.result_id, res.service, res.risk, res.falsepositive, res.scriptid, v.name, res.msg, rep.sid\n                    FROM vuln_nessus_latest_results res LEFT JOIN vuln_nessus_plugins AS v ON v.id=res.scriptid, vuln_nessus_latest_reports rep\n                    WHERE\n                    res.hostIP=rep.hostIP\n                    and res.ctx=rep.ctx\n                    and res.username=rep.username\n                    and res.sid=rep.sid\n                    and res.hostIP='{$hostip}'\n                    and res.ctx=UNHEX('{$hostctx}')\n                    {$query_byuser} and msg<>'' and rep.sid>=0\n                    UNION DISTINCT\n                    select res.result_id, res.service, res.risk, res.falsepositive, res.scriptid, v.name, res.msg, rep.sid\n                    FROM vuln_nessus_latest_results res LEFT JOIN vuln_nessus_plugins_feed AS v ON v.id=res.scriptid, vuln_nessus_latest_reports rep\n                    WHERE\n                    res.hostIP=rep.hostIP\n                    and res.ctx=rep.ctx\n                    and res.username=rep.username\n                    and res.sid=rep.sid\n                    and res.hostIP='{$hostip}'\n                    and res.ctx=UNHEX('{$hostctx}')\n                    {$query_byuser} and msg<>'' and rep.sid<0";
                } else {
                    $query = "select res.result_id, res.service, res.risk, res.falsepositive, res.scriptid, v.name, res.msg, rep.sid\n                    FROM vuln_nessus_latest_results res LEFT JOIN vuln_nessus_plugins AS v ON v.id=res.scriptid, vuln_nessus_latest_reports rep\n                    WHERE\n                    res.hostIP=rep.hostIP\n                    and res.ctx=rep.ctx\n                    and res.username=rep.username\n                    and res.sid=rep.sid\n                    and res.hostIP='{$hostip}'\n                    and res.ctx=UNHEX('{$hostctx}')\n                    {$query_byuser} and msg<>''";
                }
//.........这里部分代码省略.........
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:101,代码来源:lr_reshtml.php

示例9: foreach

     foreach ($source_host_list as $source_host_group) {
         $sources['hostgroup_' . $source_host_group->get_host_group_id()] = check_any($source_host_group->get_host_group_id()) ? _("ANY") : _("HOST_GROUP") . ": " . Asset_group::get_name_by_id($conn, $source_host_group->get_host_group_id());
     }
 }
 if ($source_net_list = $policy->get_net_groups($conn, 'source')) {
     foreach ($source_net_list as $source_net_group) {
         $sources['netgroup_' . $source_net_group->get_net_group_id()] = check_any($source_net_group->get_net_group_id()) ? _("ANY") : _("NETWORK_GROUP") . ": " . Net_group::get_name_by_id($conn, $source_net_group->get_net_group_id());
     }
 }
 //DESTINY
 if ($dest_host_list = $policy->get_hosts($conn, 'dest')) {
     foreach ($dest_host_list as $dest_host) {
         if (check_any($dest_host->get_host_id())) {
             $dests[$dest_host->get_host_id()] = _("ANY");
         } else {
             $dests['host_' . $dest_host->get_host_id()] = _("HOST") . ": " . 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) {
         $dests['net_' . $dest_net->get_net_id()] = check_any($dest_net->get_net_id()) ? _("ANY") : _("NETWORK") . ": " . 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) {
         $dests['hostgroup_' . $dest_host_group->get_host_group_id()] = check_any($dest_host_group->get_host_group_id()) ? _("ANY") : _("HOST_GROUP") . ": " . Asset_group::get_name_by_id($conn, $dest_host_group->get_host_group_id());
     }
 }
 if ($dest_net_list = $policy->get_net_groups($conn, 'dest')) {
     foreach ($dest_net_list as $dest_net_group) {
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:newpolicyform.php

示例10: deploy_agents

function deploy_agents($conn, $wizard)
{
    //Aux variable that is returned
    $data = array();
    //If we have already initialized the deploy, we return true to check the status
    $started = $wizard->get_step_data('deploy_initialized');
    if ($started === TRUE) {
        $response['error'] = FALSE;
        $response['data'] = $data;
        return $response;
    }
    //Retrieving the params
    $os = $wizard->get_step_data('deploy_os');
    $username = $wizard->get_step_data('deploy_username');
    $domain = $wizard->get_step_data('deploy_domain');
    //Getting the array of hosts
    $hosts = $wizard->get_step_data('deploy_hosts');
    $hosts = is_array($hosts) ? $hosts : array();
    //Getting the password and decrypting
    $password = $wizard->get_step_data('deploy_password');
    $password = Util::decrypt($password, Util::get_system_uuid());
    $total_ip = 0;
    //Performing linux deployment --> Agentless
    if ($os == 'linux') {
        $sensor_id = get_sensor_id();
        $deploy = 0;
        //Num of successful deployments --> Initially 0
        //Arguments for the agentless entries
        $arguments = '/etc /usr/bin /usr/sbin /bin /sbin';
        foreach ($hosts as $h) {
            $ips = Asset_host_ips::get_ips_to_string($conn, $h);
            $ips = explode(',', $ips);
            $hostname = Asset_host::get_name_by_id($conn, $h);
            foreach ($ips as $ip) {
                try {
                    //Adding Aggentless
                    Ossec_agentless::save_in_db($conn, $ip, $sensor_id, $hostname, $username, $password, '', FALSE, '');
                    //Adding Aggentless Entries
                    Ossec_agentless::add_monitoring_entry($conn, $ip, $sensor_id, 'ssh_integrity_check_bsd', 3600, 'periodic', $arguments);
                    Ossec_agentless::add_monitoring_entry($conn, $ip, $sensor_id, 'ssh_integrity_check_linux', 3600, 'periodic', $arguments);
                    $deploy++;
                } catch (Exception $e) {
                    Av_exception::write_log(Av_exception::USER_ERROR, $e->getMessage());
                }
                $total_ip++;
            }
        }
        //Saving the number of the successful deployments
        $wizard->set_step_data('deploy_success', $deploy);
    } elseif ($os == 'windows') {
        $jobs = array();
        foreach ($hosts as $h) {
            $ips = Asset_host_ips::get_ips_to_string($conn, $h);
            $ips = explode(',', $ips);
            foreach ($ips as $ip) {
                try {
                    //Adding job to deploy ossec.
                    $name = 'Windows-' . str_replace('.', '-', $ip);
                    $job = Welcome_wizard::launch_ossec_deploy($name, $ip, $username, $domain, $password);
                    $jid = md5($h . $ip);
                    $jobs[$jid] = array('job_id' => $job['job_id'], 'agent' => $name . '(' . $ip . ')');
                } catch (Exception $e) {
                    Av_exception::write_log(Av_exception::USER_ERROR, $e->getMessage());
                }
                $total_ip++;
            }
        }
        //Saving the jobs IDs in the wizard object
        $wizard->set_step_data('deploy_jobs', $jobs);
    }
    $total_ip = $total_ip > count($hosts) ? $total_ip : count($hosts);
    $data['total_ips'] = $total_ip;
    //Setting the total of ips.
    $wizard->set_step_data('deploy_total_ips', $total_ip);
    //Setting to true the flag that warns that the deploy has been already initialized.
    $wizard->set_step_data('deploy_initialized', TRUE);
    //Saving the wizard status
    $wizard->save_status();
    $response['error'] = FALSE;
    $response['data'] = $data;
    return $response;
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:82,代码来源:deploy_ajax.php

示例11: _

						<th>
							<?php 
echo _("Info");
?>
						</th>												
					</tr>
				</thead>
				<tbody>
					<?php 
foreach ($data['ip'] as $ip => $dip) {
    $hostname = '';
    $location = $dip['country'];
    $flag = strtolower($location);
    $uuid = strtoupper(preg_replace('/^0x|NULL/i', '', $dip['uuid']));
    if (!isset($hosts_ids[$uuid])) {
        $_hname = Asset_host::get_name_by_id($conn, $uuid);
        $hosts_ids[$uuid] = $_hname == _('Unknown') ? '' : $_hname;
    }
    $hostname = $hosts_ids[$uuid];
    $hostname = $hostname == '' && $hostname != $ip ? $ip : $hostname . " ({$ip})";
    if (strlen($location) == 2 && $location != $geoloc->get_country_name($location)) {
        $location = $geoloc->get_country_name($location);
    }
    if (file_exists("/usr/share/ossim/www/pixmaps/flags/{$flag}.png")) {
        $flag = "/ossim/pixmaps/flags/{$flag}.png";
    } else {
        // Try to geoloc
        $record = $geoloc->get_location_from_file($ip);
        $flag = strtolower($record->country_code);
        if (!file_exists("/usr/share/ossim/www/pixmaps/flags/{$flag}.png")) {
            $flag = "/ossim/alarm/style/img/unknown.png";
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:ip_info.php

示例12: get_indicator_asset_name

function get_indicator_asset_name($conn, $type, $asset_id)
{
    $name = '';
    switch ($type) {
        case 'host':
            $name = Asset_host::get_name_by_id($conn, $asset_id);
            break;
        case 'net':
            $name = Asset_net::get_name_by_id($conn, $asset_id);
            break;
        case 'hostgroup':
        case 'host_group':
            $name = Asset_group::get_name_by_id($conn, $asset_id);
            break;
        case 'net_group':
        case 'netgroup':
            $name = Net_group::get_name_by_id($conn, $asset_id);
            break;
        case 'sensor':
            $name = Av_sensor::get_name_by_id($conn, $asset_id);
            break;
    }
    $name = empty($name) ? _('Unknown') : $name;
    return $name;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:25,代码来源:riskmaps_functions.php

示例13: md5

    $_aux_agents = Asset_host::get_related_hids_agents($conn, $asset_id, $sensor_id);
    $agent_key = md5(strtoupper($sensor_id) . '#' . $agent_id);
    unset($_aux_agents[$agent_key]);
    if (!empty($_aux_agents)) {
        $validation_errors['asset_id'] = sprintf(_("Unable to connect HIDS agent to '%s'. This asset already has an agent deployed. If you want to deploy a new agent, please review <a class=\"bold_red\" href=\"https://www.alienvault.com/help/redirect/usm/connect_agent\" target=\"_blank\">how to manage agent connections</a> and try again"), Asset_host::get_name_by_id($conn, $asset_id));
    }
    $db->close();
}
if (is_array($validation_errors) && !empty($validation_errors)) {
    $validation_errors['html_errors'] = "<div style='text-align: left;'>" . _('The following errors occurred') . ":</div>\n                                         <div style='padding-left:15px; text-align: left;'>" . implode('<br/>', $validation_errors) . "</div>";
    $data['status'] = 'error';
    $data['data'] = $validation_errors;
} else {
    $data['status'] = 'success';
    $data['data'] = _('Your changes have been saved');
    try {
        Ossec_agent::link_to_asset($sensor_id, $agent_id, $asset_id);
        $db = new ossim_db();
        $conn = $db->connect();
        $agents = Asset_host::get_related_hids_agents($conn, $asset_id, $sensor_id);
        $agent_key = md5(strtoupper($sensor_id) . '#' . $agent_id);
        $agent_info = array('ip_cidr' => $agents[$agent_key]['ip_cidr'], 'host_id' => $asset_id);
        $data['asset'] = array('id' => $asset_id, 'name' => Asset_host::get_name_by_id($conn, $asset_id), 'actions' => Ossec_agent::get_actions($agent_id, $agent_info));
        $db->close();
    } catch (Exception $e) {
        $data['status'] = 'error';
        $data['data'] = _('An unexpected error occurred. Unable to connect asset to HIDS agent. Please try again') . '.<br/><br/>' . sprintf(_('Reason: %s'), $e->getMessage());
    }
}
echo json_encode($data);
exit;
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:link_asset_to_agent.php

示例14: array

     $new_agent = Ossec_agent::create($sensor_id, $agent_name, $ip_cidr, $asset_id);
     //If ossec-remoted is not running, we have to restart Ossec Server
     $ossec_status = Ossec_control::execute_action($sensor_id, 'status');
     if ('UP' !== $ossec_status['general_status']['ossec-remoted']) {
         Ossec_control::execute_action($sensor_id, 'restart');
     }
     if (is_array($new_agent) && !empty($new_agent)) {
         $agent_id = $new_agent['id'];
         $agent_info = array('name' => $new_agent['name'], 'ip_cidr' => $new_agent['ip_cidr'], 'status' => $new_agent['status']);
         $agent_actions = Ossec_agent::get_actions($agent_id, $new_agent);
         $data['data'] = _("HIDS agent has been created. To deploy the agent, please choose one of the options under the 'Actions' column") . "###" . $agent_id . "###";
         $a_unique_id = md5($agent_id);
         if (valid_hex32($new_agent['host_id'])) {
             $db = new Ossim_db();
             $conn = $db->connect();
             $asset_name = Asset_host::get_name_by_id($conn, $new_agent['host_id']);
             $db->close();
         } else {
             $asset_name = '-';
         }
         //Normalize status description (See asset list filters)
         if ($new_agent['status']['id'] == 1) {
             $new_agent['status']['descr'] = 'Disconnected';
         }
         $agent_elem = array("DT_RowId" => 'cont_agent_' . $agent_id, "DT_RowData" => array('agent_key' => $a_unique_id, 'asset_id' => $new_agent['host_id'], 'agent_status' => $new_agent['status']), '', $agent_id, $new_agent['name'], $asset_name, $new_agent['ip_cidr'], "-", "-", $new_agent['status']['descr'], $agent_actions);
         $data['data'] .= json_encode(array($agent_elem));
     }
 } catch (Exception $e) {
     $data['status'] = 'error';
     $data['data'] = _('An unexpected error occurred. Unable to create HIDS agent. Please try again') . '.<br/><br/>' . $e->getMessage();
 }
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:save_agent.php

示例15: foreach

    $host_info = $scan_results['scanned_ips'];
    foreach ($data['by_host'] as $host_key => $host_data) {
        ?>
                 
                <tr>
                    <td class='td_ip'>
                        <?php 
        echo $host_info[$host_key]['ip'];
        ?>
                    </td>  
                    <td class='td_hostname'>
                        <?php 
        $hostname = '';
        $id = $data['general']['hosts_in_group'][$host_key];
        if (!empty($id)) {
            $hostname = Asset_host::get_name_by_id($conn, $id);
        }
        if (empty($hostname)) {
            $hostname = $host_info[$host_key]['hostname'];
        }
        echo $hostname;
        ?>
                    </td>  
                    <td class='td_status'>
                        <span class="<?php 
        echo $host_data['status'];
        ?>
"><?php 
        echo ucfirst($host_data['status']);
        ?>
</span>                        
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:save_scan.php


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