..cool, we will make a new module and not just some new module, nope let's make a fully automatic injection script! This tutorial is the first step into making this. Let's first..
xAnalyze is a module that can search through corrupt data and configuration files in order to find the exact position of errors
<?php
if(!defined('IN_SCRIPT')){
exit;
}
/* Render jQuery field actions */
$sJS = "\n\$(function(){\n";
// first make the default fields appear.
foreach($_JSFUNC as $sKey=>$sValue){
$sJS .= " \$('#".$sKey."').".($sValue==1 ? "show()" : "hide('slow')").";\n";
}
// default field actions
$sJS .= " // make stuff appear or dissapear depending on selected scan type\n";
$sJS .= " \$(\".scanf\").change(function() {\n";
$sJS .= " if(this.value=='1'){\n";
$sJS .= " // infinite scan of target each x seconds, act on string occurence\n";
$sJS .= " \$('#timescan').hide('slow');\n";
$sJS .= " }\n";
$sJS .= " else if(this.value=='2'){\n";
$sJS .= " // infinite scan of target each x seconds, act on missing string\n";
$sJS .= " \$('#timescan').hide('slow');\n";
$sJS .= " }\n";
$sJS .= " else if(this.value=='3'){\n";
$sJS .= " // temporary scan of target each x seconds, act on string occurence\n";
$sJS .= " \$('#timescan').show();\n";
$sJS .= " }\n";
$sJS .= " else if(this.value=='4'){\n";
$sJS .= " // temporary scan of target each x seconds, act on missing string\n";
$sJS .= " \$('#timescan').show();\n";
$sJS .= " }\n";
$sJS .= " else if(this.value==''){\n";
$sJS .= " // no option selected\n";
$sJS .= " \$('#timescan').hide('slow');\n";
$sJS .= " }\n";
$sJS .= " });\n";
$sJS .= " // notification\n";
$sJS .= " \$(\".notifyf\").change(function() {\n";
$sJS .= " if(this.value=='1'){\n";
$sJS .= " // hide log options\n";
$sJS .= " \$('#emailaddress').show();\n";
$sJS .= " \$('#emailtemplate').show();\n";
$sJS .= " \$('#logfile').hide('slow');\n";
$sJS .= " \$('#logtemplate').hide('slow');\n";
$sJS .= " }\n";
$sJS .= " else if(this.value=='2'){\n";
$sJS .= " // hide email options\n";
$sJS .= " \$('#emailaddress').hide('slow');\n";
$sJS .= " \$('#emailtemplate').hide('slow');\n";
$sJS .= " \$('#logfile').show();\n";
$sJS .= " \$('#logtemplate').show();\n";
$sJS .= " }\n";
$sJS .= " else if(this.value==''){\n";
$sJS .= " // hide email and log options\n";
$sJS .= " \$('#emailaddress').hide('slow');\n";
$sJS .= " \$('#emailtemplate').hide('slow');\n";
$sJS .= " \$('#logfile').hide('slow');\n";
$sJS .= " \$('#logtemplate').hide('slow');\n";
$sJS .= " }\n";
$sJS .= " });\n";
$sJS .= " // use a callback\n";
$sJS .= " \$(\".callbackf\").change(function() {\n";
$sJS .= " if(this.value=='yes'){\n";
$sJS .= " // show callback function input field\n";
$sJS .= " \$('#callbackfunction').show();\n";
$sJS .= " \$('#sendvars').hide('slow');\n";
$sJS .= " }\n";
$sJS .= " else{\n";
$sJS .= " // show a1-a9\n";
// when we set callback to empty or no, show a1-a9
$sAShow = "";
for($x=1;$x<=9;$x++){
$sAShow .= " \$('#a".$x."').show();\n";
}
$sJS .= $sAShow;
$sJS .= " }\n";
$sJS .= " if(this.value=='no'){\n";
$sJS .= " // hide callback function input field\n";
$sJS .= " \$('#callbackfunction').hide('slow');\n";
$sJS .= " \$('#sendvars').show();\n";
$sJS .= " }\n";
$sJS .= " else if(this.value==''){\n";
$sJS .= " // no option selected\n";
$sJS .= " \$('#callbackfunction').hide('slow');\n";
$sJS .= " \$('#sendvars').hide('slow');\n";
$sJS .= " }\n";
$sJS .= " });\n";
// okidoki, let's get all those callbacks and render the last jQuery functions
$_GETCBACK = 1;
$_CBACKSELECT = "";
if(false!==($aFiles = GetFilesByDirectory($_PATHS['thc_ss_callbacks']))){
// include the callbacks and generate the script
$_CBACKSELECT .= "<select name=\"sCallbackF\" class=\"cbck\">\n";
$_CBACKSELECT .= " <option value=\"\" selected=\"selected\">select an option</option>\n";
$iFiles = count($aFiles);
$sJS .= " \$(\".cbck\").change(function() {\n";//cbck
for($x=0;$x<$iFiles;$x++){
include_once($_PATHS['thc_ss_callbacks']."/".$aFiles[$x]);
$_CBACKSELECT .= " <option value=\"".$_CBACKD[1]."\">".$_CBACKD[0]."</option>\n";
// we are interested in the two variables $_CBACKD and $_CBACKV
$sJS .= " ".($x!=0 ? "else " : "")."if(this.value=='".$_CBACKD[1]."'){\n";
$sJS .= " // ".$_CBACKD[0]."\n";
// set values, hide fields etc.
for($y=0;$y<count($_CBACKV);$y++){
if($_CBACKV[$y]['value']!=""){
// change the value of this item
$sJS .= " \$('.".$_CBACKV[$y]['fieldclass']."').val('".str_replace("'","\'",$_CBACKV[$y]['value'])."');\n";
}
if($_CBACKV[$y]['visibility']==0){
// hide this item
$sJS .= " \$('.".$_CBACKV[$y]['row']."').hide('slow');\n";
}
elseif($_CBACKV[$y]['visibility']==1){
// show item
$sJS .= " \$('.".$_CBACKV[$y]['row']."').show();\n";
}
}
$sJS .= " }\n";
}
$sJS .= " });\n";
$_CBACKSELECT .= " </select>\n";
}
$sJS .= "});";
$sJS = "<script type=\"text/javascript\">".$sJS."</script>";
?>