E-DUMP - Extracts email addresses from a MySQL database.


SUBMITTED BY: crazyren

DATE: May 24, 2016, 12:57 p.m.

FORMAT: PHP

SIZE: 7.3 kB

HITS: 85467

  1. <?php
  2. /*
  3. -------------------------------------------------------------------------------
  4. [ E-DUMP ]---------------------------------------------------------------------
  5. - Extracts email addresses from a MySQL database.
  6. -------------------------------------------------------------------------------
  7. [ TO RUN THE SCRIPT ]----------------------------------------------------------
  8. PHP Version 5.6.8
  9. php5-cli Lib
  10. MySQL support Enabled
  11. MySQL version 5.0.11
  12. Permission Writing
  13. -------------------------------------------------------------------------------
  14. [ ABOUT DEVELOPER ]------------------------------------------------------------
  15. NAME CoderPirata
  16. Blog http://coderpirata.blogspot.com.br/
  17. Twitter https://twitter.com/coderpirata
  18. Google+ https://plus.google.com/103146866540699363823
  19. Pastebin http://pastebin.com/u/CoderPirata
  20. Github https://github.com/coderpirata/
  21. */
  22. ini_set('error_log',NULL);
  23. ini_set('log_errors',FALSE);
  24. ini_set('display_errors', FALSE);
  25. ini_set('max_execution_time', FALSE);
  26. $oo = getopt('h::', ['help::', 'host:', 'user:', 'pass:', 'dbname:', 'save:', 'no-info']);
  27. function cores($nome){
  28. $cores = array("r" => "\033[1;31m", "g" => "\033[0;32m", "b" => "\033[1;34m", "g2" => "\033[1;30m", "g1" => "\033[0;37m");
  29. if(substr(strtolower(PHP_OS), 0, 3) != "win"){ return $cores[strtolower($nome)]; }
  30. }
  31. echo cores("g1")."
  32. ooooooooooo ooooooooo ooooo oooo oooo oooo oooooooooo
  33. 888 88 888 88o 888 88 8888o 888 888 888
  34. 888ooo8 oooooo 888 888 888 88 88 888o8 88 888oooo88
  35. 888 oo 888 888 888 88 88 888 88 888
  36. o888ooo8888 o888ooo88 888oo88 o88o 8 o88o o888o\n
  37. \t ".cores("g2")."[ ".cores("g1")."DUMP EMAILS FROM ".cores("b")."MYSQL".cores("g1")." DATABASE! ".cores("g2")."]
  38. -----------------------------------------------------------------\n\n";
  39. if(isset($oo['h']) or isset($oo['help'])){
  40. die(cores("g1")."\t ooooo ooooo ooooooooooo ooooo oooooooooo
  41. \t 888 888 888 88 888 888 888
  42. \t 888ooo888 888ooo8 888 888oooo88
  43. \t 888 888 888 oo 888 o 888
  44. \t o888o o888o o888ooo8888 o888ooooo88 o888o\n
  45. ".cores("g2")."-----------------------------------------------------------------\n".cores("g1")."
  46. COMMAND:: ".cores("b")."--host ".cores("g1")."~ Sets the Host.
  47. Example: {$_SERVER["SCRIPT_NAME"]} ".cores("b")."--host ".cores("g1")."localhost
  48. \n
  49. COMMAND:: ".cores("b")."--user ".cores("g1")."~ Sets the User.
  50. Example: {$_SERVER["SCRIPT_NAME"]} ".cores("b")."--user ".cores("g1")."root
  51. \n
  52. COMMAND:: ".cores("b")."--pass ".cores("g1")."~ Sets the Password.
  53. Example: {$_SERVER["SCRIPT_NAME"]} ".cores("b")."--pass ".cores("g1")."admin123
  54. \n
  55. COMMAND:: ".cores("b")."--dbname ".cores("g1")."~ Command to set the db that will be scanned. By default, all dbs will be scanned.
  56. Example: {$_SERVER["SCRIPT_NAME"]} ".cores("b")."--dbname ".cores("g1")."mydatabase
  57. \n
  58. COMMAND:: ".cores("b")."--save ".cores("g1")."~ Saves the emails found on a list.
  59. Example: {$_SERVER["SCRIPT_NAME"]} ".cores("b")."--save ".cores("g1")."email_list.txt
  60. {$_SERVER["SCRIPT_NAME"]} ".cores("b")."--save ".cores("g1")."\"\"
  61. COMMAND:: ".cores("b")."--no-info ".cores("g1")."~ It does not display the \"databases\" and the tables.
  62. Example: {$_SERVER["SCRIPT_NAME"]} ".cores("b")."--no-info
  63. \n");
  64. }
  65. if(empty($oo['host']) or empty($oo['user']) or !isset($oo['pass'])){ die(); }
  66. $db_blacklist = array('information_schema', 'performance_schema');
  67. if(isset($oo["save"])){
  68. $save = cores("g")."YES";
  69. if(!empty($oo["save"])){$save .= cores("g2")."\n| ".cores("g1")."FILE NAME:: ".cores("b").$oo["save"].cores("g2"); }
  70. }else{ $save = cores("r")."NOT"; }
  71. if(isset($oo["dbname"])){ $dbnme = cores("g").$oo["dbname"]; }else{ $dbnme = cores("r")."NOT DEFINED"; }
  72. echo cores("g2").".-[ ".cores("g1")."INFOS".cores("g2")." ] ------------------------------------------------------
  73. | ".cores("g1")."HOST:: ".cores("b").$oo["host"].cores("g2")."
  74. | ".cores("g1")."USER:: ".cores("b").$oo["user"].cores("g2")."
  75. | ".cores("g1")."PASS:: ".cores("b").$oo["pass"].cores("g2")."
  76. | ".cores("g1")."DBNAME:: ".cores("b").$dbnme.cores("g2")."
  77. | ".cores("g1")."SAVE:: {$save}".cores("g2")."
  78. '-----------------------------------------------------------------\n";
  79. $conect = mysql_connect($oo["host"],$oo["user"],$oo["pass"]) or die(cores("r")."\n\nERROR:: ".mysql_error()."\n\n");
  80. if(empty($oo["dbname"])){
  81. $resultado = mysql_query("SHOW DATABASES;", $conect) or die(cores("r")."\n\nERROR:: ".mysql_error()."\n\n");
  82. while($data = mysql_fetch_row($resultado)){ $resultado_query .= implode('|-|-|-|-|-|',$data)."\n"; }
  83. $lim = explode("|-|-|-|-|-|", $resultado_query);
  84. foreach($lim as $lin){ if(!empty($lin)){ $dbnames = $lin; } }
  85. $dbname = explode("\n", $dbnames);
  86. foreach($dbname as $n => $d){
  87. foreach($db_blacklist as $blocked){ if(empty($d) or $d == $blocked){ unset($dbname[$n]); } }
  88. }
  89. }else{ $dbname[] = $oo["dbname"]; }
  90. if(!isset($oo["no-info"])){ echo cores("g1")."\n SEARCHIN IN:: "; }
  91. foreach($dbname as $dbnam3){
  92. if(!isset($oo["no-info"])){ echo cores("g2")."\n -----------------------------------\n ".cores("g2")."[ ".cores("g1")."DBNAME".cores("g2")." ]::".cores("b")."$dbnam3\n".cores("g2")." [ ".cores("g1")."TABLES ".cores("g2")."]::"; }
  93. mysql_select_db($dbnam3) or die(cores("r")."\n\nERROR:: ".mysql_error()."\n\n");
  94. $res = mysql_list_tables($dbnam3) or die(cores("r")."\n\nERROR:: ".mysql_error()."\n\n");
  95. while ($row = mysql_fetch_row($res)){
  96. $table = $row[0];
  97. $res2 = mysql_query("SHOW CREATE TABLE $table");
  98. if(!isset($oo["no-info"])){ echo cores("g2")." - ".cores("b")."{$table}"; }
  99. while ($lin = mysql_fetch_row($res2)){
  100. $res3 = mysql_query("SELECT * FROM $table");
  101. while($r=mysql_fetch_row($res3)){
  102. $sql="INSERT INTO $table VALUES (";
  103. for($j=0; $j<mysql_num_fields($res3);$j++){
  104. if($r[$j] != ""){ $dados .= " - ".$r[$j]." - "; }
  105. }
  106. }
  107. }
  108. $table = NULL;
  109. }
  110. }
  111. mysql_close($coneccao);
  112. if(!isset($oo["no-info"])){ echo cores("g2")."\n\n -----------------------------------------------------------------\n"; }
  113. preg_match_all("/([\w\d\.\-\_]+)@([\w\d\.\_\-]+)/mi", $dados, $possiveis);
  114. $email = array_unique(array_unique($possiveis[0]));
  115. if(empty($email)){ echo cores("r")."\n EMAIL(s) NOT FOUND\n"; goto sai; }else{ echo cores("g")."\n ".count($email)." EMAIL(s) FOUND".cores("g1")."\n\n"; }
  116. foreach ($email as $emails){ if(eregi(".", $emails)){ echo cores("g1")."\n EMAIL:: ".cores("g")."{$emails}"; } }
  117. echo "\n\n";
  118. if(!empty($email) and isset($oo["save"])){
  119. if(isset($oo["save"]) and empty($oo["save"])){ $name = "e-dump_emails.txt"; }else{ $name = $oo["save"]; }
  120. if(!file_exists($name)){ file_put_contents($name, "EMAIL's LEAKED FROM {$oo["host"]} WITH E-DUMP! ".PHP_EOL.PHP_EOL.PHP_EOL); }
  121. foreach ($email as $emails){ file_put_contents($name, "EMAIL: ".$emails.PHP_EOL, FILE_APPEND); }
  122. echo " ".cores("g1")."EMAILS SAVED IN: ".cores("b")."{$name}\n";
  123. }
  124. sai:
  125. echo cores("g2")." -----------------------------------------------------------------\n";
  126. #END

comments powered by Disqus