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


PHP Asset_host::get_basic_list方法代码示例

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


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

示例1: array_keys

     $_list_data = Asset_host::get_basic_list($conn);
     $_host_aux = array_keys($_list_data[1]);
     foreach ($_host_aux as $h_id) {
         $assets_aux[] = Util::uuid_format($h_id);
     }
     $_list_data = Asset_net::get_list($conn);
     $_net_aux = array_keys($_list_data[0]);
     foreach ($_net_aux as $n_id) {
         $assets_aux[] = Util::uuid_format($n_id);
     }
     $_GET["from_list"] = implode(",", $assets_aux);
 }
 if ((Session::get_host_where() != "" || Session::get_net_where() != "") && (GET('to') == "ANY" || GET('to_list') == "")) {
     $_GET["to"] = "LIST";
     $assets_aux = array();
     $_list_data = Asset_host::get_basic_list($conn);
     $_host_aux = array_keys($_list_data[1]);
     foreach ($_host_aux as $h_id) {
         $assets_aux[] = Util::uuid_format($h_id);
     }
     $_list_data = Asset_net::get_list($conn);
     $_net_aux = array_keys($_list_data[0]);
     foreach ($_net_aux as $n_id) {
         $assets_aux[] = Util::uuid_format($n_id);
     }
     $_GET["to_list"] = implode(",", $assets_aux);
 }
 if (GET("from") == "LIST") {
     $_GET["from"] = GET("from_list");
 }
 if (GET("port_from") == "LIST") {
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:form_network.php

示例2: ossim_db

*/
require_once 'av_init.php';
Session::logcheck('report-menu', 'ReportsReportServer');
//Get assets from Session
$assets = '<table class="w100" cellspacing="0" cellpadding="0">';
$cnd_1 = $_SESSION['_user_vision']['host_where'] && !Session::only_ff_host();
$cnd_2 = $_SESSION['_user_vision']['net_where'] && !Session::only_ff_net();
if ($cnd_1 || $cnd_2) {
    $db = new ossim_db();
    $conn = $db->connect();
    $assets .= '<tr>
                    <td style="text-align:left;width:25mm;font-size:10px;color:#535353;" valign="top">' . "Assets Selected:" . '</td>
                    <td class="nobborder" style="padding-left:5px;font-size:10px" valign="top">
                        <table class="w100" cellpadding="0" cellspacing="0">';
    if ($_SESSION['_user_vision']['host_where'] && !Session::only_ff_host()) {
        $_host_list = Asset_host::get_basic_list($conn);
        $hosts = $_host_list[1];
        foreach ($hosts as $host) {
            $assets .= '<tr><td class="nobborder" style="text-align:left;" valign="top">' . _('Host') . ': ' . $host['name'] . ' [' . $host['ips'] . ']</td></tr>';
        }
    }
    if ($_SESSION['_user_vision']['net_where'] && !Session::only_ff_net()) {
        $nets = Asset_net::get_list($conn);
        $_net_list = Asset_net::get_list($conn);
        $nets = $_net_list[0];
        foreach ($nets as $net) {
            $assets .= '<tr><td class="nobborder" style="text-align:left;" valign="top">' . _('Net') . ': ' . $net['name'] . ' [' . $net['ips'] . ']</td></tr>';
        }
    }
    $assets .= '     </table>
                </td>
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:titlepage.php

示例3: submit_scan


//.........这里部分代码省略.........
                $requested_run = weekday_month(strtolower($daysMap[$nthdayofweek]['text']), $nthweekday, $btime_hour, $btime_min);
            }
            preg_match("/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/", $requested_run, $found);
            list($b_y, $b_m, $b_d, $b_h, $b_u, $b_s, $b_time) = Util::get_utc_from_date($dbconn, $found[1] . "-" . $found[2] . "-" . $found[3] . " " . $found[4] . ":" . $found[5] . ":00", $tz);
            $requested_run = sprintf("%04d%02d%02d%02d%02d%02d", $b_y, $b_m, $b_d, $b_h, $b_u, "00");
            $dayofmonth = $nthweekday;
            $dayofweek = $nthdayofweek;
            break;
        default:
            break;
    }
    $insert_time = gmdate('YmdHis');
    if (!empty($_SESSION['_vuln_targets']) && count($_SESSION['_vuln_targets']) > 0) {
        $arr_ctx = array();
        $sgr = array();
        foreach ($_SESSION['_vuln_targets'] as $target_selected => $server_id) {
            $sgr[$server_id][] = $target_selected;
            if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2}$/i', $target_selected)) {
                $related_nets = array_values(Asset_net::get_closest_nets($dbconn, $target_selected));
                $firs_net = $related_nets[0];
                $closetnet_id = $firs_net['id'];
                if (valid_hex32($closetnet_id)) {
                    $arr_ctx[$target_selected] = Asset_net::get_ctx_by_id($dbconn, $closetnet_id);
                }
            } else {
                if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/i', $target_selected)) {
                    $closetnet_id = key(Asset_host::get_closest_net($dbconn, $target_selected));
                    if (valid_hex32($closetnet_id)) {
                        $arr_ctx[$target_selected] = Asset_net::get_ctx_by_id($dbconn, $closetnet_id);
                    }
                } else {
                    if (valid_hostname($target_selected) || valid_fqdns($target_selected)) {
                        $filters = array('where' => "hostname like '{$target_selected}' OR fqdns like '{$target_selected}'");
                        $_hosts_data = Asset_host::get_basic_list($dbconn, $filters);
                        $host_list = $_hosts_data[1];
                        if (count($host_list) > 0) {
                            $first_host = array_shift($host_list);
                            $hips = explode(",", $first_host['ips']);
                            foreach ($hips as $hip) {
                                $hip = trim($hip);
                                $arr_ctx[$hip] = $first_host['ctx'];
                            }
                        }
                    }
                }
            }
        }
        ossim_clean_error();
        unset($_SESSION['_vuln_targets']);
        // clean scan targets
        $resolve_names = $not_resolve == '1' ? 0 : 1;
        $queries = array();
        $IP_ctx = array();
        foreach ($arr_ctx as $aip => $actx) {
            $IP_ctx[] = $actx . '#' . $aip;
        }
        $bbimonth = strlen($bbimonth) == 1 ? '0' . $bbimonth : $bbimonth;
        $bbiday = strlen($bbiday) == 1 ? '0' . $bbiday : $bbiday;
        // Delete scheduled jobs if "Inmeditely" scheduled method is selected
        if (isset($sched_id) && $sched_id > 0 && $schedule_type == 'N') {
            $query = 'DELETE FROM vuln_job_schedule WHERE id = ?';
            $params = array($sched_id);
            $rs = $dbconn->Execute($query, $params);
            if (!$rs) {
                Av_exception::throw_error(Av_exception::DB_ERROR, $conn->ErrorMsg());
            }
开发者ID:alienfault,项目名称:ossim,代码行数:67,代码来源:sched.php

示例4: DisplayProcessing


//.........这里部分代码省略.........
        $cmd_opts['profile'] = $_SESSION['profileswitch'];
        $cmd_opts['srcselector'] = implode(':', $process_form['srcselector']);
        #print "<pre>\n";
        $patterns = array();
        $replacements = array();
        $patterns[0] = '/(\\s*)([^\\s]+)/';
        $replacements[0] = "\$1<a href='#null' onClick='lookup(\"\$2\", this, event)' title='lookup \$2'>\$2</a>";
        // gets HAP4NfSens plugin id. returns -1 if HAP4NfSen is not installed.
        function getHAP4NfSenId()
        {
            $plugins = GetPlugins();
            for ($i = 0; $i < count($plugins); $i++) {
                $plugin = $plugins[$i];
                if ($plugin == "HAP4NfSen") {
                    return $i;
                }
            }
            return -1;
        }
        ClearMessages();
        $cmd_opts['args'] = "-T {$run}";
        $cmd_opts['filter'] = $filter;
        $titcol = get_tit_col($run);
        $cmd_out = nfsend_query("run-nfdump", $cmd_opts);
        if (!is_array($cmd_out)) {
            ShowMessages();
        } else {
            $conf = $GLOBALS["CONF"];
            $solera = $conf->get_conf("solera_enable", FALSE) ? true : false;
            $db = new ossim_db();
            $conn = $db->connect();
            $sensors = $hosts = $ossim_servers = array();
            $tz = Util::get_timezone();
            list($hosts, $host_ids) = Asset_host::get_basic_list($conn, array(), TRUE);
            $entities = Session::get_all_entities($conn);
            $_sensors = Av_sensor::get_basic_list($conn);
            foreach ($_sensors as $s_id => $s) {
                $sensors[$s['ip']] = $s['name'];
            }
            /*$hap4nfsen_id = getHAP4NfSenId();
                    	        if ($hap4nfsen_id >= 0) {
            					// ICMP "port" filter are no currently supported by the HAP4NfSen plugin
            					function isChecked(&$form, $name) { // helper function used to find out, if an option is checked
            						return $form[$name]=="checked";
            					}
            					$ip_and_port_columns = preg_match('/(flow records)/i', $IPStatOption[$process_form['stattype']]) &&
            						((isChecked($process_form,'aggr_srcip') && isChecked($process_form,'aggr_srcport')) ||
            						(isChecked($process_form,'aggr_dstip') && isChecked($process_form,'aggr_dstport')));
            					$ip_contains_port =  $_SESSION["process_form"]["modeselect"]=='0' || !preg_match('/[ip|flow_records]/i', $IPStatOption[$process_form['stattype']]) ||
            								(preg_match('/(flow records)/i', $IPStatOption[$process_form['stattype']]) && !( // no boxes checked
            								isChecked($process_form,'aggr_srcip') || isChecked($process_form,'aggr_srcport') ||
            								isChecked($process_form,'aggr_dstip') || isChecked($process_form,'aggr_dstport')));
                    	                        $_SESSION["plugin"][$hap4nfsen_id]["cmd_opts"] = $cmd_opts;
            					$hap_pic = "<img src=\"plugins/HAP4NfSen/graphviz.png\" valign=\"middle\" border=\"0\" alt=\"HAP\" />";
            					$default_pattern = array_pop($patterns);
            					$default_replacement = array_pop($replacements);
            					if ($ip_contains_port) { // matches cases like ip:port
            						$max_prot_length = 5; // max. port length = 5 chars(highest port number = 65535)
            						for ($i=$max_prot_length;$i>=1;$i--) {
            							$diff = ($max_prot_length-$i); // difference between actual and max port length
            							$ip_port_pattern_icmp = "/(\s*)([^\s|^:]+)(:)(0\s{4}|\d\.\d\s{2}|\d{2}\.\d\|\d\.\d{2}\s|\d{2}\.\d{2})/";
            							$ip_port_pattern_normal = "/(\s*)([^\s|^:]+)(:)([\d|\.]{{$i}})(\s{{$diff}})/";
            							$spaces = '';
            							for ($k=0;$k<$diff;$k++) {$spaces = $spaces . ' ';} // spaces required to align hap viewer icons
                                                            	array_push($patterns, $ip_port_pattern_icmp);
            							array_push($replacements,  $default_replacement .
开发者ID:jackpf,项目名称:ossim-arc,代码行数:67,代码来源:details.php

示例5: array

// Multiple Database Server selector
$conn = $dbo->connect();
$database_servers = Databases::get_list($conn);
$dbo->close();
//
if (is_array($_SESSION["server"]) && $_SESSION["server"][0] != "") {
    $dbo->enable_cache();
    $conn = $dbo->custom_connect($_SESSION["server"][0], $_SESSION["server"][2], $_SESSION["server"][3]);
} else {
    $dbo->enable_cache();
    $conn = $dbo->connect();
}
include_once "{$BASE_path}/base_common.php";
$sensors = $hosts = $ossim_servers = array();
$sensors = Av_sensor::get_basic_list($conn, array(), TRUE);
list($hosts, $host_ids) = Asset_host::get_basic_list($conn, array(), TRUE);
$entities = Session::get_all_entities($conn);
$rep_activities = Reputation::get_reputation_activities($conn, "ORDER BY descr", $db_memcache);
$rep_severities = array("ANY", "High", "Medium", "Low");
//
// added default home host/lan to SESSION[ip_addr]
//
if ($_GET["addhomeips"] == "src" || $_GET["addhomeips"] == "dst") {
    $_nets = Asset_net::get_all($conn, TRUE);
    // adding all not external lans
    $local_ips = array();
    $total_ips = 0;
    foreach ($_nets as $current_net) {
        $cirds = explode(",", $current_net['ips']);
        foreach ($cirds as $cidr) {
            if (!$current_net['external'] && preg_match("/(.*)\\.(.*)\\.(.*)\\.(.*)\\/(.*)/", $cidr, $fields)) {
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:base_include.inc.php

示例6: ossim_db

$result = '';
$db = new ossim_db();
$dbconn = $db->connect();
$_SESSION['_user'] = 'admin';
switch ($option) {
    case 'get_ctx':
        if (preg_match("/^([a-f\\d]{32})#\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\$/i", $asset, $found)) {
            // host_id#IP
            $result = Asset_host::get_ctx_by_id($dbconn, $found[1]);
        } else {
            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)) {
                // net_id#CIDR
                $result = Asset_net::get_ctx_by_id($dbconn, $found[1]);
            } else {
                $filters = array('where' => 'hostname = "' . $asset . '" OR fqdns LIKE "%' . $asset . '%"');
                $_hosts_data = Asset_host::get_basic_list($dbconn, $filters);
                $hosts_list = $_hosts_data[1];
                $total = count($hosts_list);
                if ($total > 0) {
                    $host_id = key($hosts_list);
                    $result = $hosts_list[$host_id]['ctx'];
                } else {
                    $result = '';
                }
            }
        }
        break;
    case 'get_sensor_ip':
        $result = Av_sensor::get_ip_by_id($dbconn, $asset);
        break;
    case 'get_system_uuid':
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:util.php

示例7: list

    list($host_id, $host_ip) = explode("#", $host_id_ip);
    ossim_valid($host_ip, OSS_IP_ADDR, 'illegal:' . _("Host IP"));
    ossim_valid($host_id, OSS_HEX, 'illegal:' . _("Host ID"));
} else {
    // only IP
    ossim_valid($host_id_ip, OSS_NULLABLE, OSS_IP_ADDR, 'illegal:' . _("Host IP"));
}
if (ossim_error()) {
    die(ossim_error());
}
$results = array();
//Check if it is allowed
$allowed = Vulnerabilities::is_allowed_credential($dbconn, $name, $login);
if ($allowed) {
    //Autocomplete data
    $_hosts_data = Asset_host::get_basic_list($dbconn);
    $_hosts = $_hosts_data[1];
    foreach ($_hosts as $_host_id => $_host_detail) {
        // get host IPs
        $hIPs = array();
        $hIPs = explode(",", trim($_host_detail['ips']));
        foreach ($hIPs as $hIP) {
            $hIP = trim($hIP);
            $hosts .= '{ txt:"' . $_host_detail['name'] . ' (' . $hIP . ')", id: "' . $_host_id . '#' . $hIP . '" },';
        }
    }
}
//Check credentials
if ($host_id_ip != "") {
    $results = Vulnerabilities::check_credential($dbconn, $host_id_ip, $name, $login);
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:check_credential.php

示例8: submit_scan


//.........这里部分代码省略.........
            preg_match("/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/", $requested_run, $found);
            list($b_y, $b_m, $b_d, $b_h, $b_u, $b_s, $b_time) = Util::get_utc_from_date($dbconn, $found[1] . "-" . $found[2] . "-" . $found[3] . " " . $found[4] . ":" . $found[5] . ":00", $tz);
            $requested_run = sprintf("%04d%02d%02d%02d%02d%02d", $b_y, $b_m, $b_d, $b_h, $b_u, "00");
            //error_log("NW-> $requested_run\n" ,3,"/tmp/sched.log");
            $dayofmonth = $nthweekday;
            $recurring = True;
            $sched_message = "Schedule Reccurring";
            $reccur_type = "Nth weekday of the month";
            break;
        default:
            break;
    }
    $insert_time = gmdate("YmdHis");
    if (!empty($_SESSION["_vuln_targets"]) && count($_SESSION["_vuln_targets"]) > 0) {
        $arr_ctx = array();
        $sgr = array();
        foreach ($_SESSION["_vuln_targets"] as $target_selected => $server_id) {
            $sgr[$server_id][] = $target_selected;
            if (preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2}\$/i", $target_selected)) {
                $related_ctxs = array_values(Asset_net::get_id_by_ips($dbconn, $target_selected));
                if (is_array($related_ctxs) && count($related_ctxs) > 0) {
                    $arr_ctx[$target_selected] = key(array_shift($related_ctxs));
                }
            } else {
                if (preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\$/i", $target_selected)) {
                    $related_ctxs = array_values(Asset_host::get_id_by_ips($dbconn, $target_selected));
                    if (is_array($related_ctxs) && count($related_ctxs) > 0) {
                        $arr_ctx[$target_selected] = key(array_shift($related_ctxs));
                        // to assign a ctx for a IP
                    }
                } else {
                    if (valid_hostname($target_selected) || valid_fqdns($target_selected)) {
                        $filters = array('where' => "hostname like '{$target_selected}' OR fqdns like '{$target_selected}'");
                        $_hosts_data = Asset_host::get_basic_list($dbconn, $filters);
                        $host_list = $_hosts_data[1];
                        if (count($host_list) > 0) {
                            $first_host = array_shift($host_list);
                            $hips = explode(",", $first_host['ips']);
                            foreach ($hips as $hip) {
                                $hip = trim($hip);
                                $arr_ctx[$hip] = $first_host['ctx'];
                            }
                        }
                    }
                }
            }
        }
        ossim_clean_error();
        unset($_SESSION["_vuln_targets"]);
        // clean scan targets
        $query = array();
        $IP_ctx = array();
        foreach ($arr_ctx as $aip => $actx) {
            $IP_ctx[] = $actx . "#" . $aip;
        }
        if ($vuln_op == "editrecurring" && $sched_id > 0) {
            $query[] = "DELETE FROM vuln_job_schedule WHERE id='{$sched_id}'";
            $i = 1;
            foreach ($sgr as $notify_sensor => $targets) {
                $target_list = implode("\n", $targets);
                $target_list .= "\n" . implode("\n", $ip_exceptions_list);
                $query[] = "INSERT INTO vuln_job_schedule ( name, username, fk_name, job_TYPE, schedule_type, day_of_week, day_of_month, \n                            time, email, meth_TARGET, meth_CRED, meth_VSET, meth_CUSTOM, meth_CPLUGINS, meth_Wfile, \n                            meth_Ucheck, meth_TIMEOUT, next_CHECK, createdate, enabled, resolve_names, time_interval, IP_ctx, credentials) VALUES ( '{$sname}', '{$username}', '" . Session::get_session_user() . "', '{$jobType}',\n                            '{$schedule_type}', '{$dayofweek}', '{$dayofmonth}', '{$time_value}', '{$notify_sensor}', '{$target_list}',\n                            {$I3crID}, '{$sid}', '{$custadd_type}', {$plugs_list}, {$semail}, '{$scan_locally}',\n                            '{$timeout}', '{$requested_run}', '{$insert_time}', '1', '{$resolve_names}' ,'{$time_interval}', '" . implode("\n", $IP_ctx) . "', '{$credentials}') ";
                $sjobs_names[] = $sname . $i;
                $i++;
            }
        } elseif ($recurring) {
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:67,代码来源:sched.php


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