..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 function. what we..
Mister LG can create upload forms and test targets on file upload vulnerabilities
<?php
set_time_limit(0);
session_cache_limiter('nocache');
header('Expires: '.gmdate('r',0));
header('Content-type: application/json');
$_DYNAMIC_ROOT = "../..";
include_once("../../header.php");
// set variable to be able to save a task
$_MODULE_C = "thc_pg";
include_once($_PATHS['includes_root']."/task_start.php");
$aDataR = array();
$aDataR['jresult'] = false;
$aDataR['jerror'] = "Invalid post data";
$_CONTEXT['words'] = array();
if(isset($_POST['sInput']) && isset($_POST['sFile'])){
// does file exist?
$sFile = $_PATHS['wordlists_root']."/".ExploitFilter($_POST['sFile'],0,1);
if(file_exists($sFile)){
$aDataR['jerror'] = "Wordlist already exists";
}
else{
if(!function_exists("WriteF")){
include_once($_PATHS['functions_root']."/fwrite.php");
}
if(!WriteF($sFile,"","w")){
// create file
$aDataR['jerror'] = "Failed to create wordlist";
}
else{
// include common file
include_once($_PATHS['module_default_root']."/common.php");
// include password generator
include_once($_PATHS['module_default_root']."/func_createpass.php");
// include password structures
include_once($_PATHS['module_default_root']."/pass_structure.php");
// buffer words
$sBuffer = "";
if(isset($_POST['iCommon']) && $_POST['iCommon']==1){
for($x=0;$x<count($_CONTEXT['common']);$x++){
$sBuffer .= $_CONTEXT['common'][$x]."\n";
}
}
$aInput = explode(",",$_POST['sInput']);
$aInput = CreateWords($aInput,$_CONTEXT['common']);
/*
This part is new since 0.6, in earlier versions all passwords were stored in one go, which could lead to memory problems.
In 0.6 we will write the wordlist in smaller portions to prevent this issue.
First create the data file and then write each result buffer.
*/
if(!WriteF($sFile,"","w")){
// write words to file
$aDataR['jerror'] = "Failed to create wordlist";
}
else{
// keep track of the wordlist file size
$iSize = 0;
// combinations
foreach($_CONTEXT['wliststruc'] as $iKey=>$aValues){
CreatePasses($aInput,$_CONTEXT['common'],$aValues);
if($sBuffer!=""){
$iSize += strlen($sBuffer);
WriteF($sFile,$sBuffer,"a");
// reset current buffer
$sBuffer = "";
}
}
}
if($iSize>0){
$aDataR['jresult'] = true;
$aDataR['jwlsize'] = round(($iSize/1024)/1024,1)." MB";
}
else{
$aDataR['jerror'] = "No data to put into wordlist";
}
}
}
}
echo json_encode($aDataR);
// update entry in background task file
include_once($_PATHS['includes_root']."/task_end.php");
?>