..one or more modules you must have seen the iframes used for realtime result display. In this tutorial I'm going to show you how to insert them into your module and how they..
xAnalyze is a module that can search through corrupt data and configuration files in order to find the exact position of errors
<?php
/* Scans a host on open ports
Author: Remco Kouw
Site: http://www.hacksuite.com
Last Edit: 31-03-2015
*/
// set variable to be able to save a task
$_MODULE_C = "thc_xs";
// log file for wpa/wep keys
$_LOG = "openports.txt";
include_once("../../Includes/screen_header.php");
include_once($_PATHS['module_default_root']."/ports.php");
include_once($_PATHS['style_root']."/screen.php");
include_once($_PATHS['functions_root']."/scrn.php");
// options
$sOptions = "<b>logging:</b> ".($_CONTEXT['log']==true ? "on" : "off")."<br>\n";
$sOptions .= "<b>silence:</b> ".($_CONTEXT['silent']==true ? "on" : "off")."<br>\n";
$sOptions .= "<b>verbose:</b> ".($_CONTEXT['verbose']==true ? "on" : "off")."\n";
if(isset($_POST['submit'])){
switch($_POST['submit']){
// enter portscan in task list
case"Scan":
include_once($_PATHS['includes_root']."/task_start.php");
echo $sOut;
break;
// dump of open ports on hosts
case"Dump Log":
echo $sOut;
if(!function_exists("RawToArray")){
include_once($_PATHS['functions_root']."/raw_to_array.php");
}
if(false==($aKeys = RawToArray($_LOG))){
echo"<b id=h7>[no open ports discovered yet]</b>";
}
else{
echo"<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
echo"<tr><th>host</th><th>port</th><th>service</th><th>time</th></tr>\n";
for($x=0;$x<count($aKeys);$x++){
echo"<tr><td>".$aKeys[$x][0]."</td><td>".intval($aKeys[$x][1])."</td><td>".$aKeys[$x][2]."</td><td>".date($_CONTEXT['time_pattern'].' H:i:s',intval($aKeys[$x][3]))."</td></tr>\n";
}
echo"</table>\n";
}
echo $sEnd;
exit;
break;
// just show index
default:
echo $sOut;
echo $sOptions;
echo $sEnd;
exit;
}
}
else{
echo $sOut;
echo $sOptions;
echo $sEnd;
exit;
}
// do some rough validation and fall through till we start the scanning
$aPorts = array();
$_SCAN = array();
$_SCAN['min'] = 0;
$_SCAN['max'] = 0;
$iTimeOut = floatval($_POST['iTimeOut']);
if(!is_float($iTimeOut)){
$iTimeOut = 0.5;
}
if(strlen($_POST['sInput'])==0){
die("No hostname specified.");
}
if(isset($_POST['sManualPorts'])){
if($_POST['sManualPorts']!=""){
if(strpos($_POST['sManualPorts'],",")>0){
$aPorts = @explode(",",$_POST['sManualPorts']);
$_SCAN['max'] = count($aPorts);
for($x=0;$x<$_SCAN['max'];$x++){
$aPorts[$x] = intval(trim($aPorts[$x]));
}
}
}
}
else{
if(!isset($_PORTS[$_POST['sType']])){
// ok just registered then, pff..
$_POST['sType'] = "registered";
}
$_SCAN['min'] = $_PORTS[$_POST['sType']][0];
$_SCAN['max'] = $_PORTS[$_POST['sType']][1] - $_PORTS[$_POST['sType']][0];
}
// catch invalid setup
if($_SCAN['min']==$_SCAN['max']){
die("Invalid scan options specified, remember that if you use manual ports that you need <b>,</b> in order to separate values.");
}
echo Screen("<br>\n<b>Running..</b><p>\n",$_CONTEXT['verbose'],$_CONTEXT['silent']);
// spit fire...
flush();
ob_flush();
// let's scan the target
$iOpen = 0;
include_once($_PATHS['functions_root']."/fwrite.php");
for($x=$_SCAN['min'];$x<$_SCAN['max'];$x++){
$iPort = isset($_POST['sManualPorts']) ? $aPorts[$x] : $x;
$rConnectS = @fsockopen($_POST['sInput'],$iPort,$errno,$errstr,$iTimeOut);
if($rConnectS){
$iOpen++;
echo Screen("[".$_POST['sInput'].":".$iPort."] - <b>OPEN</b><br />\n",$_CONTEXT['verbose'],$_CONTEXT['silent']);
if($_CONTEXT['log']==true){
WriteF($_LOG,$_POST['sInput']."|".$iPort."|".getservbyport($iPort,"tcp")."|".time()."\n");
}
}
else{
echo Screen("[".$_POST['sInput'].":".$iPort."] - <b>CLOSED</b> - (".$errstr.")<br />\n",$_CONTEXT['verbose'],$_CONTEXT['silent']);
}
flush();
ob_flush();
}
echo Screen("<b>open ports for ".$_POST['sInput']."</b>: ".$iOpen." (running time) ".(time()-$_CONTEXT['start_task'])."(s)\n",$_CONTEXT['verbose'],$_CONTEXT['silent']);
// update entry in background task file
include_once($_PATHS['includes_root']."/task_end.php");
echo $sEnd;
?>