alsakib945

Email Extractor

Nov 17th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.45 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. if($_GET['action'] == 'login'){
  4. $con = mysql_connect('localhost',$_GET['u'],$_GET['p']) or die(mysql_error());
  5. if($con){
  6. echo 'yes';
  7. mysql_close($con);
  8. }else{
  9. echo 'no';
  10. }
  11. exit();
  12. }elseif($_GET['action'] == 'go'){
  13. $f = go('localhost',$_GET['u'],$_GET['p'],$_GET['name']);
  14. if(isset($_GET['b'])){
  15. echo $f;
  16. }else{
  17. echo "<span class='red'>$f</span> Emails Founded. Check <span class='red'>".htmlspecialchars($_GET['name'])."</span> For Results.";
  18. }
  19. exit();
  20. }
  21.  
  22. echo '<!DOCTYPE html>
  23. <html>
  24. <head>
  25. <title>Database Emails Extractor</title>
  26. <link href="http://fonts.googleapis.com/css?family=Racing+Sans+One" rel="stylesheet" type="text/css">
  27. <script src="http://code.jquery.com/jquery-2.0.2.min.js"></script>
  28. <script>
  29. $(document).ready(function(){
  30. $("#gogo").on("click",function(){
  31. user = $("#username").val();
  32. pass = $("#password").val();
  33. name = $("#name").val();
  34. if(user==""||pass==""||name==""){
  35. window.alert("You must fill all fields");
  36. }else{
  37. $.get("?action=login&u="+encodeURIComponent(user)+"&p="+encodeURIComponent(pass),function(data){
  38. if(data=="no"){
  39. window.alert("Incorrect username Or password. Try Again.");
  40. }else{
  41. $("#forms").fadeOut(300,function(){
  42. $("#wait").fadeIn(300);
  43. });
  44. $.get("?action=go&u="+encodeURIComponent(user)+"&p="+encodeURIComponent(pass)+"&name="+encodeURIComponent(name),function(data){
  45. $("#wait").html(data);
  46. });
  47. }
  48. });
  49. }
  50. });
  51. $("#gog").on("click",function(){
  52. accounts = $("#accounts").val();
  53. name = $("#namee").val();
  54. if(accounts==""||name==""){
  55. window.alert("You must fill all fields");
  56. }else{
  57. $("#formmu").fadeOut(300,function(){
  58. $("#wait").fadeIn(300);
  59. });
  60. accounts = accounts.split("\n");
  61. totalb = 0;
  62. fail = 0;
  63. done = 0;
  64. for(i=0;i<accounts.length;i++){
  65. login = accounts[i].split(" ");
  66. $.get("?action=login&ip="+encodeURIComponent(login[0])+"&u="+encodeURIComponent(login[1])+"&p="+encodeURIComponent(login[2]),function(data){
  67. if(data=="yes"){
  68. $.get("?action=go&b=t&u="+encodeURIComponent(login[0])+"&p="+encodeURIComponent(login[1])+"&name="+encodeURIComponent(name),function(data){
  69. totalb += parseInt(data);
  70. done++;
  71. tt = done+fail;
  72. if(tt==accounts.length) donet(totalb,name);
  73. });
  74. }else{
  75. fail++;
  76. }
  77. });
  78. }
  79.  
  80. }
  81. });
  82. function donet(t,b){
  83. $("#wait").html("<span class=\"red\">"+t+"</span> Emails Founded. Check <span class=\"red\">"+b+"</span> For Results.");
  84. }
  85. $("#si").on("click",function(){
  86. $("#first").fadeOut(500,function(){
  87. $("#forms").fadeIn(500);
  88. });
  89. });
  90. $("#mu").on("click",function(){
  91. $("#first").fadeOut(500,function(){
  92. $("#formmu").fadeIn(500);
  93. });
  94. });
  95. });
  96. </script>
  97. <style>
  98. body{
  99. margin: 0;
  100. padding: 0;
  101. font-family: "Racing Sans One", cursive;
  102. background: #F3F3F3;
  103. font-size: 16px;
  104. }
  105. #page{
  106. margin: auto 25%;
  107. margin-top: 10px;
  108. background: #E6E6E8;
  109. border: #BABABE solid 1px;
  110. padding: 0;
  111. }
  112. #title{
  113. margin: 0;
  114. padding: 0;
  115. text-align: center;
  116. font-size: 30px;
  117. border-bottom: #BABABE solid 1px;
  118. }
  119. #footer{
  120. text-align: center;
  121. border-top: #BABABE solid 1px;
  122. }
  123. #forms,#wait,#first,#formmu{
  124. margin: 0;
  125. padding: 10px 0;
  126. background: #fff;
  127. }
  128. #wait,#forms,#formmu{
  129. display: none;
  130. }
  131. #wait,#first{
  132. text-align: center;
  133. }
  134. input,button,textarea{
  135. background: #F3F3F3;
  136. border: #BABABE solid 1px;
  137. }
  138. textarea:focus,textarea:hover,input:focus,input:hover,button:focus,button:hover{
  139. background: #fff;
  140. }
  141. button{
  142. padding: 10px;
  143. }
  144. .red{
  145. color: red;
  146. }
  147. </style>
  148. </head>
  149. <body>
  150. <div id="page">
  151. <div id="title">Database Emails Extractor</div>
  152. <div id="first">
  153. <button id="si">Single</button><button id="mu">Multiple</button>
  154. </div>
  155. <div id="forms">
  156. <table>
  157. <tr><td>Username</td><td> : </td><td><input type="text" id="username" /></td></tr>
  158. <tr><td>Password</td><td> : </td><td><input type="text" id="password" /></td></tr>
  159. <tr><td>Save As</td><td> : </td><td><input type="text" value="list.txt" id="name" /></td></tr>
  160. <tr><td></td><td></td><td><input id="gogo" type="submit" value="Extract!" /></td></tr>
  161. </table>
  162. </div>
  163. <div id="formmu">
  164. <table>
  165. <tr><td>Accounts</td><td> : </td><td><textarea id="accounts" rows="10" cols="30">ip username password</textarea></td></tr>
  166. <tr><td>Save As</td><td> : </td><td><input type="text" value="list.txt" id="namee" /></td></tr>
  167. <tr><td></td><td></td><td><input id="gog" type="submit" value="Extract!" /></td></tr>
  168. </table>
  169. </div>
  170. <div id="wait">
  171. <img src="http://www.gibs.co.za/SiteResources/Images/Loading.gif" />
  172. </div>
  173. <div id="footer">Coded By <span class="red">G-B</span>, Email: <span class="red">[email protected]</span></div>
  174. </div>
  175. </body>
  176. </html>';
  177. function go($host,$user,$pass,$file){
  178. $con = mysql_connect($host,$user,$pass);
  179. $fp = fopen($file,'a');
  180. $count = 0;
  181. $databases = getdata("SHOW DATABASES");
  182. foreach($databases as $database){
  183. $tables = getdata("SHOW TABLES FROM $database");
  184. foreach($tables as $table){
  185. $columns = getdata("SHOW COLUMNS FROM $database.$table");
  186. foreach($columns as $column){
  187. $emails = getdata("SELECT $column FROM $database.$table WHERE $column REGEXP '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]'");
  188. foreach($emails as $email){
  189. if(filter_var($email, FILTER_VALIDATE_EMAIL)){
  190. if(eregi($email,file_get_contents($file))) continue;
  191. $count++;
  192. fwrite($fp,"$email\n");
  193. }else{
  194. foreach(preg_split("/\s/",$text) as $string){
  195. if(filter_var($string,FILTER_VALIDATE_EMAIL)){
  196. if(eregi($string,file_get_contents($file))) continue;
  197. $count++;
  198. fwrite($fp,"$string\n");
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. }
  206. fclose($fp);
  207. mysql_close($con);
  208. return $count;
  209. }
  210. function getdata($sql){
  211. $q = mysql_query($sql);
  212. $result = array();
  213. while($d = mysql_fetch_array($q)){
  214. $result[] = $d[0];
  215. }
  216. return $result;
  217. }
Add Comment
Please, Sign In to add comment