Advertisement
wirehack7

Untitled

Feb 2nd, 2019
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. <?php
  2.  
  3.     error_reporting(E_ALL & ~ E_NOTICE | E_WARNING);
  4.     require_once ('MysqliDb.php');
  5.    
  6.     $db = new MysqliDb ('localhost', '', '', 'leak');
  7.    
  8.     function getDirContents($dir, &$results = array()){
  9.         $files = scandir($dir);
  10.  
  11.         foreach($files as $key => $value){
  12.             $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
  13.             if(!is_dir($path)) {
  14.                 $results[] = $path;
  15.             } else if($value != "." && $value != "..") {
  16.                 getDirContents($path, $results);
  17.                 $results[] = $path;
  18.             }
  19.         }
  20.  
  21.         return $results;
  22.     }
  23.  
  24.     $files = getDirContents('bigDB');
  25.     $fileData = function($file) {
  26.         $file = fopen($file, 'r');
  27.  
  28.         if (!$file)
  29.             die('file does not exist or cannot be opened');
  30.  
  31.         while (($line = fgets($file)) !== false) {
  32.             yield $line;
  33.         }
  34.  
  35.         fclose($file);
  36.     };
  37.    
  38.     $re1='([\\w-+]+(?:\\.[\\w-+]+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,7})'; # Email Address 1
  39.     $re2='(:)'; # Any Single Character 1
  40.    
  41.     foreach($files as $file)
  42.     {
  43.         if(filetype($file) == "file")
  44.         {
  45.             foreach ($fileData($file) as $line) {
  46.                 // $line contains current line
  47.                 if ($c=preg_match_all ("/".$re1.$re2."/is", $line, $matches))
  48.                 {
  49.                     $data = explode(':', $line);
  50.                     if(count($data) > 2)
  51.                     {
  52.                         $i = 1;
  53.                         while($i <= count($data))
  54.                         {
  55.                             $password .= $data[$i];
  56.                             $i++;
  57.                         }
  58.                     }
  59.                     else
  60.                     {
  61.                         $password = $data[1];
  62.                     }
  63.                    
  64.                     $mail = $data[0];
  65.                    
  66.                     $db->where('username',$mail);
  67.                     $db->where('password',$password);
  68.                     $results = $db->get ('data');
  69.                     if(count($results) == 0){
  70.                         $insert = array("username" => $mail, "password" => $password);
  71.                         $id = $db->insert ('data', $insert);
  72.                         if($id) echo 'Entry created. Id=' . $id." username: ".$mail." password: ".$password."\n";
  73.                     }
  74.                     else{
  75.                         echo "Entry already exists!";
  76.                     }
  77.                 }
  78.                
  79.             }
  80.         }
  81.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement