Advertisement
Ribang

Database Emails Extractor

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