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


PHP ossim_db类代码示例

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


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

示例1: load_layout

function load_layout($name_layout, $category = 'policy')
{
    $db = new ossim_db();
    $conn = $db->connect();
    $config = new User_config($conn);
    $login = Session::get_session_user();
    $data = $config->get($login, $name_layout, 'php', $category);
    return $data == null ? array() : $data;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:9,代码来源:layout.php

示例2: end_upgrade

 function end_upgrade()
 {
     require_once 'ossim_db.inc';
     $dbsock = new ossim_db();
     $db = $dbsock->connect();
     $configxml = "/etc/ossim/server/config.xml";
     $name = "Not found";
     // Check server name
     if (file_exists($configxml)) {
         $lines = file($configxml);
         foreach ($lines as $line) {
             if (preg_match("/\\<server.*name=\"([^\"]+)\"/", $line, $found)) {
                 $name = $found[1];
             }
         }
     }
     // Search in DB for name
     $sql = "SELECT * FROM server_role WHERE name=\"{$name}\"";
     if (!($rs = $db->Execute($sql))) {
         print $db->ErrorMsg();
     } elseif (!$rs->EOF) {
         // Found -> Update
         $correlate = $rs->fields['correlate'] ? "yes" : "no";
         $cross_correlate = $rs->fields['cross_correlate'] ? "yes" : "no";
         $store = $rs->fields['store'] ? "yes" : "no";
         $qualify = $rs->fields['qualify'] ? "yes" : "no";
         $resend_alarm = $rs->fields['resend_alarm'] ? "yes" : "no";
         $resend_event = $rs->fields['resend_event'] ? "yes" : "no";
         $sign = $rs->fields['sign'] ? "yes" : "no";
         $sem = $rs->fields['sem'] ? "yes" : "no";
         $sim = $rs->fields['sim'] ? "yes" : "no";
         $alarms_to_syslog = $rs->fields['alarms_to_syslog'] ? "yes" : "no";
         require_once 'classes/Config.inc';
         $conf = new Config();
         $conf->update("server_correlate", $correlate);
         $conf->update("server_cross_correlate", $cross_correlate);
         $conf->update("server_store", $store);
         $conf->update("server_qualify", $qualify);
         $conf->update("server_forward_alarm", $resend_alarm);
         $conf->update("server_forward_event", $resend_event);
         $conf->update("server_sign", $sign);
         $conf->update("server_sem", $sem);
         $conf->update("server_sim", $sim);
         $conf->update("server_alarms_to_syslog", $alarms_to_syslog);
     }
     exec("sudo /etc/init.d/ossim-server restart");
     //
     // Reload ACLS
     //
     $this->reload_acls();
     return true;
 }
开发者ID:jhbsz,项目名称:ossimTest,代码行数:52,代码来源:2.2.php

示例3: check_phpgacl_install

function check_phpgacl_install()
{
    global $gacl;
    $db_table_prefix = $gacl->_db_table_prefix;
    require_once "ossim_db.inc";
    $db = new ossim_db();
    if (!($conn = $db->phpgacl_connect())) {
        echo "<p align=\"center\">\n                <b>Can't connect to OSSIM acl database (phpgacl)</b><br/>\n                Check for phpgacl values at framework configuration\n                </p>";
        exit;
    }
    $query1 = OssimQuery("SELECT * FROM acl");
    $query2 = OssimQuery("SELECT * FROM " . $db_table_prefix . "_acl");
    if (!$conn->Execute($query1) and !$conn->Execute($query2)) {
        echo "\n        <p align=\"center\"><b>You need to configure phpGACL</b><br/>\n        Remember to setup the database connection at phpGACL config files!\n        <br/>\n        Click <a href=\"/phpgacl/setup.php\">here</a> to enter setup\n        </p>\n            ";
        exit;
    }
    $db->close($conn);
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:18,代码来源:login.php

示例4: get_report_uuid

function get_report_uuid()
{
    require_once 'classes/Session.inc';
    $uuid = Session::get_secure_id();
    $url = null;
    if (empty($uuid)) {
        $db = new ossim_db();
        $dbconn = $db->connect();
        $user = Session::get_session_user();
        $query = 'SELECT * FROM `users` WHERE login="' . $user . '"';
        $result = $dbconn->Execute($query);
        if (is_array($result->fields) && !empty($result->fields)) {
            $pass = $result->fields["pass"];
            $uuid = sha1($user . "#" . $pass);
        } else {
            $uuid = false;
        }
    }
    return $uuid;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:20,代码来源:deleteuser.php

示例5: get_user_icon

function get_user_icon($login, $pro)
{
    ${$pixmaps} = '../pixmaps/user-green.png';
    $db = new ossim_db();
    $conn = $db->connect();
    $user = Session::get_list($conn, "WHERE login='{$login}'");
    if ($pro) {
        // Pro-version
        if ($login == ACL_DEFAULT_OSSIM_ADMIN || $user[0]->get_is_admin()) {
            $pixmaps = '../pixmaps/user-gadmin.png';
        } elseif (Acl::is_proadmin($conn, $user[0]->get_login())) {
            $pixmaps = '../pixmaps/user-business.png';
        }
    } else {
        // Open Source
        if ($login == ACL_DEFAULT_OSSIM_ADMIN || $user[0]->get_is_admin()) {
            $pixmaps = "../pixmaps/user-gadmin.png";
        }
    }
    $db->close();
    return $pixmaps;
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:22,代码来源:opened_sessions.php

示例6: SIEM_trends_week

function SIEM_trends_week($param = '')
{
    global $tz;
    $tzc = Util::get_tzc($tz);
    $data = array();
    $plugins = '';
    $plugins_sql = '';
    $db = new ossim_db(TRUE);
    $dbconn = $db->connect();
    $_asset_where = make_asset_filter();
    $asset_where = $_asset_where[1];
    $sensor_where = make_ctx_filter() . $asset_where;
    $tax_join = '';
    if (preg_match("/taxonomy\\=(.+)/", $param, $found)) {
        if ($found[1] == 'honeypot') {
            $tax_join = 'alienvault.plugin_sid p, ';
            $tax_where = 'AND acid_event.plugin_id = p.plugin_id AND acid_event.plugin_sid = p.sid AND p.category_id = 19';
        }
        $param = '';
    } elseif ($param == 'ossec%') {
        $plugins_sql = 'AND acid_event.plugin_id between ' . OSSEC_MIN_PLUGIN_ID . ' AND ' . OSSEC_MAX_PLUGIN_ID;
        $plugins = OSSEC_MIN_PLUGIN_ID . '-' . OSSEC_MAX_PLUGIN_ID;
    }
    $sqlgraph = "SELECT SUM(acid_event.cnt) as num_events, day(convert_tz(timestamp,'+00:00','{$tzc}')) AS intervalo, monthname(convert_tz(timestamp,'+00:00','{$tzc}')) AS suf \n        FROM {$tax_join} alienvault_siem.ac_acid_event acid_event\n        WHERE timestamp BETWEEN '" . gmdate("Y-m-d 00:00:00", gmdate("U") - 604800) . "' AND '" . gmdate("Y-m-d 23:59:59") . "' {$plugins_sql} {$sensor_where} {$tax_where} \n        GROUP BY suf, intervalo \n        ORDER BY suf, intervalo";
    $rg = $dbconn->CacheExecute($sqlgraph);
    if (!$rg) {
        Av_exception::write_log(Av_exception::DB_ERROR, $dbconn->ErrorMsg());
    } else {
        while (!$rg->EOF) {
            $hours = $rg->fields['intervalo'] . ' ' . substr($rg->fields['suf'], 0, 3);
            $data[$hours] = $rg->fields['num_events'];
            $rg->MoveNext();
        }
    }
    $db->close();
    return $param != '' ? array($data, $plugins) : $data;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:37,代码来源:event_trends.php

示例7: get_user_icon

function get_user_icon($login, $pro)
{
    require_once 'ossim_db.inc';
    $db = new ossim_db();
    $dbconn = $db->connect();
    $user = Session::get_list($dbconn, "WHERE login='{$login}'");
    if ($pro) {
        // Pro-version
        if ($login == ACL_DEFAULT_OSSIM_ADMIN || $user[0]->get_is_admin()) {
            return "../pixmaps/user-gadmin.png";
        } elseif (Acl::is_proadmin($dbconn, $user[0]->get_login())) {
            return "../pixmaps/user-business.png";
        } else {
            return "../pixmaps/user-green.png";
        }
    } else {
        // Opensource
        if ($login == ACL_DEFAULT_OSSIM_ADMIN || $user[0]->get_is_admin()) {
            return "../pixmaps/user-gadmin.png";
        } else {
            return "../pixmaps/user-green.png";
        }
    }
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:24,代码来源:opened_sessions.php

示例8: CONCAT

*
*/
require_once 'av_init.php';
if (Session::menu_perms("report-menu", "ReportsReportServer")) {
    include_once 'updateBd.php';
    require_once 'common.php';
    include 'general.php';
    /*
     * PCI Version, if 3.0 then this variable is predefined in PCI-DSS3.php
     * The code is shared with this only diference
     */
    $pci_version = $pci_version != '' ? $pci_version : '';
    $sql_year = "STR_TO_DATE( CONCAT( a.year, '-', a.month, '-', a.day ) , '%Y-%m-%d' ) >= '{$date_from}' AND STR_TO_DATE( CONCAT( a.year, '-', a.month, '-', a.day ) , '%Y-%m-%d' ) <= '{$date_to}'";
    //create
    require_once 'ossim_db.inc';
    $db1 = new ossim_db();
    $conn1 = $db1->connect();
    // Check if PCI database exists
    if (!pci_database_available($conn1, "PCI{$pci_version}")) {
        $htmlPdfReport->pageBreak();
        $htmlPdfReport->setBookmark($title);
        $htmlPdfReport->set($htmlPdfReport->newTitle($title, "", "", null));
        $htmlPdfReport->set('<table align="center" width="750" cellpadding="0" cellspacing="0"><tr><td>' . _('Database not found') . ': PCI' . $pci_version . '</td></tr></table><br/><br/>');
        $db1->close();
    } else {
        tmp_insert($conn1, "PCI{$pci_version}.R01_FW_Config");
        tmp_insert($conn1, "PCI{$pci_version}.R02_Vendor_default");
        tmp_insert($conn1, "PCI{$pci_version}.R03_Stored_cardholder");
        tmp_insert($conn1, "PCI{$pci_version}.R04_Data_encryption");
        tmp_insert($conn1, "PCI{$pci_version}.R05_Antivirus");
        tmp_insert($conn1, "PCI{$pci_version}.R06_System_app");
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:PCI-DSS.php

示例9: SendHeader


//.........这里部分代码省略.........
                 send($(this).val(), $('#interface option:selected').text());
             });
             
             <?php 
    if (isset($_POST['ip'])) {
        ?>
                 send('<?php 
        echo Util::htmlentities($_POST['ip']);
        ?>
', $('#interface option:selected').text());
                 <?php 
    }
    ?>
             // ************

             $('.scriptinfo').tipTip({
                 defaultPosition: "down",
                 content: function (e) {
                    
                    var ip_data = $(this).attr('data-title');
                        ip_data = ip_data.split('-');
                    
                    $.ajax({
                        url: '../alarm/alarm_netlookup.php?ip=' + ip_data[0],
                        success: function (response) {
                          e.content.html(response); // the var e is the callback function data (see above)
                        }
                    });
                    return '<?php 
    echo _("Searching") . "...";
    ?>
'; // We temporary show a Please wait text until the ajax success callback is called.
                 }
              });
  			
			$(".repinfo").tipTip({
				defaultPosition: 'left',
				content: function (e) { 
					return $(this).attr('txt');
				}
			});  
                
			$('#filter').on('keyup', function(e){
                $(this).val(function(i, val) {
					return val.replace(/[\t\r\b]/g, '');
				});
			});
										  
			<?php 
    if (GET('ip') != "") {
        ?>
				$("#process_button").click();
				<?php 
    }
    ?>
			
		}

		function lastsessions() {
			$('#modeselect0').click();
			$("#listN option[value='3']").attr('selected', 'selected');
			$("#process_button").click();
		}
		
		function launch(val,order) {
			$('#modeselect1').click();
			$("#TopN option[value='0']").attr('selected', 'selected');
			$("#StatTypeSelector option[value='"+val+"']").attr('selected', 'selected');
			$("#statorder option[value='"+order+"']").attr('selected', 'selected');
			$("#process_button").click();
		}
		
		function remote_interface(ip) {
			$("#FlowProcessingForm").attr("action", "menu.php");
			$("#FlowProcessingForm").attr("target", "menu_nfsen");
			$("#FlowProcessingForm").append("<input type='hidden' name='process' value='Process' />");
			$("#FlowProcessingForm").append("<input type='hidden' name='ip' value='"+ip+"' />");
			$("#FlowProcessingForm").submit();
		}
		
		function clean_remote_data() {
			$("#FlowProcessingForm").removeAttr("target");
			$("#FlowProcessingForm").attr("action", $("#FlowProcessingForm").attr("laction")); // set the local action
		}
	</script>	
</head>

<body>

<?php 
    $db_aux = new ossim_db();
    $conn_aux = $db_aux->connect();
    $aux_ri_interfaces = Remote_interface::get_list($conn_aux, "WHERE status = 1");
    $ri_list = $aux_ri_interfaces[0];
    $ri_total = $aux_ri_interfaces[1];
    $db_aux->close();
    if (Session::am_i_admin() && count($ri_total) > 0) {
        include 'menu.php';
    }
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:101,代码来源:nfsen.php

示例10: header

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
require_once 'av_init.php';
Session::logcheck("analysis-menu", "EventsForensics");
$search = trim(GET('q'));
$max = intval(GET('limit'));
if (!$max) {
    $max = 50;
}
ossim_valid($search, OSS_NULLABLE, OSS_NOECHARS, OSS_ALPHA, OSS_SCORE, OSS_PUNC, 'illegal:' . _("search"));
if (ossim_error()) {
    die;
}
$db = new ossim_db(TRUE);
if (is_array($_SESSION['server']) && $_SESSION['server'][0] != '') {
    $conn = $db->custom_connect($_SESSION["server"][0], $_SESSION["server"][2], $_SESSION["server"][3]);
} else {
    $conn = $db->connect();
}
$params = array();
$filter = '';
if (!empty($search)) {
    $filter = 'WHERE INET6_NTOA(device_ip) LIKE CONCAT("%",?,"%")';
    $params[] = $search;
}
$query = "SELECT DISTINCT INET6_NTOA(device_ip) as ip FROM alienvault_siem.device {$filter}";
$rs = $conn->Execute($query, $params);
if ($rs) {
    while (!$rs->EOF) {
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:base_devices.php

示例11: SIEM_trends_hids

function SIEM_trends_hids($agent_ip)
{
    include_once '../panel/sensor_filter.php';
    require_once 'classes/Plugin.inc';
    require_once 'classes/Util.inc';
    require_once 'ossim_db.inc';
    $tz = Util::get_timezone();
    $tzc = Util::get_tzc($tz);
    $data = array();
    $plugins = $plugins_sql = "";
    $db = new ossim_db();
    $dbconn = $db->connect();
    $sensor_where = make_sensor_filter($dbconn);
    // Ossec filter
    $oss_p_id_name = Plugin::get_id_and_name($dbconn, "WHERE name LIKE 'ossec%'");
    $plugins = implode(",", array_flip($oss_p_id_name));
    $plugins_sql = "AND acid_event.plugin_id in ({$plugins})";
    // Agent ip filter
    $agent_where = make_sid_filter($dbconn, $agent_ip);
    if ($agent_where == "") {
        $agent_where = "0";
    }
    $sqlgraph = "SELECT COUNT(acid_event.sid) as num_events, day(convert_tz(timestamp,'+00:00','{$tzc}')) as intervalo, monthname(convert_tz(timestamp,'+00:00','{$tzc}')) as suf FROM snort.acid_event LEFT JOIN ossim.plugin ON acid_event.plugin_id=plugin.id WHERE sid in ({$agent_where}) AND timestamp BETWEEN '" . gmdate("Y-m-d 00:00:00", gmdate("U") - 604800) . "' AND '" . gmdate("Y-m-d 23:59:59") . "' {$plugins_sql} {$sensor_where} GROUP BY suf,intervalo ORDER BY suf,intervalo";
    //print $sqlgraph;
    if (!($rg =& $dbconn->Execute($sqlgraph))) {
        return false;
    } else {
        while (!$rg->EOF) {
            $hours = $rg->fields["intervalo"] . " " . substr($rg->fields["suf"], 0, 3);
            $data[$hours] = $rg->fields["num_events"];
            $rg->MoveNext();
        }
    }
    $db->close($dbconn);
    return $data;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:36,代码来源:utils.php

示例12: PrintPredefinedViews

function PrintPredefinedViews()
{
    global $opensource;
    $current_str = $_SESSION['current_cview'] != "default" && $_SESSION['current_cview'] != "" ? Util::htmlentities($_SESSION['current_cview']) : _("Default");
    // Get default view
    require_once "ossim_conf.inc";
    $conf = $GLOBALS["CONF"];
    $idm_enabled = $conf->get_conf("enable_idm") == 1 && Session::is_pro() ? true : false;
    $login = Session::get_session_user();
    $db_aux = new ossim_db(true);
    $conn_aux = $db_aux->connect();
    $config = new User_config($conn_aux);
    $default_view = $config->get($login, 'custom_view_default', 'php', "siem") != "" ? $config->get($login, 'custom_view_default', 'php', "siem") : ($idm_enabled ? 'IDM' : 'default');
    $db_aux->close($conn_aux);
    ?>
    <button id="views_link" class="button av_b_secondary">
        <?php 
    echo _('Change View');
    ?>
 &nbsp;&#x25be;
    </button>

    <div id="custom_views" class="dropdown dropdown-secondary dropdown-close dropdown-tip dropdown-anchor-right dropdown-scrolling" style='display:none'>
        <ul id="custom_views_ul" class="dropdown-menu">
            <?php 
    if (Session::am_i_admin()) {
        ?>
            <li><a href="#" onclick="GB_show('<?php 
        echo _("Edit Current View");
        ?>
','/forensics/custom_view_edit.php?edit=1',480,700);$('#custom_views').hide();return false"><?php 
        echo _("Edit Current View");
        ?>
&nbsp;</a></li>
            <li><a href="#" onclick="GB_show('<?php 
        echo _("Create new custom view");
        ?>
','/forensics/custom_view_edit.php',480,700);$('#custom_views').hide();return false"><?php 
        echo _("Create New View");
        ?>
&nbsp;</a></li>
            <?php 
    }
    foreach ($_SESSION['views'] as $name => $attr) {
        $dname = $name == "default" ? "Default" : $name;
        $selected = $_SESSION['current_cview'] == $name ? "&#x25BA;&nbsp;" : "";
        ?>
                <li><a href="#" onclick="change_view('<?php 
        echo Util::htmlentities($name);
        ?>
');$('#custom_views').hide()"><?php 
        echo $selected . Util::htmlentities($dname);
        ?>
&nbsp;</a></li>
            <?php 
    }
    ?>
        </ul>
    </div>

    <?php 
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:62,代码来源:base_output_html.inc.php

示例13: ossim_db

*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck("analysis-menu", "ControlPanelAlarms");
$vars = $_SESSION['_kdb_alarm_vars'];
$plugin_id = $_SESSION['_kdb_alarm_pid'];
$plugin_sid = $_SESSION['_kdb_alarm_psid'];
$docs = 0;
if ($plugin_id != '' && $plugin_sid != '') {
    $db_kdb = new ossim_db();
    $conn_kdb = $db_kdb->connect();
    //Taxonomy
    $ptype = Product_type::get_product_type_by_plugin($conn_kdb, $plugin_id);
    $cat = Category::get_category_subcategory_by_plugin($conn_kdb, $plugin_id, $plugin_sid);
    $keyname = (empty($ptype['id']) ? 0 : $ptype['id']) . "##" . (empty($cat['cid']) ? 0 : $cat['cid']) . "##" . (empty($cat['scid']) ? 0 : $cat['scid']);
    $repository_list['taxonomy'] = Repository::get_repository_linked($conn_kdb, $keyname, 'taxonomy');
    //Directive
    if ($plugin_id == '1505') {
        $repository_list['directive'] = Repository::get_linked_by_directive($conn_kdb, $plugin_sid);
    }
    //Plugin SID
    $keyname = "{$plugin_sid}##{$plugin_id}";
    $repository_list['plugin_sid'] = Repository::get_repository_linked($conn_kdb, $keyname, 'plugin_sid');
    $docs = count($repository_list['directive']) + count($repository_list['plugin_sid']) + count($repository_list['taxonomy']);
    $db_kdb->close($conn_kdb);
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:kdb.php

示例14: GetOssimNetworkGroups

function GetOssimNetworkGroups()
{
    require_once "classes/Net_group.inc";
    require_once 'ossim_db.inc';
    $db = new ossim_db();
    $conn = $db->connect();
    $pg = array();
    $groups = Net_group::get_list($conn, "", " ORDER BY name");
    foreach ($groups as $ng) {
        $pg[] = $ng->get_name();
    }
    $conn->disconnect();
    return $pg;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:14,代码来源:base_common.php

示例15: query_inventory

function query_inventory($value)
{
    require_once 'ossim_db.inc';
    // Database Object
    $db = new ossim_db();
    $conn = $db->connect();
    $date_from = $_SESSION['inventory_search']['date_from'] != "" ? $_SESSION['inventory_search']['date_from'] : "1700-01-01";
    $date_to = $_SESSION['inventory_search']['date_to'] != "" ? $_SESSION['inventory_search']['date_to'] : "3000-01-01";
    $value = str_replace("/", "\\/", $value);
    $error = "";
    $matches = array();
    $ips = array();
    // OS
    $allips = array();
    $sql = "SELECT DISTINCT ip FROM host_os";
    if (!($rs =& $conn->Execute($sql))) {
        $error = _("Error in Query: {$sql}");
    } else {
        while (!$rs->EOF) {
            $allips[] = $rs->fields['ip'];
            $rs->MoveNext();
        }
    }
    foreach ($allips as $ip) {
        /*
        $anom0os = $anom1os = "";
        $sql2 = "SELECT os FROM host_os WHERE os LIKE '%$value%' AND ip=$ip AND anom=0 AND date >= '$date_from' AND date <= '$date_to' ORDER BY date DESC LIMIT 1";
        if (!$rs = & $conn->Execute($sql2, $params)) {
        	$error = _("Error in Query: $sql2");
        } else {
        	while (!$rs->EOF) {
        		$anom0os = $rs->fields['os'];
        		$rs->MoveNext();
        	}
        }
        $sql2 = "SELECT os FROM host_os WHERE os LIKE '%$value%' AND ip=$ip AND anom=1 AND date >= '$date_from' AND date <= '$date_to' ORDER BY date DESC LIMIT 1";
        if (!$rs = & $conn->Execute($sql2, $params)) {
        	$error = _("Error in Query: $sql2");
        } else {
        	while (!$rs->EOF) {
        		$anom1os = $rs->fields['os'];
        		$rs->MoveNext();
        	}
        }
        if ($anom0os != "") $matches[$anom0os][] = long2ip($ip); // Add IP to list
        elseif ($anom1os != "") $matches[$anom1os][] = long2ip($ip);
        */
        $ret = Host_os::get_ip_data($conn, long2ip($ip));
        $matches[$ret['os']][] = long2ip($ip);
    }
    // Services
    $allips = array();
    $sql = "SELECT DISTINCT ip FROM host_services";
    if (!($rs =& $conn->Execute($sql))) {
        $error = _("Error in Query: {$sql}");
    } else {
        while (!$rs->EOF) {
            $allips[] = $rs->fields['ip'];
            $rs->MoveNext();
        }
    }
    foreach ($allips as $ip) {
        $anom0serv = $anom1serv = "";
        $sql2 = "SELECT service FROM host_services WHERE service LIKE '%{$value}%' AND ip={$ip} AND anom=0 AND date >= '{$date_from}' AND date <= '{$date_to}' ORDER BY date DESC LIMIT 1";
        if (!($rs =& $conn->Execute($sql2, $params))) {
            $error = _("Error in Query: {$sql2}");
        } else {
            while (!$rs->EOF) {
                $anom0serv = $rs->fields['service'];
                $rs->MoveNext();
            }
            //if ($ip == 3232235781) return array(1,"matches IP $anom0serv");
        }
        $sql2 = "SELECT service FROM host_services WHERE service LIKE '%{$value}%' AND ip={$ip} AND anom=1 ORDER BY date AND date >= '{$date_from}' AND date <= '{$date_to}' DESC LIMIT 1";
        if (!($rs =& $conn->Execute($sql2, $params))) {
            $error = _("Error in Query: {$sql2}");
        } else {
            while (!$rs->EOF) {
                $anom1serv = $rs->fields['service'];
                $rs->MoveNext();
            }
        }
        if ($anom0serv != "") {
            $matches[$anom0serv][] = long2ip($ip);
        } elseif ($anom1serv != "") {
            $matches[$anom1serv][] = long2ip($ip);
        }
    }
    foreach ($matches as $os_service => $ips_arr) {
        //echo "found $os_service<br>";
        //return array(1,"matches ".implode(",",array_keys($matches)));
        if (preg_match("/{$value}/i", $os_service)) {
            $ips = $ips_arr;
        }
    }
    if ($error != "") {
        return array(1, $error);
    } else {
        return array(0, $ips);
    }
//.........这里部分代码省略.........
开发者ID:jhbsz,项目名称:ossimTest,代码行数:101,代码来源:functions.php


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