From 5ccfbcc56c4d43f4cb274ab705b8b74c6c6555a5 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Mon, 14 Mar 2011 12:02:23 +0000 Subject: [PATCH] fixed netcmd.php, thanks to falz git-svn-id: http://www.observium.org/svn/observer/trunk@1828 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/netcmd.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/html/netcmd.php b/html/netcmd.php index 68c91cae1..f23ba71f0 100644 --- a/html/netcmd.php +++ b/html/netcmd.php @@ -3,7 +3,8 @@ ini_set('allow_url_fopen', 0); ini_set('display_errors', 0); -if($_GET[debug]) { +if ($_GET[debug]) +{ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); ini_set('log_errors', 1); @@ -12,14 +13,15 @@ if($_GET[debug]) { include("../includes/defaults.inc.php"); include("../config.php"); +include("includes/functions.inc.php"); include("../includes/functions.php"); include("includes/authenticate.inc.php"); -if(!$_SESSION['authenticated']) { echo("unauthenticated"); exit; } +if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; } -if($_GET['query'] && $_GET['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)) { + 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 \%"; @@ -31,14 +33,17 @@ if($_GET['query'] && $_GET['cmd']) { $cmd = $config['mtr'] . " -r -c 5 $host"; break; case 'nmap': - if ($_SESSION['userlevel'] != '10') { + if ($_SESSION['userlevel'] != '10') + { echo("insufficient privileges"); } else { $cmd = $config['nmap'] . " $host"; } break; } - if (!empty($cmd)) { + + if (!empty($cmd)) + { $output = `$cmd`; } } @@ -47,4 +52,4 @@ if($_GET['query'] && $_GET['cmd']) { $output = trim($output); echo("
$output
"); -?> +?> \ No newline at end of file