dotnetlance

Parse youporn logs script

Oct 23rd, 2018
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.21 KB | None | 0 0
  1. #Script to parse youporn log files with logins, e-mails and passwords.
  2. #In effect you receive simple file e-mail;password.
  3. #You may need to sort it, uniq it and remove garbage.
  4. #I've got 1.5M e-mail+password records.
  5. #Run time few minutes for 1.4GB log files.
  6.  
  7. # #password #passwords #hack #hacker #script #perl #youporn #leak
  8.  
  9. #The magic:
  10.  
  11. #!/usr/bin/env perl
  12. use strict;
  13. use warnings;
  14.  
  15. my $outfn = "parse_result.csv";
  16. my %stats;
  17. $stats{filename}=$outfn;
  18. unlink $stats{filename};
  19. open(my $out, '>', $outfn) or die "can't open $outfn: $!";
  20. my @files = <*.log>;
  21. my $e;
  22. my $p;
  23. foreach my $file (@files) {
  24.     my $lines=0;
  25.     my $count = 0;
  26.     print "File: $file\n";
  27.     open my $fh, $file or die "can't open $file: $!";
  28.     $count += tr/\n/\n/ while sysread($fh, $_, 2 ** 16);
  29.     seek $fh, 0, 0;
  30.     my $line;
  31.     while($line = <$fh>) {
  32.         if (substr($line,0,1) eq '<') {
  33.             $e="";
  34.             $p="";
  35.         }
  36.         if (substr($line,0,6) eq 'email=') {
  37.             $e=substr($line,6,-1);
  38.         }
  39.         if (substr($line,0,9) eq 'password=') {
  40.             $p=substr($line,9,-1);
  41.         }
  42.         if (substr($line,0,1) eq '>' and length $e and length $p) {
  43.             print $out "$e;$p\n";
  44.         }
  45.         print "\r$lines/$count";
  46.         $lines++;
  47.     }
  48.     print "\n";
  49.     close($fh);
  50. }
  51. close($out);
Add Comment
Please, Sign In to add comment