} 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); }
$vdebug = true; } $debug = true; } if (isset($opts['l'])) { echo ' * = Known Device; . = Unpingable Device; + = Added Device; - = Failed To Add Device; | = Excluded by config.php' . PHP_EOL; } if (isset($opts['r'])) { $net = Net_IPv4::parseAddress($opts['r']); if (ip2long($net->network) !== false) { perform_snmp_scan($net); 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); } 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); }