mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
revert r1957 patch
git-svn-id: http://www.observium.org/svn/observer/trunk@1960 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -5,10 +5,10 @@ ini_set('display_errors', 0);
|
||||
|
||||
if ($_GET[debug])
|
||||
{
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_reporting', E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_reporting', E_ALL);
|
||||
}
|
||||
|
||||
include("../includes/defaults.inc.php");
|
||||
@@ -19,37 +19,40 @@ include("includes/authenticate.inc.php");
|
||||
|
||||
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
|
||||
|
||||
if ($_GET['query'] && $_GET['cmd']) {
|
||||
$host = $_GET['query'];
|
||||
if (Net_IPv6::checkIPv6($host)||Net_IPv4::validateip($host)||preg_match("/^[a-zA-Z0-9.-]*$/", $host)) {
|
||||
switch ($_GET['cmd']) {
|
||||
case 'whois':
|
||||
$cmd = $config['whois'] . " $host | grep -v \%";
|
||||
break;
|
||||
case 'ping':
|
||||
$cmd = $config['ping'] . " -c 5 $host";
|
||||
break;
|
||||
case 'tracert':
|
||||
$cmd = $config['mtr'] . " -r -c 5 $host";
|
||||
break;
|
||||
case 'nmap':
|
||||
if ($_SESSION['userlevel'] != '10')
|
||||
{
|
||||
echo("insufficient privileges");
|
||||
} else {
|
||||
$cmd = $config['nmap'] . " $host";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($cmd))
|
||||
if ($_GET['query'] && $_GET['cmd'])
|
||||
{
|
||||
$host = $_GET['query'];
|
||||
if (Net_IPv6::checkIPv6($host)||Net_IPv4::validateip($host)||preg_match("/^[a-zA-Z0-9.-]*$/", $host))
|
||||
{
|
||||
switch ($_GET['cmd'])
|
||||
{
|
||||
case 'whois':
|
||||
$cmd = $config['whois'] . " $host | grep -v \%";
|
||||
break;
|
||||
case 'ping':
|
||||
$cmd = $config['ping'] . " -c 5 $host";
|
||||
break;
|
||||
case 'tracert':
|
||||
$cmd = $config['mtr'] . " -r -c 5 $host";
|
||||
break;
|
||||
case 'nmap':
|
||||
if ($_SESSION['userlevel'] != '10')
|
||||
{
|
||||
$output = `$cmd`;
|
||||
echo("insufficient privileges");
|
||||
} else {
|
||||
$cmd = $config['nmap'] . " $host";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($cmd))
|
||||
{
|
||||
$output = `$cmd`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$output = trim($output);
|
||||
echo("<pre>$output</pre>");
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user