[En Desarrollo][#Beastie - Multiple CMS Scaner - Toolkit]

Iniciado por hielasangre, Febrero 27, 2013, 01:34:47 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Febrero 27, 2013, 01:34:47 PM Ultima modificación: Noviembre 23, 2014, 02:52:29 PM por Expermicid
Esta herramienta la tengo algo olvidada, prometo actualizarla dentro de poco.

Acá dejo el código que empeze el sábado pasado y hoy retome, la idea es hacer una especie de scanner que identifique que cms (por ahora joomla o wordpress) y nos busque en No tienes permitido ver los links. Registrarse o Entrar a mi cuenta el enlace en el caso de que haya algún exploit para los módulos o plugins afectados... Como dije esta en desarrollo, le falta mucho todavia, pero esta alpha me va a permitir corregir algunos detalles, me gustaría que lo prueben y comenten.
Para una próxima actualización la idea es buscar las fallas mas conocidas como ser lfi,rfi,xss,sqli para el caso de webs que no sean cms como los citados anteriormente, también busca los directorios que mas nos interesan (phpmyadmin,admin,etc...)







Código: php

<?php
/*
*     
*     
*      Copyright 2012 hielasangre <hielasangre@fuckingmachine>
*     
*      This program is free software; you can redistribute it and/or modify
*      it under the terms of the GNU General Public License as published by
*      the Free Software Foundation; either version 2 of the License, or
*      (at your option) any later version.
*     
*      This program is distributed in the hope that it will be useful,
*      but WITHOUT ANY WARRANTY; without even the implied warranty of
*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*      GNU General Public License for more details.
*     
*      You should have received a copy of the GNU General Public License
*      along with this program; if not, write to the Free Software
*      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
*      MA 02110-1301, USA.
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>[#Beastie - Multiple CMS Scaner - Toolkit]</title>
<style>
body
{
background: #1a1a1a;
}
#resultados
{
background: #161616;
text-align: left;
padding:3px;

}
#textarea
{
overflow-x: scroll;
overflow-y: hidden;
background: #000;
border-style:solid;
border-color: #CCC;
border-width: 2px;
}
#contenedor
{
margin-left:auto;
margin-right:auto;
padding: 25px;
width:800px;
color:#FFF;
background: #161616;
border-style:solid;
border-color: #101010;
border-width: 5px;
background: #1a1a1a;
margin: 5px 0 5px 0;
border-radius:7px;
-moz-border-radius: 7px;
-webkit-border-radius : 7px;
}
input,textarea,select
{
background-color: black;
margin:6px 0 3px 0;
color: #FFF;
font-family: courier new;
font-size: 18px;
border: solid 1px #555;
}
.chico
{
text-align: center;
font-size: 10px;
font-family: Tahoma;
}
#resultados a:visited
{
color:#CCC;
text-decoration: none;
}
#resultados a:link
{
color:#CCC;
text-decoration: none;
}
#resultados a:hover
{
color:#FF0000;
text-decoration: none;
}

td.resultados
{
width: 798px;
border-style:solid;
border-color: #555;
border-width: 1px;
}
td.resultados:hover
{
background-color:#000;
text-decoration: none;
}

#paginador a:visited
{
font-size:18px;
color:#CCC;
text-decoration: none;
}
#paginador a:link
{
font-size:18px;
color:#CCC;
text-decoration: none;
}
#paginador a:hover
{
font-size:18px;
color:#FF0000;
text-decoration: none;
}

</style>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
</head>
<body>
<center>
<div id="contenedor">
     <img src="http://www.remoteexecution.info/img/logo.png">
<form action="" method="post">
<table>
<tr>
<td colspan="2"><input type="text" name="target" size="70"/></td>
</tr>
<tr>
<td class="chico" colspan="2" width="100%">Ingrese URL.</td>
</tr>
<tr>
<td width="50%" ></td>
<td width="50%" align="right"><input type="submit" name="submit" value="Test! >" /></td>
</tr>
</table>
</form>
<?php
$target = strip_tags(trim($_POST['target']));
if(isset($target) && ($target!=''))
{
  $ch = curl_init();
              curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
              curl_setopt($ch, CURLOPT_HEADER, 1);
              curl_setopt($ch, CURLOPT_URL, $target);
              $result = curl_exec($ch);
  curl_close($ch);
  $cabeceras = explode("\n\r\n", $result);
  $headers = $cabeceras[0];
  function identificar($target)
{
    $joomla = $target."/administrator/";
$fp = curl_init($joomla);
$ret = curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_setopt($fp, CURLOPT_TIMEOUT, 30);
$ret = curl_exec($fp);
$info = curl_getinfo($fp, CURLINFO_HTTP_CODE);
curl_close($fp);
if($info == 200)
{
echo 'El sistema base es: <a href="http://www.joomla.org/" target="_blank">Joomla!</a><br/>';
global $cms;
$cms = "1";
}
$wordpress = $target."/wp-login.php";
$fp = curl_init($wordpress);
$ret = curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_setopt($fp, CURLOPT_TIMEOUT, 30);
$ret = curl_exec($fp);
$info = curl_getinfo($fp, CURLINFO_HTTP_CODE);
curl_close($fp);
if($info == 200)
{
echo 'El sistema base es: <a href="http://wordpress.org/" target="_blank">Wordpress</a>';
global $cms;
$cms = "2";
}
}
function edb($componente)
{
$exploitdb ="http://www.exploit-db.com/search/?action=search&filter_page=1&filter_description=$componente&filter_exploit_text=&filter_author=&filter_platform=0&filter_type=0&filter_lang_id=0&filter_port=&filter_osvdb=&filter_cve=";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_URL, $exploitdb);
$fuente= curl_exec($ch);
curl_close($ch);
if (preg_match("/No results/",$fuente)) 
{
ob_flush();
echo '<tr><td class="resultados">'.$componente.'</td></tr>';
flush();
}
else{
if($componente!=' ')
{
ob_flush();
echo '<tr><td class="resultados"><a href="'.$exploitdb.'" target="_blank">'.$componente.'</a></td></tr>';
flush();
}
}
}
function wp_plugins($result)
{
preg_match_all("#/plugins/(.*?)/#i", $result, $f);
$plugins=array_unique($f[1]);
if(count($plugins)==0)
{
ob_flush();
echo '<td class="resultados ">No fue posible encontrar nada relacionado a este CMS</td><br>';
flush();
}
foreach($plugins as $plugin)
{
edb($plugin);
}
}
function joomla_components($site)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_URL, $site);
$source= curl_exec($ch);
curl_close($ch);
preg_match_all('{option,(.*?)/}i',$source,$f);
preg_match_all('{option=(.*?)(&amp;|&|")}i',$source,$f2);
preg_match_all('{/components/(.*?)/}i',$source,$f3);
$arreglo=array_merge($f2[1],$f[1],$f3[1]);
$componentes=array();
if(count($arreglo)==0)
{
ob_flush();
echo '<td class="resultados ">No fue posible encontrar nada relacionado a este CMS</td>"';
flush();
}
foreach(array_unique($arreglo) as $x)
{
$componentes[]=$x;
}
foreach($componentes as $componente_encontrado)
{
edb($componente_encontrado);
}
}
              if (preg_match("/200 OK/", $result))
{
                     echo '<div id="resultados">';
                     echo 'El sitio ingresado (<a href="'.$target.'" target="_blank">'.$target.'</a>) devuelve: <br/>';
                     echo '<div id="textarea"><pre>'.htmlentities($headers).'</pre></div><br/>';
                     identificar($target);
                     echo '<table>';
if($cms == "1")
{
joomla_components($target);
}
if($cms == "2")
{
wp_plugins($result);
}
                     echo '</table>';
                     echo '</div><br>';
                     $list = array('/phpMyAdmin/', '/phpmyadmin/','/PMA/','/pma/','/admin/','/dbadmin/','/mysql/', '/myadmin/', '/phpmyadmin2/','/phpMyAdmin2/', '/phpMyAdmin-2/',
   '/php-my-admin/','/phpMyAdmin-2.2.3/', '/phpMyAdmin-2.2.6/', '/phpMyAdmin-2.5.1/', '/phpMyAdmin-2.5.4/', '/phpMyAdmin-2.5.5-rc1/',
   '/phpMyAdmin-2.5.5-rc2/', '/phpMyAdmin-2.5.5/', '/phpMyAdmin-2.5.5-pl1/', '/phpMyAdmin-2.5.6-rc1/', '/phpMyAdmin-2.5.6-rc2/', '/phpMyAdmin-2.5.6/',
                                   '/phpMyAdmin-2.5.7/', '/phpMyAdmin-2.5.7-pl1/', '/phpMyAdmin-2.6.0-alpha/', '/phpMyAdmin-2.6.0-alpha2/', '/phpMyAdmin-2.6.0-beta1/',
                                   '/phpMyAdmin-2.6.0-beta2/', '/phpMyAdmin-2.6.0-rc1/', '/phpMyAdmin-2.6.0-rc2/', '/phpMyAdmin-2.6.0-rc3/','/phpMyAdmin-2.6.0/',
                                   '/phpMyAdmin-2.6.0-pl1/', '/phpMyAdmin-2.6.0-pl2/', '/phpMyAdmin-2.6.0-pl3/', '/phpMyAdmin-2.6.1-rc1/', '/phpMyAdmin-2.6.1-rc2/',
                                   '/phpMyAdmin-2.6.1/', '/phpMyAdmin-2.6.1-pl1/', '/phpMyAdmin-2.6.1-pl2/', '/phpMyAdmin-2.6.1-pl3/','/phpMyAdmin-2.6.2-rc1/',
                                   '/phpMyAdmin-2.6.2-beta1/', '/phpMyAdmin-2.6.2-rc1/', '/phpMyAdmin-2.6.2/', '/phpMyAdmin-2.6.2-pl1/', '/phpMyAdmin-2.6.3/',
                                   '/phpMyAdmin-2.6.3-rc1/', '/phpMyAdmin-2.6.3/', '/phpMyAdmin-2.6.3-pl1/', '/phpMyAdmin-2.6.4-rc1/', '/phpMyAdmin-2.6.4-pl1/',
                                   '/phpMyAdmin-2.6.4-pl2/', '/phpMyAdmin-2.6.4-pl3/', '/phpMyAdmin-2.6.4-pl4/', '/phpMyAdmin-2.6.4/', '/phpMyAdmin-2.7.0-beta1/',
                                   '/phpMyAdmin-2.7.0-rc1/', '/phpMyAdmin-2.7.0-pl1/', '/phpMyAdmin-2.7.0-pl2/', '/phpMyAdmin-2.7.0/', '/phpMyAdmin-2.8.0-beta1/',
                                   '/phpMyAdmin-2.8.0-rc1/', '/phpMyAdmin-2.8.0-rc2/', '/phpMyAdmin-2.8.0/', '/phpMyAdmin-2.8.0.1/', '/phpMyAdmin-2.8.0.2/', '/phpMyAdmin-2.8.0.3/',
                                   '/phpMyAdmin-2.8.0.4/', '/phpMyAdmin-2.8.1-rc1/', '/phpMyAdmin-2.8.1/', '/phpMyAdmin-2.8.2/', '/sqlmanager/', '/mysqlmanager/', '/p/m/a/',
                                   '/PMA2005/', '/pma2005/', '/phpmanager/', '/php-myadmin/', '/phpmy-admin/', '/webadmin/', '/sqlweb/', '/websql/', '/webdb/', '/mysqladmin/',
   '/mysql-admin/','/mya/','/robots.txt','/phpinfo.php',
  );
echo '<div id="resultados">';
echo '<table>';
  foreach($list as $path => $test)
{
                                         $ch = curl_init();
                                         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                                         curl_setopt($ch, CURLOPT_HEADER, 1);
                                         curl_setopt($ch, CURLOPT_URL, $target.$test);
                                         $pma = curl_exec($ch);
curl_close($ch);
if (preg_match("/200 OK/", $pma))
{
echo '<tr><td class="resultados ">';
    ob_flush();
echo '[!] <a href="'.$target.$test.'" target="_blank">'.$target.$test.'</a>';
flush();
echo '</td></tr>';
}
}
echo '</table>';
echo '</div><br>';
                     echo '<div id="resultados">';
                     echo '<td class="resultados ">Analisis Finalizado. <a href="'.$_SERVER['PHP_SELF'].'">¿Deseas chequear otro sitio?</a></td>';
echo '</div>';
                     }
                     else
{
echo '<div id="resultados">';
                         echo '¡No es posible establecer conexion con el sitio!<br><td class="resultados "><a href="'.$_SERVER['PHP_SELF'].'">¿Deseas chequear otro sitio?</a></td>
   </div>';
                        }
}
?>
</div>
</center>
</body>
</html>