<?PHP
if(file_exists('scripts/inc.config.php')) {
require 'scripts/inc.config.php';
// ensure we are being called from our configured host
if($defined['hostname']===$_SERVER['SERVER_NAME']) {
// obtain default options
$defined = array_merge($defined,$handles['misc']->getDefaults());
$defined = array_merge($defined,$handles['misc']->getAuthentication());
$accessList = $handles['misc']->getAccessList();
// copy and filter incoming data
$get = @array_map($handles['val']->ValidateXSS,$_GET);
$post = @array_map($handles['val']->ValidateXSS,$_POST);
$sess = @array_map($handles['val']->ValidateXSS,$_SESSION);
$serv = @array_map($handles['val']->ValidateXSS,$_SERVER);
//define the template and cache directories
$handles['tpl']->strTemplateDir = $defined['templates'];
$handles['tpl']->strCacheDir = '/tmp';
$flag = (!empty($post)) ? "TRUE" : "FALSE";
/*
* I know using system tools is cheating
* but the performance can't be beat
*/
$tools['ping'] = '/bin/ping';
$tools['trace'] = '/bin/traceroute';
$tools['nmap'] = '/usr/bin/nmap';
$tools['whois'] = '/usr/bin/whois';
$ports = '21,22,23,25,80,443,8080,389,686';
$worms = '1080,2283,2535,2745,3127,3128,3410,5554,8866,9898,10000,10080,12345,17300,27374,65506,1026,1027,1028,1029,3389,4899,6129';
$target = (!empty($post['target'])) ? $post['target'] : $get['target'];
$type = (!empty($post['type'])) ? $post['type'] : $get['type'];
$callback = (!empty($post['callback'])) ? $post['callback'] : $get['callback'];
if (($handles['net']->valIPv4($target)!==-1)||($handles['net']->valDomain($target)===0)) {
$results = $handles['net']->processHTML($target,$ports,$worms,$type,$tools,$callback);
} else {
$results = "Error: " . $target . " is not a valid IPv4 address or RFC 608 compliant hostname";
}
$use = 'network-tools-results.tpl';
$handles['tpl']->assign('results',$results,NULL,NULL);
$handles['tpl']->assign('templates', $defined['templates'],NULL,NULL);
$handles['tpl']->display($use,$flag,NULL);
} else {
echo "Cannot be called from anywhere other then our defined host";
}
} else {
echo "Configuration file not found";
}
?>