本文整理汇总了PHP中Net_IPv4类的典型用法代码示例。如果您正苦于以下问题:PHP Net_IPv4类的具体用法?PHP Net_IPv4怎么用?PHP Net_IPv4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Net_IPv4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($params = array())
{
$ip = filter_input(INPUT_POST, 'ip');
$netmask = filter_input(INPUT_POST, 'netmask');
$validateIP = new Net_IPv4();
$net = $validateIP->getNetLength($netmask);
$subnet = $validateIP->getSubnet($ip, $netmask);
$ipValid = $subnet . '/' . $net;
$geo_model = new Geo();
$geos = $geo_model->getGeoList($ipValid);
require 'app/Views/Geo_View.php';
}
示例2: _get_ranges
function _get_ranges(&$config)
{
// get all ip ranges
$ranges = array();
foreach ($config as $carrier => $carrier_ips) {
foreach ($carrier_ips as $cidr) {
$cidr = @Net_IPv4::parseAddress($cidr);
$ranges[] = array('broadcast' => $this->ip2double($cidr->broadcast), 'carrier' => $carrier, 'network' => $this->ip2double($cidr->network));
}
}
// sort
usort($ranges, array($this, 'compareByNetwork'));
// unite sequent ip range
$l = count($ranges);
$cur =& $ranges[0];
for ($i = 1; $i < $l; $i++) {
$next =& $ranges[$i];
$condition = $cur['broadcast'] + 1 === $next['network'] && $cur['carrier'] === $next['carrier'];
if ($condition) {
$cur['broadcast'] = $next['broadcast'];
unset($ranges[$i]);
} else {
$cur =& $ranges[$i];
}
}
$ranges = array_values($ranges);
// compile data
$retval = "<?php\n" . "// auto-generated by %s\n" . "// date: %s\n" . "return %s;\n";
$retval = sprintf($retval, __CLASS__, date('Y/m/d H:i:s'), var_export($ranges, true));
return $retval;
}
示例3: get_config_by_network
function get_config_by_network($ip, &$config_list)
{
if (!is_array($config_list)) {
return array();
}
foreach ($config_list as $network => $config) {
if (Net_IPv4::ipInNetwork($ip, $network)) {
return $config;
}
}
return array();
}
示例4: isMobileIPAddress
public function isMobileIPAddress()
{
$ipList = (array) (include sfContext::getInstance()->getConfigCache()->checkConfig('config/mobile_ip_address.yml'));
require_once 'Net/IPv4.php';
$result = false;
foreach ($ipList as $mobileIp) {
if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $mobileIp)) {
$result = true;
break;
}
}
return $result;
}
示例5: testWillcom
function testWillcom()
{
$this->mobile_ip->initialize($this->controller);
$ranges = $this->ranges['willcom'];
foreach ($ranges as $cidr) {
$cidr = @Net_IPv4::parseAddress($cidr);
$network = explode('.', $cidr->network);
$broadcast = explode('.', $cidr->broadcast);
$ip = "{$network[0]}.{$network[1]}.{$network[2]}";
for ($i = $network[3]; $i <= $broadcast[3]; $i++) {
$this->assertEqual($this->mobile_ip->carrier("{$ip}.{$i}"), 'willcom');
}
}
}
示例6: isMobileIPAddress
public function isMobileIPAddress()
{
require_once 'Net/IPv4.php';
$ipList = (array) (include sfContext::getInstance()->getConfigCache()->checkConfig('config/mobile_ip_address.yml'));
$carrier = strtolower($this->getMobile()->getCarrierLongName());
$list = array();
if (isset($ipList[$carrier])) {
$list = $ipList[$carrier];
}
$result = false;
foreach ($list as $mobileIp) {
if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $mobileIp)) {
$result = true;
break;
}
}
return $result;
}
示例7: MAX_remotehostPrivateAddress
function MAX_remotehostPrivateAddress($ip)
{
setupIncludePath();
require_once 'Net/IPv4.php';
$aPrivateNetworks = array('10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', '127.0.0.0/24');
foreach ($aPrivateNetworks as $privateNetwork) {
if (Net_IPv4::ipInNetwork($ip, $privateNetwork)) {
return true;
}
}
return false;
}
示例8: is_client_authorized
function is_client_authorized($clientip)
{
global $config;
if (isset($config['allow_unauth_graphs']) && $config['allow_unauth_graphs']) {
d_echo("Unauthorized graphs allowed\n");
return true;
}
if (isset($config['allow_unauth_graphs_cidr'])) {
foreach ($config['allow_unauth_graphs_cidr'] as $range) {
if (Net_IPv4::ipInNetwork($clientip, $range)) {
d_echo("Unauthorized graphs allowed from {$range}\n");
return true;
}
}
}
return false;
}
示例9: reformatIPv4forSearch
/**
* Reformat incomplete IPv4 address to decimal for search!
*/
function reformatIPv4forSearch($ip)
{
//remove % sign if present
$ip = str_replace("%", "", $ip);
//remove last .
$size = count($ip);
$lastChar = substr($ip, -1);
if ($lastChar == ".") {
$ip = substr($ip, 0, -1);
}
/* check if subnet provided, then we have all we need */
if (strpos($ip, "/") > 0) {
require_once 'PEAR/Net/IPv4.php';
$net = Net_IPv4::parseAddress($ip);
$result['low'] = transform2decimal($net->network);
$result['high'] = transform2decimal($net->broadcast);
} else {
/* if subnet is not provided maye wildcard is, so explode it to array */
$ip = explode(".", $ip);
//4 is ok
if (sizeof($ip) == 4) {
$temp = implode(".", $ip);
$result['low'] = $result['high'] = transform2decimal($temp);
} else {
if (sizeof($ip) == 3) {
$ip[3] = 0;
$result['low'] = transform2decimal(implode(".", $ip));
$ip[3] = 255;
$result['high'] = transform2decimal(implode(".", $ip));
} else {
if (sizeof($ip) == 2) {
$ip[2] = 0;
$ip[3] = 0;
$result['low'] = transform2decimal(implode(".", $ip));
$ip[2] = 255;
$ip[3] = 255;
$result['high'] = transform2decimal(implode(".", $ip));
} else {
if (sizeof($ip) == 1) {
$ip[1] = 0;
$ip[2] = 0;
$ip[3] = 0;
$result['low'] = transform2decimal(implode(".", $ip));
$ip[1] = 255;
$ip[2] = 255;
$ip[3] = 255;
$result['high'] = transform2decimal(implode(".", $ip));
} else {
$result['low'] = implode(".", $ip);
$result['high'] = implode(".", $ip);
}
}
}
}
}
//return result!
return $result;
}
示例10: ipInNetwork
/**
* Determines whether or not the supplied IP is within the supplied network.
*
* This function determines whether an IP address is within a network.
* The IP address ($ip) must be supplied in dot-quad format, and the
* network ($network) may be either a string containing a CIDR
* formatted network definition, or a Net_IPv4 object.
*
* @param string $ip A dot quad representation of an IP address
* @param string $network A string representing the network in CIDR format or a Net_IPv4 object.
* @return bool true if the IP address exists within the network
*/
function ipInNetwork($ip, $network)
{
if (!is_object($network) || strcasecmp(get_class($network), 'net_ipv4') != 0) {
$network = Net_IPv4::parseAddress($network);
}
if (strcasecmp(get_class($network), 'pear_error') === 0) {
return false;
}
$net = Net_IPv4::ip2double($network->network);
$bcast = Net_IPv4::ip2double($network->broadcast);
$ip = Net_IPv4::ip2double($ip);
unset($network);
if ($ip >= $net && $ip <= $bcast) {
return true;
}
return false;
}
示例11: list
</dl>';
}
echo "</a></li>";
}
/// SEARCH IP ADDRESSES
list($addr, $mask) = explode('/', $queryString);
$address_type = "ipv4";
if (is_numeric(stripos($queryString, ':abcdef'))) {
$address_type = 'ipv6';
}
switch ($address_type) {
case 'ipv6':
$ip_valid = Net_IPv6::checkIPv6($addr);
break;
case 'ipv4':
$ip_valid = Net_IPv4::validateIP($addr);
break;
}
# if ($ip_valid)
# {
# // If address valid -> seek occurrence in network
# if (!$mask) { $mask = ($address_type === 'ipv4') ? '32' : '128'; }#
# } else {
// If address not valid -> seek LIKE
$where .= ' AND A.`ipv4_address` LIKE ?';
$param[] = '%' . $addr . '%';
# }
// FIXME no v6 yet.
$query = 'SELECT * ';
$query .= 'FROM `ipv4_addresses` AS A ';
$query .= 'LEFT JOIN `ports` ON `A`.`port_id` = `ports`.`port_id` ';
示例12: array
$old_table[$entry['ifIndex']][$entry['ipv4_address']] = $entry;
}
// Process founded IPv4 addresses
$valid[$ip_version] = array();
$check_networks = array();
if (count($ip_data)) {
foreach ($ip_data as $ifIndex => $addresses) {
if (!isset($cache['port_index'][$device_id][$ifIndex])) {
continue;
}
// continue if ifIndex not found
$port_id = $cache['port_index'][$device_id][$ifIndex];
foreach ($addresses as $ipv4_address => $entry) {
$update_array = array();
$ipv4_mask = $entry['ipAdEntNetMask'];
$addr = Net_IPv4::parseAddress($ipv4_address . '/' . $ipv4_mask);
$ipv4_prefixlen = $addr->bitmask;
$ipv4_network = $addr->network . '/' . $ipv4_prefixlen;
$full_address = $ipv4_address . '/' . $ipv4_prefixlen;
// First check networks
$ipv4_network_id = dbFetchCell('SELECT `ipv4_network_id` FROM `ipv4_networks` WHERE `ipv4_network` = ?', array($ipv4_network));
if (empty($ipv4_network_id)) {
$ipv4_network_id = dbInsert(array('ipv4_network' => $ipv4_network), 'ipv4_networks');
echo 'N';
}
// Check IPs in DB
if (isset($old_table[$ifIndex][$ipv4_address])) {
foreach (array('ipv4_prefixlen', 'ipv4_network_id', 'port_id') as $param) {
if ($old_table[$ifIndex][$ipv4_address][$param] != ${$param}) {
$update_array[$param] = ${$param};
}
示例13: getFirstAvailableIPAddress
/**
* Get first available IP address
*/
function getFirstAvailableIPAddress($subnetId)
{
global $database;
/* get all ip addresses in subnet */
$query = 'SELECT `ip_addr` from `ipaddresses` where `subnetId` = "' . $subnetId . '" order by `ip_addr` ASC;';
/* execute */
try {
$ipAddresses = $database->getArray($query);
} catch (Exception $e) {
$error = $e->getMessage();
print "<div class='alert alert-danger'>" . _('Error') . ": {$error}</div>";
return false;
}
/* get subnet */
$query = 'SELECT `subnet`,`mask` from `subnets` where `id` = "' . $subnetId . '";';
$subnet2 = $database->getArray($query);
$subnet = $subnet2[0]['subnet'];
$mask = $subnet2[0]['mask'];
/* create array of IP addresses */
$ipaddressArray[] = $subnet;
foreach ($ipAddresses as $ipaddress) {
$ipaddressArray[] = $ipaddress['ip_addr'];
}
//get array size
$size = sizeof($ipaddressArray);
$curr = 0;
//get type
$type = IdentifyAddress($subnet);
// IPv4
if ($type == "IPv4") {
//if subnet is /32
if ($mask == "32") {
if ($size == 1) {
$firstAvailable = $ipaddressArray[0];
} else {
$firstAvailable = false;
}
} elseif ($mask == "31") {
if ($size == 1) {
$firstAvailable = $ipaddressArray[0];
} elseif ($size == 2) {
$delta = $ipaddressArray[1] - $ipaddressArray[0];
if ($delta == 1) {
$firstAvailable = $ipaddressArray[0];
} else {
$firstAvailable = gmp_strval(gmp_add($ipaddressArray[0], 1));
}
} else {
$firstAvailable = false;
}
} elseif ($size == 1) {
$firstAvailable = gmp_strval(gmp_add($ipaddressArray[0], 1));
} else {
//get first change -> delta > 1
for ($m = 1; $m <= $size - 1; $m++) {
$delta = gmp_strval(gmp_sub($ipaddressArray[$m], $ipaddressArray[$m - 1]));
//compare with previous
if ($delta != 1) {
$firstAvailable = gmp_strval(gmp_add($ipaddressArray[$m - 1], 1));
$m = $size;
} else {
$firstAvailable = gmp_strval(gmp_add($ipaddressArray[$m], 1));
}
}
//if bcast ignore!
require_once 'PEAR/Net/IPv4.php';
$Net_IPv4 = new Net_IPv4();
$net = $Net_IPv4->parseAddress(transform2long($subnet) . "/" . $mask);
if ($net->broadcast == transform2long($firstAvailable)) {
$firstAvailable = false;
}
}
} else {
//if subnet is /128
if ($mask == "128" && $type == "IPv6") {
if ($size == 1) {
$firstAvailable = $ipaddressArray[0];
} else {
$firstAvailable = false;
}
} elseif ($mask == "127" && $type == "IPv6") {
if ($size == 1) {
$firstAvailable = $ipaddressArray[0];
} elseif ($size == 2) {
$delta = $ipaddressArray[1] - $ipaddressArray[0];
if ($delta == 1) {
$firstAvailable = $ipaddressArray[0];
} else {
$firstAvailable = gmp_strval(gmp_add($ipaddressArray[0], 1));
}
} else {
$firstAvailable = false;
}
} elseif ($size == 1) {
$firstAvailable = gmp_strval($ipaddressArray[0]);
} elseif ($subnet == $ipaddressArray[0]) {
$firstAvailable = gmp_strval($subnet);
//.........这里部分代码省略.........
示例14: _checkAgent
/**
* ユーザーエージェントチェック
*
* @access private
*/
function _checkAgent()
{
if (!$this->isMobile()) {
return;
}
static $userAgent;
if ($userAgent === NULL) {
$userAgent = Net_UserAgent_Mobile::factory();
}
$container =& DIContainerFactory::getContainer();
$getdata =& $container->getComponent("GetData");
$config =& $getdata->getParameter("config");
//$configView =& $container->getComponent("configView");
//$config = $configView->getConfigByCatid(_SYS_CONF_MODID, _GENERAL_CONF_CATID);
$session =& $container->getComponent("Session");
$tel_id = $userAgent->getSerialNumber() . $userAgent->getUID();
$tel_id = !empty($tel_id) ? $userAgent->getUserAgent() . " " . $tel_id : "";
if (empty($tel_id)) {
$tel_id = $session->getParameter("_mobile_tel_id");
}
$this->_mobile_info = array("currier" => $userAgent->getCarrierLongName(), "user_agent" => $userAgent->getUserAgent(), "tel_id" => $tel_id, "utn" => $userAgent->isDoCoMo() ? " utn" : "", "model" => $userAgent->getModel(), "autologin" => $config[0]['autologin_use']['conf_value'] == _AUTOLOGIN_OK ? _AUTOLOGIN_OK : _OFF);
$session->setParameter("_mobile_tel_id", $tel_id);
if ($userAgent->isDoCoMo()) {
if (empty($_SERVER["HTTP_REFERER"])) {
$_SERVER["HTTP_REFERER"] = BASE_URL;
}
}
/*
* IPチェック(調査日 2010.09.01)
*/
$mobile_ip["DoCoMo"] = array("210.153.84.0/24", "210.136.161.0/24", "210.153.86.0/24", "124.146.174.0/24", "124.146.175.0/24", "202.229.176.0/24", "202.229.177.0/24", "202.229.178.0/24", "202.229.179.0/24", "111.89.188.0/24", "111.89.189.0/24", "111.89.190.0/24", "111.89.191.0/24", "210.153.87.0/24", "203.138.180.0/24", "203.138.181.0/24", "203.138.203.0/24");
$mobile_ip["EZWeb"] = array("210.230.128.224/28", "121.111.227.160/27", "61.117.1.0/28", "219.108.158.0/27", "219.125.146.0/28", "61.117.2.32/29", "61.117.2.40/29", "219.108.158.40/29", "219.125.148.0/25", "222.5.63.0/25", "222.5.63.128/25", "222.5.62.128/25", "59.135.38.128/25", "219.108.157.0/25", "219.125.145.0/25", "121.111.231.0/25", "121.111.227.0/25", "118.152.214.192/26", "118.159.131.0/25", "118.159.133.0/25", "118.159.132.160/27", "111.86.142.0/26", "111.86.141.64/26", "111.86.141.128/26", "111.86.141.192/26", "118.159.133.192/26", "111.86.143.192/27", "111.86.143.224/27", "111.86.147.0/27", "111.86.142.128/26", "111.86.142.192/26", "111.86.143.0/26", "61.117.0.128/25", "61.117.1.128/25", "218.222.1.0/25", "218.222.1.128/28", "218.222.1.160/28", "61.202.3.64/28", "219.125.148.160/27", "121.111.231.160/27", "219.125.148.192/27", "222.7.56.0/27", "222.7.56.32/27", "222.7.56.96/27", "222.7.56.128/27", "222.7.56.192/27", "222.7.56.224/27", "222.7.57.64/27", "222.7.57.96/27", "222.7.57.128/27", "222.7.57.160/27", "222.7.57.192/27", "222.7.57.224/27", "219.125.151.128/27", "219.125.151.160/27", "219.125.151.192/27", "222.7.57.32/27", "222.15.68.192/26", "59.135.39.128/27", "118.152.214.160/27", "118.152.214.128/27", "222.1.136.96/27", "222.1.136.64/27", "59.128.128.0/20", "210.169.40.0/24", "211.5.2.128/25", "222.7.57.0/24", "210.196.3.192/26", "211.5.7.0/24", "59.135.38.128/25", "210.196.5.192/26", "218.222.1.0/24", "61.117.0.0/24", "210.230.128.0/24", "61.117.1.0/24", "219.125.148.0/24", "210.230.141.192/26", "219.108.158.0/26", "61.117.2.0/26", "210.234.105.32/29", "210.251.1.192/26", "219.125.151.128/25", "210.234.108.64/26", "61.202.3.0/24", "210.251.2.0/27", "222.5.63.0/24", "211.5.1.0/24", "222.7.56.0/24");
$mobile_ip["Softbank"] = array("123.108.237.0/27", "202.253.96.224/27", "210.146.7.192/26", "210.175.1.128/25", "123.108.237.224/27", "202.253.96.0/27", "123.108.236.0/24", "202.179.203.0/24", "202.179.203.0/24", "210.146.60.128/25", "210.169.171.0/24", "210.169.176.0/24", "210.175.1.128/25", "210.169.130.112/28", "210.228.189.0/24", "123.108.236.0/24", "202.179.204.0/24", "210.146.60.192/26", "210.151.9.128/26", "210.228.189.0/24", "211.8.159.128/25", "123.108.237.240/28", "202.253.96.0/28", "123.108.237.240/28", "202.253.96.0/28", "219.73.128.0/17", "117.46.128.0/17");
$mobile_ip["WILLCOM"] = array("61.198.128.0/24", "61.198.129.0/24", "61.198.130.0/24", "61.198.131.0/24", "61.198.132.0/24", "61.198.133.0/24", "61.198.134.0/24", "61.198.135.0/24", "61.198.136.0/24", "61.198.137.0/24", "61.198.138.100/32", "61.198.138.101/32", "61.198.138.102/32", "61.198.138.103/32", "61.198.139.0/29", "61.198.139.128/27", "61.198.139.160/28", "61.198.140.0/24", "61.198.141.0/24", "61.198.142.0/24", "61.198.143.0/24", "61.198.160.0/24", "61.198.161.0/24", "61.198.162.0/24", "61.198.163.0/24", "61.198.164.0/24", "61.198.165.0/24", "61.198.166.0/24", "61.198.168.0/24", "61.198.169.0/24", "61.198.170.0/24", "61.198.171.0/24", "61.198.172.0/24", "61.198.173.0/24", "61.198.174.0/24", "61.198.175.0/24", "61.198.248.0/24", "61.198.249.0/24", "61.198.250.0/24", "61.198.251.0/24", "61.198.252.0/24", "61.198.253.0/24", "61.198.254.0/24", "61.198.255.0/24", "61.204.0.0/24", "61.204.2.0/24", "61.204.3.0/25", "61.204.3.128/25", "61.204.4.0/24", "61.204.5.0/24", "61.204.6.0/25", "61.204.6.128/25", "61.204.7.0/25", "61.204.92.0/24", "61.204.93.0/24", "61.204.94.0/24", "61.204.95.0/24", "125.28.0.0/24", "125.28.1.0/24", "125.28.15.0/24", "125.28.16.0/24", "125.28.17.0/24", "125.28.2.0/24", "125.28.3.0/24", "125.28.4.0/24", "125.28.5.0/24", "125.28.8.0/24", "210.168.246.0/24", "210.168.247.0/24", "210.169.92.0/24", "210.169.93.0/24", "210.169.94.0/24", "210.169.95.0/24", "210.169.96.0/24", "210.169.97.0/24", "210.169.98.0/24", "210.169.99.0/24", "211.126.192.128/25", "211.18.232.0/24", "211.18.233.0/24", "211.18.234.0/24", "211.18.235.0/24", "211.18.236.0/24", "211.18.237.0/24", "219.108.10.0/24", "219.108.11.0/24", "219.108.12.0/24", "219.108.13.0/24", "219.108.14.0/24", "219.108.15.0/24", "219.108.7.0/24", "219.108.8.0/24", "219.108.9.0/24", "221.119.0.0/24", "221.119.1.0/24", "221.119.2.0/24", "221.119.3.0/24", "221.119.4.0/24", "221.119.6.0/24", "221.119.7.0/24", "221.119.8.0/24", "221.119.9.0/24", "114.20.49.0/24", "114.20.50.0/24", "114.20.51.0/24", "114.20.52.0/24", "114.20.53.0/24", "114.20.54.0/24", "114.20.55.0/24", "114.20.56.0/24", "114.20.57.0/24", "114.20.58.0/24", "114.20.59.0/24", "114.20.60.0/24", "114.20.61.0/24", "114.20.62.0/24", "114.20.63.0/24", "114.20.64.0/24", "114.20.65.0/24", "114.20.66.0/24", "114.20.67.0/24", "114.21.255.0/27", "219.108.2.0/24", "219.108.3.0/24", "125.28.6.0/24", "125.28.7.0/24", "125.28.11.0/24", "125.28.12.0/24", "125.28.13.0/24", "125.28.14.0/24", "211.18.238.0/24", "211.18.239.0/24", "219.108.4.0/24", "219.108.5.0/24", "219.108.6.0/24", "221.119.5.0/24", "124.211.23.0/26");
$this->_mobile_info["ip_address"] = $_SERVER['REMOTE_ADDR'];
$this->_mobile_info["ip_addr_zone"] = "";
$this->_mobile_info["proper_route"] = _OFF;
foreach ($mobile_ip as $key => $ip_list) {
foreach ($ip_list as $zone) {
$valid = Net_IPv4::ipInNetwork($this->_mobile_info["ip_address"], $zone);
if ($valid) {
$this->_mobile_info["ip_addr_zone"] = $zone;
$this->_mobile_info["proper_route"] = _ON;
break;
}
}
if ($valid) {
break;
}
}
if (empty($this->_mobile_info['proper_route'])) {
$this->_mobile_info['autologin'] = _OFF;
}
}
示例15: perform_snmp_scan
}
if (isset($opts['n'])) {
$force_network = true;
}
if (isset($opts['b'])) {
$force_broadcast = true;
}
if (isset($opts['r'])) {
$net = Net_IPv4::parseAddress($opts['r']);
if (ip2long($net->network) !== false) {
perform_snmp_scan($net, $force_network, $force_broadcast);
echo 'Scanned ' . $stats['count'] . ' IPs, Already known ' . $stats['known'] . ' Devices, Added ' . $stats['added'] . ' Devices, Failed to add ' . $stats['failed'] . ' Devices.' . PHP_EOL;
echo 'Runtime: ' . (microtime(true) - $ts) . ' secs' . PHP_EOL;
} else {
echo 'Could not interpret supplied CIDR noted IP-Range: ' . $opts['r'] . PHP_EOL;
exit(2);
}
} elseif (isset($config['nets']) && !empty($config['nets'])) {
if (!is_array($config['nets'])) {
$config['nets'] = array($config['nets']);
}
foreach ($config['nets'] as $subnet) {
$net = Net_IPv4::parseAddress($subnet);
perform_snmp_scan($net, $force_network, $force_broadcast);
}
echo 'Scanned ' . $stats['count'] . ' IPs, Already know ' . $stats['known'] . ' Devices, Added ' . $stats['added'] . ' Devices, Failed to add ' . $stats['failed'] . ' Devices.' . PHP_EOL;
echo 'Runtime: ' . (microtime(true) - $ts) . ' secs' . PHP_EOL;
} else {
echo 'Please either add a range argument with \'-r <CIDR_RANGE>\' or define $config[\'nets\'] in your config.php' . PHP_EOL;
exit(2);
}