2007-04-03 14:10:23 +00:00
|
|
|
<?php
|
|
|
|
|
2008-11-13 17:28:13 +00:00
|
|
|
ini_set('allow_url_fopen', 0);
|
|
|
|
ini_set('display_errors', 0);
|
2008-11-13 17:19:43 +00:00
|
|
|
|
2008-11-13 17:28:13 +00:00
|
|
|
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);
|
2008-11-13 17:19:43 +00:00
|
|
|
}
|
|
|
|
|
2010-02-27 14:44:38 +00:00
|
|
|
include("../includes/defaults.inc.php");
|
2008-11-13 17:28:13 +00:00
|
|
|
include("../config.php");
|
|
|
|
include("../includes/functions.php");
|
2010-02-20 17:37:42 +00:00
|
|
|
include("includes/authenticate.inc.php");
|
2009-03-11 14:50:24 +00:00
|
|
|
if(!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
|
|
|
|
|
2008-11-13 17:28:13 +00:00
|
|
|
|
|
|
|
if($_GET['query'] && $_GET['cmd']) {
|
|
|
|
$host = $_GET['query'];
|
2008-11-19 12:12:54 +00:00
|
|
|
if(Net_IPv6::checkIPv6($host)||Net_IPv4::validateip($host)||preg_match("/^[a-zA-Z0-9.-]*$/", $host)) {
|
2008-11-13 17:28:13 +00:00
|
|
|
switch ($_GET['cmd']) {
|
2008-11-13 17:19:43 +00:00
|
|
|
case 'whois':
|
2008-11-13 17:28:13 +00:00
|
|
|
$output = `/usr/bin/whois $host | grep -v \%`;
|
2008-11-13 17:19:43 +00:00
|
|
|
break;
|
|
|
|
case 'ping':
|
2008-11-13 17:28:13 +00:00
|
|
|
$output = `/bin/ping $host`;
|
2008-11-13 17:19:43 +00:00
|
|
|
break;
|
|
|
|
case 'tracert':
|
2008-11-13 17:28:13 +00:00
|
|
|
$output = `/usr/sbin/traceroute $host`;
|
2008-11-13 17:19:43 +00:00
|
|
|
break;
|
|
|
|
case 'nmap':
|
2008-11-13 17:28:13 +00:00
|
|
|
$output = `/usr/bin/nmap $host`;
|
2008-11-13 17:19:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-04-03 14:10:23 +00:00
|
|
|
}
|
2008-11-13 17:19:43 +00:00
|
|
|
|
2007-04-03 14:10:23 +00:00
|
|
|
$output = trim($output);
|
|
|
|
echo("<pre>$output</pre>");
|
|
|
|
|
|
|
|
?>
|