2014-05-28 Alejandro Gallardo <alejandro.gallardo@artica.es>
* include/functions.php: Improved the Windows compatibility of the function "get_snmpwalk". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10031 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
baf5cedde8
commit
d5fe74b10d
|
@ -1,3 +1,8 @@
|
|||
2014-05-28 Alejandro Gallardo <alejandro.gallardo@artica.es>
|
||||
|
||||
* include/functions.php: Improved the Windows
|
||||
compatibility of the function "get_snmpwalk".
|
||||
|
||||
2014-05-28 Alejandro Gallardo <alejandro.gallardo@artica.es>
|
||||
|
||||
* include/functions_snmp.php: Improved the security
|
||||
|
|
|
@ -1425,17 +1425,29 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', $snmp3_au
|
|||
else {
|
||||
$snmpwalk_bin = $config['snmpwalk'];
|
||||
}
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$error_redir_dir = 'NUL';
|
||||
break;
|
||||
default:
|
||||
$error_redir_dir = '/dev/null';
|
||||
break;
|
||||
}
|
||||
|
||||
$output = array();
|
||||
$rc = 0;
|
||||
switch ($snmp_version) {
|
||||
case '3':
|
||||
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2>/dev/null', $output, $rc);
|
||||
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
break;
|
||||
case '2':
|
||||
case '2c':
|
||||
case '1':
|
||||
default:
|
||||
exec ($snmpwalk_bin . ' -m ALL -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2>/dev/null', $output, $rc);
|
||||
exec ($snmpwalk_bin . ' -m ALL -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir, $output, $rc);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue