mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
security fixes. again.
git-svn-id: http://www.observium.org/svn/observer/trunk@306 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -1,31 +1,35 @@
|
||||
<?php
|
||||
|
||||
include_once("Net/IPv6.php");
|
||||
ini_set('allow_url_fopen', 0);
|
||||
ini_set('display_errors', 0);
|
||||
|
||||
function check_ip($ip)
|
||||
{
|
||||
if ($ip == long2ip(ip2long($ip))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if($_GET['query']) {
|
||||
$ip = $_GET['query'];
|
||||
if(Net_IPv6::checkIPv6($ip)||check_ip($ip)) {
|
||||
switch ($_GET[cmd]) {
|
||||
include("../config.php");
|
||||
include("../includes/functions.php");
|
||||
include("includes/authenticate.inc");
|
||||
|
||||
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':
|
||||
$output = `/usr/bin/whois $_GET[query] | grep -v \%`;
|
||||
$output = `/usr/bin/whois $host | grep -v \%`;
|
||||
break;
|
||||
case 'ping':
|
||||
$output = `/bin/ping $_GET[query]`;
|
||||
$output = `/bin/ping $host`;
|
||||
break;
|
||||
case 'tracert':
|
||||
$output = `/usr/sbin/traceroute $_GET[query]`;
|
||||
$output = `/usr/sbin/traceroute $host`;
|
||||
break;
|
||||
case 'nmap':
|
||||
$output = `/usr/bin/nmap $_GET[query]`;
|
||||
$output = `/usr/bin/nmap $host`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user