Merge pull request #4552 from crcro/refactor-os-discovery-n-r

refactor: OS discovery files (n - r)
This commit is contained in:
Neil Lathwood
2016-09-23 22:51:22 +01:00
committed by GitHub
co-authored by GitHub
47 changed files with 139 additions and 268 deletions
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (stristr($sysDescr, 'NetApp')) {
$os = 'netapp';
}
if (str_contains($sysDescr, 'NetApp')) {
$os = 'netapp';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^NetBSD/', $sysDescr)) {
$os = 'netbsd';
}
if (starts_with($sysDescr, 'NetBSD')) {
$os = 'netbsd';
}
+4 -6
View File
@@ -1,9 +1,7 @@
<?php
if (!$os) {
if (stristr($sysDescr, 'ProSafe')) {
$os = 'netgear';
} elseif (strpos($sysObjectId, '1.3.6.1.4.1.4526') !== false) {
$os = 'netgear';
}
if (str_contains($sysDescr, 'ProSafe')) {
$os = 'netgear';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.4526')) {
$os = 'netgear';
}
+4 -8
View File
@@ -1,11 +1,7 @@
<?php
if (!$os) {
if (preg_match('/^NetMan.*plus/', $sysDescr)) {
$os = 'netmanplus';
}
if (strstr($sysObjectId, '.1.3.6.1.4.1.5491.6')) {
$os = 'netmanplus';
}
if (starts_with($sysDescr, 'NetMan') && str_contains($sysDescr, 'plus')) {
$os = 'netmanplus';
} elseif (starts_with($sysObjectId, '.1.3.6.1.4.1.5491.6')) {
$os = 'netmanplus';
}
+2 -4
View File
@@ -11,8 +11,6 @@
* the source code distribution for details.
*/
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.46242')) {
$os = 'netonix';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.46242')) {
$os = 'netonix';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^Netopia /', $sysDescr)) {
$os = 'netopia';
}
if (starts_with($sysDescr, 'Netopia')) {
$os = 'netopia';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.5951.1')) {
$os = 'netscaler';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.5951.1')) {
$os = 'netscaler';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^Net Vision/', $sysDescr)) {
$os = 'netvision';
}
if (starts_with($sysDescr, 'Net Vision')) {
$os = 'netvision';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'Novell NetWare')) {
$os = 'netware';
}
if (str_contains($sysDescr, 'Novell NetWare')) {
$os = 'netware';
}
+3 -5
View File
@@ -9,9 +9,7 @@
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (str_contains($sysDescr, 'Nimble Storage')) {
$os = 'nimbleos';
}
if (str_contains($sysDescr, 'Nimble Storage')) {
$os = 'nimbleos';
}
+3 -4
View File
@@ -1,6 +1,5 @@
<?php
if (!$os) {
if (starts_with($sysObjectId, '.1.3.6.1.4.1.7779.')) {
$os = 'nios';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.7779.')) {
$os = 'nios';
}
+2 -11
View File
@@ -1,14 +1,5 @@
<?php
// MaAfee SIEM Nitro
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.23128.1000.1.1')) {
$os = 'nitro';
} elseif (strstr($sysObjectId, '.1.3.6.1.4.1.23128.1000.3.1')) {
$os = 'nitro';
} elseif (strstr($sysObjectId, '.1.3.6.1.4.1.23128.1000.7.1')) {
$os = 'nitro';
} elseif (strstr($sysObjectId, '.1.3.6.1.4.1.23128.1000.11.1')) {
$os = 'nitro';
}
if (starts_with($sysObjectId, array('.1.3.6.1.4.1.23128.1000.1.1', '.1.3.6.1.4.1.23128.1000.3.1', '.1.3.6.1.4.1.23128.1000.7.1', '.1.3.6.1.4.1.23128.1000.11.1'))) {
$os = 'nitro';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, "Brocade VDX")||strstr($sysDescr, "BR-VDX")||strstr($sysDescr, "VDX67")) {
$os = "nos";
}
if (str_contains($sysDescr, array('Brocade VDX', 'BR-VDX', 'VDX67'))) {
$os = 'nos';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'NRG Network Printer')) {
$os = 'nrg';
}
if (str_contains($sysDescr, 'NRG Network Printer')) {
$os = 'nrg';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'NX-OS(tm)')) {
$os = 'nxos';
}
if (str_contains($sysDescr, 'NX-OS(tm)')) {
$os = 'nxos';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'OKI OkiLAN')) {
$os = 'okilan';
}
if (str_contains($sysDescr, 'OKI OkiLAN')) {
$os = 'okilan';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.12124.1')) {
$os = 'onefs';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.12124.1')) {
$os = 'onefs';
}
+3 -4
View File
@@ -1,6 +1,5 @@
<?php
if (!$os) {
if (str_contains($sysDescr, 'Cisco ONS')) {
$os = 'ons';
}
if (str_contains($sysDescr, 'Cisco ONS')) {
$os = 'ons';
}
+2 -7
View File
@@ -1,10 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.30155.23.1')) {
$os = 'openbsd';
} //end if
if (preg_match('/OpenBSD/', $sysDescr)) {
$os = 'openbsd';
} //end if
if (starts_with($sysObjectId, '.1.3.6.1.4.1.30155.23.1') || str_contains($sysDescr, 'OpenBSD')) {
$os = 'openbsd';
}
+2 -4
View File
@@ -10,8 +10,6 @@
* the source code distribution for details.
*/
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.42.2.200.2.1.1')) {
$os = 'oracle-ilom';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.42.2.200.2.1.1')) {
$os = 'oracle-ilom';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'PacketShaper')) {
$os = 'packetshaper';
}
if (str_contains($sysDescr, 'PacketShaper')) {
$os = 'packetshaper';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'Palo Alto Networks')) {
$os = 'panos';
}
if (str_contains($sysDescr, 'Palo Alto Networks')) {
$os = 'panos';
}
+2 -6
View File
@@ -1,9 +1,5 @@
<?php
if (!$os) {
if ($sysDescr == 'SNMP TME') {
$os = 'papouch-tme';
} elseif ($sysDescr == 'TME') {
$os = 'papouch-tme';
}
if (str_contains($sysDescr, array('SNMP TME', 'TME'))) {
$os = 'papouch-tme';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.11606')) {
$os = 'pbn';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.11606')) {
$os = 'pbn';
}
+3 -4
View File
@@ -9,8 +9,7 @@
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (stristr($sysDescr, 'Perle MCR-MGT')) {
$os = 'perle';
}
if (str_contains($sysDescr, 'Perle MCR-MGT')) {
$os = 'perle';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/Cisco\ PIX/', $sysDescr)) {
$os = 'pixos';
}
if (str_contains($sysDescr, 'Cisco PIX')) {
$os = 'pixos';
}
+3 -5
View File
@@ -9,9 +9,7 @@
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (str_contains($sysObjectId, '1.3.6.1.4.1.10456.1.1516')) {
$os = 'planetos';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.10456.1.1516')) {
$os = 'planetos';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^POWERALERT/i', $sysDescr)) {
$os = 'poweralert';
}
if (starts_with($sysDescr, 'POWERALERT')) {
$os = 'poweralert';
}
+2 -5
View File
@@ -12,9 +12,6 @@
* the source code distribution for details.
*/
// sysDescr.0 = STRING: Powercode BMU
if (!$os) {
if (stristr($sysDescr, 'Powercode BMU')) {
$os = 'powercode';
}
if (str_contains($sysDescr, 'Powercode BMU')) {
$os = 'powercode';
}
+8 -11
View File
@@ -1,14 +1,11 @@
<?php
if (!$os) {
if (stristr($sysDescr, 'PowerConnect ') && !stristr($sysDescr, 'ArubaOS')) {
$os = 'powerconnect';
} elseif (preg_match('/Dell.*Gigabit\ Ethernet/i', $sysDescr)) {
$os = 'powerconnect';
} elseif (strstr($sysDescr, 'Neyland 24T')) {
/* PowerConnect 5324 */
$os = 'powerconnect';
} elseif (stristr(snmp_get($device, '1.3.6.1.4.1.674.10895.3000.1.2.100.1.0', '-Oqv', ''), 'PowerConnect')) {
$os = 'powerconnect';
}
if (str_contains($sysDescr, 'PowerConnect') && !str_contains($sysDescr, 'ArubaOS')) {
$os = 'powerconnect';
} elseif (str_contains($sysDescr, 'Neyland 24T')) {
$os = 'powerconnect';
} elseif (str_contains($sysDescr, 'Dell', true) && str_contains($sysDescr, 'Gigabit Ethernet', true)) {
$os = 'powerconnect';
} elseif (str_contains(snmp_get($device, '.1.3.6.1.4.1.674.10895.3000.1.2.100.1.0', '-Oqv', ''), 'PowerConnect', true)) {
$os = 'powerconnect';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.674.10893.2.102')) {
$os = 'powervault';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.674.10893.2.102')) {
$os = 'powervault';
}
+3 -4
View File
@@ -9,8 +9,7 @@
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (strpos($sysObjectId, '.1.3.6.1.4.1.935.10') !== false && $sysDescr == 'Network Management Card for UPS') {
$os = 'powerwalker';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.935.10') || starts_with($sysDescr, 'Network Management Card for UPS')) {
$os = 'powerwalker';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.534')) {
$os = 'powerware';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.534')) {
$os = 'powerware';
}
+4 -7
View File
@@ -1,10 +1,7 @@
<?php
if (!$os) {
if (preg_match('/^Prestige \d/', $sysDescr)) {
$os = 'prestige';
}
if (preg_match('/^P-.*-/', $sysDescr)) {
$os = 'prestige';
}
if (starts_with($sysDescr, array('Prestige '))) {
$os = 'prestige';
} elseif (preg_match('/^P-.*-/', $sysDescr)) {
$os = 'prestige';
}
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.9.1.2307')) {
$os = 'primeinfrastructure';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.9.1.2307')) {
$os = 'primeinfrastructure';
}
+8 -12
View File
@@ -1,15 +1,11 @@
<?php
if (!$os) {
if (stristr($sysDescr, 'ProCurve') || stristr($sysDescr, 'HP 1820')) {
$os = 'procurve';
} elseif (preg_match('/eCos-[0-9.]+/', $sysDescr)) {
$os = 'procurve';
} elseif (preg_match('/HP(.+)2530(.+)/', $sysDescr)) {
//hp aruba 2530 series
$os = 'procurve';
} elseif (preg_match('/HP(.+)54[0-1][2-6]R(.+)/', $sysDescr)) {
//hp aruba 5406R and 5412R series
$os = 'procurve';
}
if (str_contains($sysDescr, array('ProCurve', 'HP 1820'))) {
$os = 'procurve';
} elseif (preg_match('/eCos-[0-9.]+/', $sysDescr)) {
$os = 'procurve';
} elseif (preg_match('/HP(.+)2530(.+)/', $sysDescr)) {
$os = 'procurve';
} elseif (preg_match('/HP(.+)54[0-1][2-6]R(.+)/', $sysDescr)) {
$os = 'procurve';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.11898.2.4.9')) {
$os = 'proxim';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.11898.2.4.9')) {
$os = 'proxim';
}
+3 -4
View File
@@ -9,8 +9,7 @@
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (strstr($sysDescr, 'Pulse Connect Secure')) {
$os = 'pulse';
}
if (str_contains($sysDescr, 'Pulse Connect Secure')) {
$os = 'pulse';
}
+3 -4
View File
@@ -1,6 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.4413') || strstr($sysObjectId, '.1.3.6.1.4.1.7244') && (stristr($sysDescr, 'vxworks') || stristr($sysDescr, 'Quanta'))) {
$os = 'quanta';
}
if (starts_with($sysObjectId, array('.1.3.6.1.4.1.4413', '.1.3.6.1.4.1.7244')) && str_contains($sysDescr, array('vxworks', 'Quanta'))) {
$os = 'quanta';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'AT-8000')) {
$os = 'radlan';
} //end if
if (str_contains($sysDescr, 'AT-8000')) {
$os = 'radlan';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.8886')) {
$os = 'raisecom';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.8886')) {
$os = 'raisecom';
}
+2 -16
View File
@@ -1,19 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'Raritan')) {
$os = 'raritan';
}
}
if (!$os) {
if (strstr($sysDescr, 'PX2')) {
$os = 'raritan';
}
}
if (!$os) {
if (strstr($sysDescr, 'Raritan')) {
$os = 'raritan';
}
if (str_contains($sysDescr, array('Raritan', 'PX2'))) {
$os = 'raritan';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/Redback/', $sysDescr)) {
$os = 'redback';
}
if (str_contains($sysDescr, 'Redback')) {
$os = 'redback';
}
+2 -8
View File
@@ -1,11 +1,5 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'RICOH Aficio')) {
$os = 'ricoh';
}
if (stristr($sysDescr, 'RICOH Network Printer')) {
$os = 'ricoh';
}
if (str_contains($sysDescr, array('RICOH Aficio', 'RICOH Network Printer'))) {
$os = 'ricoh';
}
+3 -4
View File
@@ -9,8 +9,7 @@
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (!$os) {
if (strpos($sysObjectId, '1.3.6.1.4.1.17163.1.1') !== false) {
$os = 'riverbed';
}
if (starts_with($sysObjectId, '.1.3.6.1.4.1.17163.1.1')) {
$os = 'riverbed';
}
+13 -22
View File
@@ -1,25 +1,16 @@
<?php
if (!$os) {
// RouterOS <= 4
// sysDescr.0 = STRING: router
if ($sysDescr == 'router') {
if (is_numeric(snmp_get($device, 'SNMPv2-SMI::enterprises.14988.1.1.4.3.0', '-Oqv', ''))) {
$os = 'routeros';
}
}
// Routeros >= 5
// sysDescr.0 = STRING: RouterOS RB493AH
if (preg_match('/^RouterOS/', $sysDescr)) {
$os = 'routeros';
}
// poll Cisco AAA MIB
if (!empty($os)) {
$extra_mibs = array(
"ciscoAAASessionMIB" => "CISCO-AAA-SESSION-MIB",
);
register_mibs($device, $extra_mibs, "includes/discovery/os/routeros.inc.php");
}
if (starts_with($sysDescr, 'router') && is_numeric(snmp_get($device, 'SNMPv2-SMI::enterprises.14988.1.1.4.3.0', '-Oqv', ''))) {
$os = 'routeros';
}
if (starts_with($sysDescr, 'RouterOS')) {
$os = 'routeros';
}
if (!empty($os)) {
$extra_mibs = array(
"ciscoAAASessionMIB" => "CISCO-AAA-SESSION-MIB",
);
register_mibs($device, $extra_mibs, "includes/discovery/os/routeros.inc.php");
}
+9 -11
View File
@@ -12,16 +12,14 @@
* the source code distribution for details.
*/
if (!$os) {
if (strstr($sysObjectId, '.1.3.6.1.4.1.25053.3.1')) {
$os = 'ruckuswireless';
if (starts_with($sysObjectId, '.1.3.6.1.4.1.25053.3.1')) {
$os = 'ruckuswireless';
$ruckus_mibs = array(
"ruckusZDSystemStats" => "RUCKUS-ZD-SYSTEM-MIB",
"ruckusZDWLANTable" => "RUCKUS-ZD-WLAN-MIB",
"ruckusZDWLANAPTable" => "RUCKUS-ZD-WLAN-MIB",
"ruckusZDWLANAPRadioStatsTable" => "RUCKUS-ZD-WLAN-MIB",
);
register_mibs($device, $ruckus_mibs, "includes/discovery/os/ruckuswireless.inc.php");
}
$ruckus_mibs = array(
"ruckusZDSystemStats" => "RUCKUS-ZD-SYSTEM-MIB",
"ruckusZDWLANTable" => "RUCKUS-ZD-WLAN-MIB",
"ruckusZDWLANAPTable" => "RUCKUS-ZD-WLAN-MIB",
"ruckusZDWLANAPRadioStatsTable" => "RUCKUS-ZD-WLAN-MIB",
);
register_mibs($device, $ruckus_mibs, "includes/discovery/os/ruckuswireless.inc.php");
}