mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix some security nonsense
git-svn-id: http://www.observium.org/svn/observer/trunk@246 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -8,7 +8,7 @@ if($_SESSION['userlevel'] != '10') { echo("<span class=alert>You do not have the
|
||||
|
||||
if($_POST['action'] == "add") {
|
||||
|
||||
mysql_query("INSERT INTO `users` (`username`, `realname`, `password`, `level`) VALUES ('" . mres($_POST['new_username']) . "', '" . mres($_POST['new_realname']) . "', MD5('" . mres(_POST['new_password']) . "'), '" . mres($_POST['new_level']) . "')");
|
||||
mysql_query("INSERT INTO `users` (`username`, `realname`, `password`, `level`) VALUES ('" . mres($_POST['new_username']) . "', '" . mres($_POST['new_realname']) . "', MD5('" . mres($_POST['new_password']) . "'), '" . mres($_POST['new_level']) . "')");
|
||||
|
||||
if(mysql_affected_rows()) { echo("<span class=info>User " . $_GET['username'] . " added!</span>"); }
|
||||
|
||||
|
@@ -11,6 +11,11 @@ while($device = mysql_fetch_array($device_query)) {
|
||||
case "JunOS":
|
||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
||||
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
||||
echo("<div class=graphhead>Temperatures</div>");
|
||||
$graph_type = "dev_temp"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
@@ -6,6 +6,37 @@
|
||||
|
||||
echo("Temperatures : ");
|
||||
|
||||
## JunOS Temperatures
|
||||
if($device['os'] == "JunOS") {
|
||||
echo("JunOS ");
|
||||
$oids = shell_exec($config['snmpwalk'] . " -v2c -CI -Osqn -c $community $hostname 1.3.6.1.4.1.2636.3.1.13.1.7");
|
||||
$oids = trim($oids);
|
||||
foreach(explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
$data = substr($data, 29);
|
||||
if($data) {
|
||||
list($oid) = explode(" ", $data);
|
||||
$temp_oid = "1.3.6.1.4.1.2636.3.1.13.1.7.$oid";
|
||||
$descr_oid = "1.3.6.1.4.1.2636.3.1.13.1.5.$oid";
|
||||
$descr = trim(shell_exec("snmpget -O qv -v2c -c $community $hostname $descr_oid"));
|
||||
$temp = trim(shell_exec("snmpget -O qv -v2c -c $community $hostname $temp_oid"));
|
||||
if(!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0") {
|
||||
$descr = `snmpget -O qv -v2c -c $community $hostname $descr_oid`;
|
||||
$descr = str_replace("\"", "", $descr);
|
||||
$descr = str_replace("temperature", "", $descr);
|
||||
$descr = str_replace("temp", "", $descr);
|
||||
$descr = trim($descr);
|
||||
if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$temp_oid' AND temp_host = '$id'"),0) == '0') {
|
||||
$query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`) values ('$id', '$temp_oid', '$descr')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
} else { echo("."); }
|
||||
$temp_exists[] = "$id $temp_oid";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
## Begin Observer-Style
|
||||
if($device['os'] == "Linux") {
|
||||
echo("Observer-Style ");
|
||||
@@ -84,7 +115,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} ## End Cisco Temperatures
|
||||
|
||||
|
||||
## Delete removed sensors
|
||||
|
@@ -3,7 +3,8 @@
|
||||
if(!$os) {
|
||||
|
||||
$sysObjectId = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname ." .1.3.6.1.2.1.1.2.0");
|
||||
if(strstr($sysObjectId, "netscreen")) { $os = "ScreenOS"; }
|
||||
if(strstr($sysObjectId, "netscreen")) { $os = "ScreenOS"; } elseif (strstr($sysObjectId, "enterprises.3224.1")) { $os = "ScreenOS"; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user