* @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Scientific-Atlanta, Inc. $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); if ($oid == '1.3.6.1.4.1.1429.2.2.6.2') { $details->model = 'D98xx Program Receiver'; $details->type = 'satellite receiver'; $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.1429.2.2.4.1.7.0"); } # attempt to refine the model number $temp_model = ''; $temp_model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.1429.2.2.4.1.6.0"); if (!empty($temp_model)) { $temp_array = explode('_', $temp_model); if ($temp_array[0] != '') { $details->model = $temp_array[0] . ' Program Receiver'; } } unset($temp_model); unset($tmp_array); if ($oid == '1.3.6.1.4.1.1429.2.1.6.1.0.2.0.1') { $details->model = 'WebSTAR DPC2100 Series'; $details->type = 'cable modem'; } return $details; };
# # For further information on Open-AudIT or for a license other than AGPL please see # www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor NetApp $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); if ($oid == '1.3.6.1.4.1.789.2.1') { $details->model = 'Filer'; $details->type = 'nas'; } if ($oid == '1.3.6.1.4.1.789.2.2') { $details->model = 'Net Cache'; $details->type = 'web cache'; } if ($oid == '1.3.6.1.4.1.789.2.3') { $details->model = 'Clustered Filer'; $details->type = 'nas'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.4874.2.2.2.1.3.4.1.9.0"); return $details; };
} if ($oid == '1.3.6.1.4.1.25053.3.1.3.2') { $details->model = 'Wireless Metro MM2211'; } if ($oid == '1.3.6.1.4.1.25053.3.1.3.3') { $details->model = 'Wireless Metro MM2221'; } if ($oid == '1.3.6.1.4.1.25053.3.1.4') { $details->model = 'Wireless Hotzone'; } if ($oid == '1.3.6.1.4.1.25053.3.1.4.1') { $details->model = 'Wireless Hotzone ZF2925'; } if ($oid == '1.3.6.1.4.1.25053.3.1.4.2') { $details->model = 'Wireless Hotzone ZF2942'; } if ($oid == '1.3.6.1.4.1.25053.3.1.4.3') { $details->model = 'Wireless Hotzone ZF7942'; } if ($oid == '1.3.6.1.4.1.25053.3.1.4.4') { $details->model = 'Wireless Hotzone ZF7962'; } if ($oid == '1.3.6.1.4.1.25053.3.1.4.5') { $details->model = 'Wireless Hotzone ZF2741'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.25053.1.1.2.1.1.1.2.0"); if (empty($details->model)) { $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.25053.1.1.2.1.1.1.1.0"); } return $details; };
$details->model = 'Security Blade IMLB'; $details->type = 'network device'; } if ($oid == '1.3.6.1.4.1.25506.11.4.4') { $details->model = 'Security Blade LSQ1FWBSC0'; $details->type = 'network device'; } if ($oid == '1.3.6.1.4.1.25506.11.4.5') { $details->model = 'Security Blade LSQM1LBC0'; $details->type = 'network device'; } if ($oid == '1.3.6.1.4.1.25506.11.4.6') { $details->model = 'Security Blade LSQ1NSMSC0'; $details->type = 'network device'; } if ($oid == '1.3.6.1.4.1.25506.11.4.7') { $details->model = 'Security Blade LSR1FW2A1'; $details->type = 'network device'; } if ($oid == '1.3.6.1.4.1.25506.11.4.8') { $details->model = 'Security Blade LSR1LB1A1'; $details->type = 'network device'; } if ($oid == '1.3.6.1.4.1.25506.11.4.9') { $details->model = 'Security Blade LSR1NSM1A1'; $details->type = 'network device'; } # serial $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.11.1"); return $details; };
if (is_array($guest_name) and count($guest_name) > 0) { $details->class = 'hypervisor'; foreach ($guest_name as $key => $value) { $guest = new stdClass(); $guest->vm_id = str_replace('.1.3.6.1.4.1.6876.2.1.1.2.', '', $key); $guest->net = array(); $guest_mac = my_snmp_real_walk($ip, $credentials, "1.3.6.1.4.1.6876.2.4.1.7." . $guest->vm_id); if (isset($guest_mac) and is_array($guest_mac) and count($guest_mac) > 0) { if (!empty($guest_mac[0])) { foreach ($guest_mac[0] as $k => $v) { if ($v != '') { $mk = str_replace(".1.3.6.1.4.1.6876.2.4.1.7." . $guest['id'] . '.', '', $k); $guest->net[$mk]['mac'] = snmp_clean($v); $guest->net[$mk]['mac'] = strtolower(str_replace(" ", ":", $guest['net'][$mk]['mac'])); $guest->net[$mk]['desc'] = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.2.4.1.4." . $guest->vm_id . "." . $mk); } } } } $guest->uuid = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.2.1.1.10." . $guest->vm_id); $guest->memory = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.2.1.1.5." . $guest->vm_id); $guest->cpu = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.2.1.1.9." . $guest->vm_id); $guest->status = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.2.1.1.6." . $guest->vm_id); $guest->config_file = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.2.1.1.3." . $guest->vm_id); $guest->vm_group = ''; $guests[] = $guest; unset($guest); unset($guest_mac); } } unset($guest_name);
# www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Riverbed $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); # http://www.circitor.fr/Mibs/Html/STEELHEAD-MIB.php #if ($oid == '1.3.6.1.4.1.17163.1.1') { $details->model = 'Riverbed Steelhead XX20'; $details->type = 'wan accelerator'; } #if ($oid == '1.3.6.1.4.1.17163.1.2') { $details->model = 'Riverbed Steelhead CMC8000'; $details->type = 'wan accelerator'; } #if ($oid == '1.3.6.1.4.1.17163.1.3') { $details->model = 'Riverbed Steelhead IC9200'; $details->type = 'wan accelerator'; } $details->type = 'wan accelerator'; # model $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.17163.1.1.1.1.0"); if (empty($details->model)) { $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.17163.1.51.1.1.0"); } # serial $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.17163.1.1.1.2.0"); if (empty($details->serial)) { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.17163.1.51.1.2.0"); } return $details; };
if ($oid == '1.3.6.1.4.1.207.1.4.78') { $details->model = 'AT 8024M'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.207.1.4.80') { $details->model = 'AT 8O26FC'; $details->type = 'unknown'; } if ($oid == '1.3.6.1.4.1.207.1.4.86') { $details->model = 'AT 8012M'; $details->type = 'unknown'; } if ($oid == '1.3.6.1.4.1.207.1.4.89') { $details->model = 'AT 8026T'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.207.1.4.9') { $details->model = 'AT 8200'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.207.1.4.98') { $details->model = 'AT 8524M'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.207.1.4.99') { $details->model = 'AT 8550GB'; $details->type = 'switch'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.207.8.4.4.5.2.1.5"); return $details; };
$details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.11863.1.1.6') { $details->model = 'TL-SL3428un'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.11863.1.1.7') { $details->model = 'TL-SG5428'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.11863.1.1.13') { $details->model = 'TL-SG2424'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.11863.1.1.59') { $details->model = 'TL-SL5428'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.11863.100.101') { $details->model = 'TL-SL3428'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.11863.100.102') { $details->model = 'TL-SL3452'; $details->type = 'switch'; } if (empty($details->model)) { $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.16.19.3.0"); } return $details; };
# # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Frogfoot Networks $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); $details = new stdClass(); # manufacturer $details->manufacturer = my_snmp_get($ip, $credentials, "1.2.840.10036.3.1.2.1.2.5"); $details->os_name = my_snmp_get($ip, $credentials, "1.2.840.10036.3.1.2.1.4.5"); # serial $details->serial = my_snmp_get($ip, $credentials, "1.2.840.10036.1.1.1.1.5"); # model $details->model = my_snmp_get($ip, $credentials, "1.2.840.10036.3.1.2.1.3.5"); # maybe we have a Ubiquiti device if (stripos($details->manufacturer, 'ubiquiti') !== false) { $details->type = 'wap'; $details->icon = 'wap'; $details->os_group = 'Linux'; $details->os_family = 'Ubiquiti AirOS'; $details->os_name = 'Ubiquiti AirOS version ' . $temp_os_name; } return $details; };
} if ($oid == '1.3.6.1.4.1.890.1.6.9') { $details->model = 'zywall100'; $details->type = 'unknown'; } if ($oid == '1.3.6.1.4.1.890.1.7') { $details->model = 'atmEncryptor'; $details->type = 'unknown'; } if ($oid == '1.3.6.1.4.1.890.1.8') { $details->model = 'serviceGateway'; $details->type = 'unknown'; } if ($oid == '1.3.6.1.4.1.890.1.8.1') { $details->model = 'serviceGWCommon'; $details->type = 'unknown'; } if ($oid == '1.3.6.1.4.1.890.1.8.2') { $details->model = 'vsg1000'; $details->type = 'unknown'; } if ($oid == '1.3.6.1.4.1.890.1.8.3') { $details->model = 'vsg1200'; $details->type = 'unknown'; } if ($details->type = '' or $details->type == 'unknown') { $details->type == 'unknown'; $details->type = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.890.1.2.11.1.1.1.0"); } return $details; };
# ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Alcatel # NOTE - this is VERY much guesswork. # http://www.zhone.com/support/manuals/docs/AZ/SNMP-A2-GB20-00.pdf $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); $details->manufacturer = 'Alcatel'; $i = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.8059.1.1.2.1.1.1.1"); if ($i == '1') { $details->model = '12000'; $details->type = 'dslam'; } if ($i == '2') { $details->model = '4000'; $details->type = 'dslam'; } if ($i == '3') { $details->model = 'Mini DSLAM'; $details->type = 'dslam'; } if ($i == '4') { $details->model = 'Micro DSLAM'; $details->type = 'dslam';
if ($oid == '1.3.6.1.4.1.3224.1.52') { $details->model = 'NetScreen SSG140'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.3224.1.54') { $details->model = 'NetScreen SSG320'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.3224.1.55') { $details->model = 'NetScreen SSG350'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.3224.1.6') { $details->model = 'NetScreen Ns500'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.3224.1.7') { $details->model = 'NetScreen Ns50'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.3224.1.8') { $details->model = 'NetScreen Ns25'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.3224.1.9') { $details->model = 'NetScreen Ns204'; $details->type = 'firewall'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.3224.7.1.5.0"); return $details; };
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Open-AudIT (most likely in a file named LICENSE). # If not, see <http://www.gnu.org/licenses/> # # For further information on Open-AudIT or for a license other than AGPL please see # www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Ricoh $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.367.3.2.1.2.1.4.0"); $details->hostname = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.367.3.2.1.6.1.1.7.1"); # serial # $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.367.3.2.1.2.1.4.0"); # hostname # $details->hostname = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.367.3.2.1.6.1.1.7.1"); return $details; };
# along with Open-AudIT (most likely in a file named LICENSE). # If not, see <http://www.gnu.org/licenses/> # # For further information on Open-AudIT or for a license other than AGPL please see # www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor VMware $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); $model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.1.1.0"); $version = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.1.2.0"); $details->model = $model . " (" . $version . ")"; $details->model = str_replace("\"", "", $details->model); $details->os_group = "VMware"; $details->os_family = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6876.1.1.0"); $details->os_family = str_replace("\"", "", $details->os_family); $details->os_name = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.1.0"); $details->os_name = str_replace("\"", "", $details->os_name); $details->type = 'computer'; $details->class = 'hypervisor'; return $details; };
# Open-AudIT is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Open-AudIT (most likely in a file named LICENSE). # If not, see <http://www.gnu.org/licenses/> # # For further information on Open-AudIT or for a license other than AGPL please see # www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Isilon $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); if ($oid == '1.3.6.1.4.1.12124.1') { $details->type = 'storage misc'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.12124.2.51.1.3.1"); $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.12124.2.51.1.4.1"); return $details; };
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Open-AudIT (most likely in a file named LICENSE). # If not, see <http://www.gnu.org/licenses/> # # For further information on Open-AudIT or for a license other than AGPL please see # www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Buffalo $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); if ($oid == '1.3.6.1.4.1.5951.1') { $details->model = 'Load Balancer'; $details->type = 'load balancer'; } $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.5951.4.1.1.11.0"); $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.5951.4.1.1.14.0"); return $details; };
if ($oid == '1.3.6.1.4.1.2636.1.1.1.2.8') { $details->model = 'Juniper M40e'; $details->type = 'router'; } if ($oid == '1.3.6.1.4.1.2636.1.1.1.2.80') { $details->model = 'Juniper DELL JSRX5800'; $details->type = 'gateway'; } if ($oid == '1.3.6.1.4.1.2636.1.1.1.2.81') { $details->model = 'Juniper DELL JSRX5600'; $details->type = 'gateway'; } if ($oid == '1.3.6.1.4.1.2636.1.1.1.2.82') { $details->model = 'Juniper QFX Switch'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.2636.1.1.1.2.9') { $details->model = 'Juniper M320'; $details->type = 'router'; } if ($oid == '1.3.6.1.4.1.2636.1.1.1.2.90') { $details->model = 'MX5'; $details->type = 'unknown'; } if ($oid == '1.3.6.1.4.1.2636.3.41.1.1.5.5') { $details->model = 'WXC-2600'; $details->type = 'unknown'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.2636.3.1.3.0"); return $details; };
$details->model = 'APC Environmental Management System'; $details->type = 'ups'; } if ($oid == '1.3.6.1.4.1.318.1.3.8.3') { $details->model = 'APC Environmental Monitoring Unit'; $details->type = 'ups'; } if ($oid == '1.3.6.1.4.1.318.1.3.8.4') { $details->model = 'mem'; $details->type = 'ups'; } if ($oid == '1.3.6.1.4.1.318.1.3.9') { $details->model = 'redundantSwitch'; $details->type = 'ups'; } $temp_model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.318.1.1.1.1.1.1.0"); if (empty($temp_model)) { $temp_model = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.33.1.1.2.0"); } if (empty($details->model) and !empty($temp_model)) { $details->model = $temp_model; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.318.1.1.1.1.2.3.0"); if (empty($details->serial)) { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.318.1.1.4.1.5.0"); } if (empty($details->serial)) { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.318.1.1.12.1.6.0"); } return $details; };
function snmp_audit($ip, $credentials, $display) { error_reporting(E_ALL); $CI =& get_instance(); $log = new stdClass(); $log->file = 'system'; $log->severity = 7; if ($display == 'y') { $log->display = 'y'; } else { $log->display = 'n'; } if (!extension_loaded('snmp')) { $log->message = 'SNMP PHP function not loaded hence not attempting to run snmp_helper::snmp_audit function'; $log->severity = 5; stdlog($log); unset($log); return false; } else { $log->message = 'SNMP PHP function loaded and attempting to run snmp_helper::snmp_audit function'; stdlog($log); } # we need an ip address if (empty($ip)) { $log->message = 'SNMP command received no ip address'; $log->severity = 5; stdlog($log); unset($log); return false; } elseif (!filter_var($ip, FILTER_VALIDATE_IP)) { $log->message = 'SNMP command received invalid ip address'; $log->severity = 5; stdlog($log); unset($log); return false; } else { $log->message = 'snmp_helper::snmp_audit function received ip ' . $ip; stdlog($log); } if (empty($credentials) or !is_object($credentials)) { $log->message = 'SNMP snmp_helper::snmp_audit received no credentials for ' . $ip; $log->severity = 5; stdlog($log); unset($log); return false; } else { $log->message = 'snmp_helper::snmp_audit function received credentials for ip ' . $ip; stdlog($log); } # new in 1.5 - remove the type from the returned SNMP query. # this affects the snmp_clean function in this file snmp_set_valueretrieval(SNMP_VALUE_PLAIN); snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC); $details = new stdClass(); $module = new stdclass(); $return_ips = new stdClass(); $return_ips->item = array(); $details->ip = (string) $ip; $details->manufacturer = ''; $details->serial = ''; $details->model = ''; $details->type = ''; $details->sysDescr = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.1.0"); $details->description = $details->sysDescr; $details->sysContact = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.4.0"); $details->contact = $details->sysContact; $details->sysName = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.5.0"); $details->hostname = $details->sysName; $details->name = $details->sysName; $details->sysLocation = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.6.0"); $details->location = $details->sysLocation; // uptime $details->sysUpTime = intval(my_snmp_get($ip, $credentials, "1.3.6.1.6.3.10.2.1.3.0")) * 100; if (empty($details->sysUpTime)) { $details->sysUpTime = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.3.0"); } if (empty($details->sysUpTime)) { $i = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.3.0"); if ($i > '' and strpos($i, ")") !== false) { $j = explode(")", $i); $details->uptime = intval(trim($j[1]) * 24 * 60 * 60); } else { $details->uptime = ''; } } // OID $details->sysObjectID = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.2.0"); $details->snmp_oid = $details->sysObjectID; if ($details->snmp_oid > '') { $details->manufacturer = get_oid($details->snmp_oid); if ($details->manufacturer == 'net-snmp') { $details->manufacturer = (string) ''; } } # sometimes we get an OID, but not enough to specify a manufacturer $explode = explode(".", $details->snmp_oid); if (!isset($explode[6])) { $vendor_oid = 0; if (strpos($details->sysDescr, "ZyXEL") !== false) { # we have a Zyxel device $vendor_oid = 890; } } else { $vendor_oid = intval($explode[6]); } if (file_exists(BASEPATH . '../application/helpers/snmp_' . $vendor_oid . '_helper.php')) { $log->message = 'snmp_helper::snmp_audit is loading the snmp helper for ' . $vendor_oid . ' when scanning ' . $ip; stdlog($log); unset($get_oid_details); include 'snmp_' . $vendor_oid . "_helper.php"; $new_details = $get_oid_details($ip, $credentials, $details->snmp_oid); foreach ($new_details as $key => $value) { $details->{$key} = $value; } unset($new_details); } else { $log->message = 'snmp_helper::snmp_audit could not load the snmp helper for ' . $vendor_oid . ' when scanning ' . $ip; $log->severity = 6; stdlog($log); $log->severity = 7; } if (!empty($details->sysDescr) and stripos($details->sysDescr, 'dd-wrt') !== false) { $details->os_group = 'Linux'; $details->os_name = 'DD-WRT'; $details->type = 'router'; } if (!empty($details->sysDescr) and stripos($details->sysDescr, "Darwin Kernel Version 12") !== false) { $details->manufacturer = "Apple Inc"; $details->os_family = 'Apple OSX'; } if (!empty($details->manufacturer) and (stripos($details->manufacturer, 'tplink') !== false or stripos($details->manufacturer, 'tp-link') !== false)) { $details->manufacturer = 'TP-Link Technology Co.,Ltd'; } if (!empty($details->sysDescr) and stripos($details->sysDescr, 'buffalo terastation') !== false) { $details->manufacturer = 'Buffalo'; $details->model = 'TeraStation'; $details->type = 'nas'; } if (!empty($details->sysDescr) and (stripos($details->sysDescr, 'synology') !== false or stripos($details->sysDescr, 'diskstation') !== false)) { $details->manufacturer = 'Synology'; $temp = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6574.1.5.1.0"); $details->model = trim('DiskStation ' . $temp); $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6574.1.5.2.0"); $details->type = 'nas'; $details->os_group = 'Linux'; $details->os_family = 'Synology DSM'; $details->os_name = 'Synology ' . my_snmp_get($ip, $credentials, "1.3.6.1.4.1.6574.1.5.3.0"); } // guess at manufacturer using entity mib if (empty($details->manufacturer)) { $details->manufacturer = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.12.1"); } // guess at model using entity mib if (empty($details->model)) { $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.13"); } // guess at model using host resources mib if (empty($details->model)) { $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.25.3.2.1.3.1"); } // serial if (empty($details->serial)) { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.11"); } if (empty($details->serial)) { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.11.1"); } if (empty($details->serial)) { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.11.1.0"); } # generic snmp if (empty($details->serial)) { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.43.5.1.1.17.1"); } # below is another generic attempt - works for my NetGear Cable Modem if (empty($details->serial)) { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.4491.2.4.1.1.1.3.0"); } $log->message = 'snmp_helper::snmp_audit thinks ' . $ip . ' is a type:' . $details->type . ' model:' . $details->model . ' serial:' . $details->serial; stdlog($log); // subnet if (empty($details->subnet)) { $details->subnet = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.4.20.1.3." . $details->ip); } // mac address if (empty($details->mac_address)) { $interface_number = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.4.20.1.2." . $ip); snmp_set_valueretrieval(SNMP_VALUE_LIBRARY); $details->mac_address = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.2.2.1.6." . $interface_number); snmp_set_valueretrieval(SNMP_VALUE_PLAIN); $details->mac_address = format_mac($details->mac_address); } // last attempt at a MAC - just use whatever's in the first interface MAC if (empty($details->mac_address)) { snmp_set_valueretrieval(SNMP_VALUE_LIBRARY); $details->mac_address = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.2.2.1.6.1"); snmp_set_valueretrieval(SNMP_VALUE_PLAIN); $details->mac_address = format_mac($details->mac_address); } $log->message = 'snmp_helper::snmp_audit MAC Address for ' . $ip . ' is ' . $details->mac_address; stdlog($log); // type if (empty($details->type) or $details->type == 'network printer') { $h = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.25.3.2.1.2.1"); if ($h == '1.3.6.1.2.1.25.3.1.5') { # we have a printer $details->type = 'network printer'; $i = my_snmp_walk($ip, $credentials, "1.3.6.1.2.1.43.13.4.1.10.1"); if (count($i) > 0) { $details->printer_duplex = 'n'; for ($k = 0; $k < count($i); $k++) { if (mb_strpos($i[$k], "Duplex") !== false) { $details->printer_duplex = 'y'; } } } if (empty($details->manufacturer)) { $hex = my_snmp_walk($ip, $credentials, "1.3.6.1.2.1.43.8.2.1.14.1"); if (count($hex) > 0) { if (isset($hex[1])) { if (mb_strpos($hex[1], "Hex-STRING: ") !== false) { $hex[1] = str_replace("Hex-STRING: ", "", $hex[1]); for ($i = 0; $i < strlen($hex[1]); $i++) { $details->manufacturer .= chr(hexdec(substr($hex[1], $i, 2))); } } else { $details->manufacturer = str_replace("STRING: ", "", $hex[1]); $details->manufacturer = str_replace('"', '', $details->manufacturer); } } } } $details->printer_color = 'n'; $i = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.43.11.1.1.6.1.2"); if (strpos(strtolower($i), "cartridge") !== false) { # it's likely this is a colour printer $details->printer_color = 'y'; } } else { # If the device is a Switch, the OID 1.3.6.1.2.1.17.1.2.0 is an integer and # OID 1.3.6.1.2.1.4.1.0 should have a value of 2 $i = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.17.1.2.0"); $j = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.4.1.0"); if ($i == intval($i) and $j == '2') { $details->type = 'switch'; } # If the device is a Router, the OID 1.3.6.1.2.1.4.1.0 should have a value of 1 (already read above) if (empty($details->type)) { if ($i == '1') { $details->type = 'router'; } } # If the device is a Printer, the OID 1.3.6.1.2.1.43.5.1.1.1.1 should have a value #if (!isset($details->type) or $details->type == '') { $i = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.43.5.1.1.1.1"); if (strpos(strtolower($i), "counter32") !== false) { $details->type = 'network printer'; // printer duplex $details->printer_duplex = ''; $i = my_snmp_walk($ip, $credentials, "1.3.6.1.2.1.43.13.4.1.10.1"); if (count($i) > 0) { $details->printer_duplex = 'n'; for ($k = 0; $k < count($i); $k++) { if (mb_strpos($i[$k], "Duplex") !== false) { $details->printer_duplex = 'y'; } } } if (empty($details->manufacturer)) { $hex = my_snmp_walk($ip, $credentials, "1.3.6.1.2.1.43.8.2.1.14.1"); if (count($hex) > 0) { if (isset($hex[1])) { if (mb_strpos($hex[1], "Hex-STRING: ") !== false) { $hex[1] = str_replace("Hex-STRING: ", "", $hex[1]); for ($i = 0; $i < strlen($hex[1]); $i++) { $details->manufacturer .= chr(hexdec(substr($hex[1], $i, 2))); } } else { $details->manufacturer = str_replace("STRING: ", "", $hex[1]); $details->manufacturer = str_replace('"', '', $details->manufacturer); } } } } $details->printer_color = 'n'; $i = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.43.11.1.1.6.1.2"); if (strpos(strtolower($i), "cartridge") !== false) { # it's likely this is a colour printer $details->printer_color = 'y'; } } } } // modules - NOTE, we call these 'entities' in the web interface $log->message = 'snmp_helper::snmp_audit module retrieval for ' . $ip . ' starting'; stdlog($log); $modules = array(); $modules_list = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.2"); if (isset($modules_list) and is_array($modules_list) and count($modules_list) > 0) { $log->message = 'snmp_helper::snmp_audit module count for ' . $ip . ' is ' . count($modules_list); stdlog($log); $log->message = 'snmp_helper::snmp_audit object_id retrieval for ' . $ip . ' starting'; stdlog($log); $temp_object_id = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.3'); $log->message = 'snmp_helper::snmp_audit contained_in retrieval for ' . $ip . ' starting'; stdlog($log); $temp_contained_in = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.4'); $log->message = 'snmp_helper::snmp_audit class retrieval for ' . $ip . ' starting'; stdlog($log); $temp_class = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.5'); $log->message = 'snmp_helper::snmp_audit hardware_revision retrieval for ' . $ip . ' starting'; stdlog($log); $temp_hardware_revision = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.8'); $log->message = 'snmp_helper::snmp_audit firmware_revision retrieval for ' . $ip . ' starting'; stdlog($log); $temp_firmware_revision = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.9'); $log->message = 'snmp_helper::snmp_audit software_revision retrieval for ' . $ip . ' starting'; stdlog($log); $temp_software_revision = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.10'); $log->message = 'snmp_helper::snmp_audit serial_number retrieval for ' . $ip . ' starting'; stdlog($log); $temp_serial_number = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.11'); $log->message = 'snmp_helper::snmp_audit asset_id retrieval for ' . $ip . ' starting'; stdlog($log); $temp_asset_id = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.15'); $log->message = 'snmp_helper::snmp_audit is_fru retrieval for ' . $ip . ' starting'; stdlog($log); $temp_is_fru = my_snmp_real_walk($ip, $credentials, '1.3.6.1.2.1.47.1.1.1.1.16'); foreach ($modules_list as $key => $value) { $log->message = 'snmp_helper::snmp_audit processing module ' . $value . ' for ' . $ip . ' starting'; stdlog($log); $module = new stdClass(); $module->description = $value; $module->module_index = str_replace('.1.3.6.1.2.1.47.1.1.1.1.2.', '', $key); $module->object_ident = $temp_object_id['.1.3.6.1.2.1.47.1.1.1.1.3.' . $module->module_index]; $module->contained_in = $temp_contained_in['.1.3.6.1.2.1.47.1.1.1.1.4.' . $module->module_index]; $module->class = $temp_class['.1.3.6.1.2.1.47.1.1.1.1.5.' . $module->module_index]; $module->hardware_revision = $temp_hardware_revision['.1.3.6.1.2.1.47.1.1.1.1.8.' . $module->module_index]; $module->firmware_revision = $temp_firmware_revision['.1.3.6.1.2.1.47.1.1.1.1.9.' . $module->module_index]; $module->software_revision = $temp_software_revision['.1.3.6.1.2.1.47.1.1.1.1.10.' . $module->module_index]; $module->serial = $temp_serial_number['.1.3.6.1.2.1.47.1.1.1.1.11.' . $module->module_index]; $module->asset_ident = $temp_asset_id['.1.3.6.1.2.1.47.1.1.1.1.15.' . $module->module_index]; $module->is_fru = $temp_is_fru['.1.3.6.1.2.1.47.1.1.1.1.16.' . $module->module_index]; if ((string) $module->is_fru == '1') { $module->is_fru = 'y'; } else { $module->is_fru = 'n'; } $module->class_text = 'unknown'; if ($module->class == '1') { $module->class_text = 'other'; } if ($module->class == '2') { $module->class_text = 'unknown'; } if ($module->class == '3') { $module->class_text = 'chassis'; } if ($module->class == '4') { $module->class_text = 'backplane'; } if ($module->class == '5') { $module->class_text = 'container'; } if ($module->class == '6') { $module->class_text = 'powerSupply'; } if ($module->class == '7') { $module->class_text = 'fan'; } if ($module->class == '8') { $module->class_text = 'sensor'; } if ($module->class == '9') { $module->class_text = 'module'; } if ($module->class == '10') { $module->class_text = 'port'; } if ($module->class == '11') { $module->class_text = 'stack'; } if ($module->class == '12') { $module->class_text = 'cpu'; } $modules[] = $module; } } $log->message = 'snmp_helper::snmp_audit module retrieval for ' . $ip . ' complete'; stdlog($log); // network intereface details $interfaces = array(); $interfaces_filtered = array(); $interfaces = my_snmp_walk($ip, $credentials, "1.3.6.1.2.1.2.2.1.1"); $log->message = 'snmp_helper::snmp_audit interface count for ' . $ip . ' is ' . count($interfaces); stdlog($log); if (is_array($interfaces) and count($interfaces) > 0) { $log->message = 'snmp_helper::snmp_audit models retrieval for ' . $ip . ' starting'; stdlog($log); $models = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.2.2.1.2"); $log->message = 'snmp_helper::snmp_audit types retrieval for ' . $ip . ' starting'; stdlog($log); $types = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.2.2.1.3"); $log->message = 'snmp_helper::snmp_audit speeds retrieval for ' . $ip . ' starting'; stdlog($log); $speeds = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.2.2.1.5"); $log->message = 'snmp_helper::snmp_audit mac_addresses retrieval for ' . $ip . ' starting'; stdlog($log); $mac_addresses = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.2.2.1.6"); $log->message = 'snmp_helper::snmp_audit ip_enableds retrieval for ' . $ip . ' starting'; stdlog($log); $ip_enableds = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.2.2.1.8"); $log->message = 'snmp_helper::snmp_audit ip_addresses retrieval for ' . $ip . ' starting'; stdlog($log); $ip_addresses = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.4.20.1.2"); $log->message = 'snmp_helper::snmp_audit ifAdminStatus retrieval for ' . $ip . ' starting'; stdlog($log); $ifAdminStatus = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.2.2.1.7"); $log->message = 'snmp_helper::snmp_audit ifLastChange retrieval for ' . $ip . ' starting'; stdlog($log); $ifLastChange = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.2.2.1.9"); if (isset($details->os_group) and $details->os_group == "VMware") { $log->message = 'snmp_helper::snmp_audit ip_addresses_2 retrieval for ' . $ip . ' starting'; stdlog($log); $ip_addresses_2 = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.4.34.1.3.1.4"); } $log->message = 'snmp_helper::snmp_audit subnets retrieval for ' . $ip . ' starting'; stdlog($log); $subnets = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.4.20.1.3"); $log->message = 'snmp_helper::snmp_audit connection_ids retrieval for ' . $ip . ' starting'; stdlog($log); $connection_ids = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.31.1.1.1.1"); $log->message = 'snmp_helper::snmp_audit aliases retrieval for ' . $ip . ' starting'; stdlog($log); $aliases = my_snmp_real_walk($ip, $credentials, "1.3.6.1.2.1.31.1.1.1.18"); foreach ($interfaces as $key => $value) { $log->message = 'snmp_helper::snmp_audit processing interface ' . $value . ' for ' . $ip . ' starting'; stdlog($log); $interface = new stdclass(); $interface->net_index = $value; snmp_set_valueretrieval(SNMP_VALUE_LIBRARY); $interface->mac = format_mac(my_snmp_get($ip, $credentials, "1.3.6.1.2.1.2.2.1.6." . $interface->net_index)); snmp_set_valueretrieval(SNMP_VALUE_PLAIN); if (!isset($interface->mac)) { $interface->mac = (string) ''; } $interface->model = @$models[".1.3.6.1.2.1.2.2.1.2." . $interface->net_index]; $interface->description = $interface->model; $interface->connection = @$connection_ids[".1.3.6.1.2.1.31.1.1.1.1." . $interface->net_index]; $interface->alias = @$aliases[".1.3.6.1.2.1.31.1.1.1.18." . $interface->net_index]; $interface->type = @interface_type(@$types[".1.3.6.1.2.1.2.2.1.3." . $interface->net_index]); $interface->ip_enabled = @ip_enabled($ip_enableds[".1.3.6.1.2.1.2.2.1.8." . $interface->net_index]); $interface->ifadminstatus = @if_admin_status($ifAdminStatus[".1.3.6.1.2.1.2.2.1.7." . $interface->net_index]); $interface->iflastchange = @$ifLastChange[".1.3.6.1.2.1.2.2.1.9." . $interface->net_index]; $interface->speed = @$speeds[".1.3.6.1.2.1.2.2.1.5." . $interface->net_index]; $interface->manufacturer = ''; $interface->connection_status = ''; $interface->dhcp_enabled = ''; $interface->dhcp_server = ''; $interface->dhcp_lease_obtained = ''; $interface->dhcp_lease_expires = ''; $interface->dns_host_name = ''; $interface->dns_domain = ''; $interface->dns_domain_reg_enabled = ''; $interface->dns_server = ''; if (is_array($ip_addresses) and count($ip_addresses > 0)) { foreach ($ip_addresses as $each_key => $each_value) { if ($each_value == $interface->net_index) { $new_ip = new stdclass(); $new_ip->net_index = $interface->net_index; $new_ip->ip = str_replace(".1.3.6.1.2.1.4.20.1.2.", "", $each_key); $new_ip->mac = $interface->mac; $new_ip->netmask = @$subnets[".1.3.6.1.2.1.4.20.1.3." . $new_ip->ip]; $new_ip->version = '4'; if ($new_ip->ip != '127.0.0.1' and $new_ip->ip != '127.0.1.1') { $return_ips->item[] = $new_ip; } $new_ip = null; } } } if (isset($ip_addresses_2) and is_array($ip_addresses_2) and isset($details->os_group) and $details->os_group == "VMware") { // likely we have a VMware ESX box - get what we can foreach ($ip_addresses_2 as $each_key => $each_value) { $new_ip = new stdClass(); $new_ip->net_index = $each_value; $new_ip->ip = str_replace(".1.3.6.1.2.1.4.34.1.3.1.4.", "", $each_key); $new_ip->netmask = ''; $new_ip->version = '4'; if ($new_ip->net_index == $interface->net_index) { $new_ip->mac = $interface->mac; if ($new_ip->ip != '127.0.0.1' and $new_ip->ip != '127.0.1.1') { $return_ips->item[] = $new_ip; } } $new_ip = null; } } if (isset($details->os_group) and $details->os_group == 'Windows') { if (isset($interface->ip_addresses) and count($interface->ip_addresses) > 0) { if (strpos(strtolower($interface->type), 'loopback') === false) { $interfaces_filtered[] = $interface; } } } else { if (strtolower($interface->type != 'software loopback')) { $interfaces_filtered[] = $interface; } } } } // end of network interfaces // Virtual Guests $guests = array(); if ($vendor_oid == 6876) { if (file_exists(BASEPATH . '../application/helpers/snmp_6876_2_helper.php')) { $log->message = 'snmp_helper::snmp_audit is loading the model helper for VMware virtual guests'; stdlog($log); include 'snmp_6876_2_helper.php'; } } $return_array = array('details' => $details, 'interfaces' => $interfaces_filtered, 'guests' => $guests, 'modules' => $modules, 'ip' => $return_ips); return $return_array; }
# (at your option) any later version. # # Open-AudIT is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Open-AudIT (most likely in a file named LICENSE). # If not, see <http://www.gnu.org/licenses/> # # For further information on Open-AudIT or for a license other than AGPL please see # www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Mikrotik $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); $details->model = ''; $details->type = 'router'; $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.14988.1.1.7.3.0"); return $details; };
# ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Microsoft $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); $details->type = 'computer'; $details->model = ''; $details->os_group = 'Windows'; $details->os_family = ''; $details->os_name = ''; $details->icon = 'computer'; # try to determine if this is a VMware virtual machine $i = my_snmp_walk($ip, $credentials, "1.3.6.1.2.1.25.6.3.1.2"); if (count($i) > 0) { for ($k = 0; $k < count($i); $k++) { if (mb_strpos($i[$k], "VMware Tools") !== false) { $details->model = 'VMware Virtual Platform'; $details->manufacturer = 'VMware, Inc.'; } } } $details->description = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.77.1.2.1.0"); return $details; };
} if ($oid == '1.3.6.1.4.1.43.10.27.4.1.2.1') { $details->model = '3Com SuperStack 1100'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.43.10.27.4.1.2.10') { $details->model = '3Com 4000 Series'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.43.10.27.4.1.2.11') { $details->model = '3Com SuperStack 4200'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.43.10.27.4.1.2.2') { $details->model = '3Com SuperStack 3300'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.43.10.27.4.1.2.4') { $details->model = '3Com SuperStack 4400'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.43.10.27.4.1.2.5') { $details->model = '3Com SuperStack 4900'; $details->type = 'switch'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.43.47.1.1.3.1.10.1"); if ($details->serial == '') { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.43.10.27.1.1.1.13.1"); } return $details; };
# (at your option) any later version. # # Open-AudIT is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Open-AudIT (most likely in a file named LICENSE). # If not, see <http://www.gnu.org/licenses/> # # For further information on Open-AudIT or for a license other than AGPL please see # www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Gemtek Systems Holding $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); $details->type = 'unknown'; $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.10529.300.1.3.1.0"); $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.10529.300.1.3.5.0"); return $details; };
if ($oid == '1.3.6.1.4.1.674.10895.3022') { $details->model = 'PowerConnect M8024'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.674.10895.3024') { $details->model = 'PowerConnect 8024F'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.674.10895.3025') { $details->model = 'PowerConnect M6348'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.674.10895.4') { $details->model = 'PowerConnect 5224'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.674.10895.5') { $details->model = 'PowerConnect 3048'; $details->type = 'switch'; } if ($oid == '1.3.6.1.4.1.674.10899.100.1.1') { $details->model = 'Dell 5100MP Projector'; $details->type = 'projector'; } $temp_model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.674.10892.2.1.1.2.0"); if (!empty($temp_model)) { $details->model = $temp_model; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.674.10892.2.1.1.11.0"); return $details; };
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Open-AudIT (most likely in a file named LICENSE). # If not, see <http://www.gnu.org/licenses/> # # For further information on Open-AudIT or for a license other than AGPL please see # www.opmantek.com or email contact@opmantek.com # # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor QNAP $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); $details->type = 'nas'; $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.11.1"); $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.47.1.1.1.1.7.1"); if (empty($details->model)) { $details->model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.24681.1.3.12.0"); } return $details; };
# # ***************************************************************************** /* * @package Open-AudIT * @author Mark Unwin <*****@*****.**> * * @version 1.12.8 * @copyright Copyright (c) 2014, Opmantek * @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 */ # Vendor Wyse $get_oid_details = function ($ip, $credentials, $oid) { $details = new stdClass(); if ($oid == '1.3.6.1.4.1.714.1.2.6') { $details->model = 'Xenith 2'; $details->os_group = 'Wyse'; $details->type = 'thin client'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.714.1.2.6.2.1.0"); $details->sysname = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.5.0"); $details->description = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.1.0"); $details->contact = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.4.0"); if ($details->contact > '') { $details->description = "Contact: " . $details->contact . ". " . $details->description; } $details->location = my_snmp_get($ip, $credentials, "1.3.6.1.2.1.1.6.0"); if ($details->location > '') { $details->description = "Location: " . $details->location . ". " . $details->description; } return $details; };
$details->serial = my_snmp_get($ip, $credentials, ".1.3.6.1.4.1.11.2.36.1.1.2.9.0"); if ($credentials->credentials0->version == '1') { # model is a hex encoded string in HP Laserjets using snmp v1 if (empty($details->model)) { $model = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.2.0"); $model = str_replace(" ", "", $model); $model = str_replace("\n", "", $model); if (function_exists('hex2bin')) { $details->model = hex2bin($model); } else { $details->model = pack("H*", $model); } $temp_model = mb_convert_encoding($details->model, "UTF-8", "ASCII"); } # serial is a hex encoded string in HP Laserjets using snmp v1 $serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0"); $serial = str_replace(" ", "", $serial); $serial = str_replace("\n", "", $serial); if (function_exists('hex2bin')) { $details->serial = hex2bin($serial); } else { $details->serial = pack("H*", $serial); } $details->serial = mb_convert_encoding($details->serial, "UTF-8", "ASCII"); } if (strpos(strtolower($details->model), "laserjet") !== false and (!isset($details->type) or $details->type == '' or $details->type == 'unknown')) { $details->type = "network printer"; } if (!empty($temp_model)) { $details->model = $temp_model; }
} if ($oid == '1.3.6.1.4.1.12356.2001') { $details->model = 'Fortinet 200A'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.12356.3002') { $details->model = 'Fortinet 310B'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.12356.603') { $details->model = 'Fortinet 60'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.12356.101.1.15000') { $details->model = 'FortiGate-1500D'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.12356.101.1.1004') { $details->model = 'FortiGate-100D'; $details->type = 'firewall'; } if ($oid == '1.3.6.1.4.1.12356.101.1.2005') { $details->model = 'FortiGate-200D'; $details->type = 'firewall'; } $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.12356.1.2.0"); if ($details->serial == '') { $details->serial = my_snmp_get($ip, $credentials, "1.3.6.1.4.1.12356.100.1.1.1.0"); } return $details; };