Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.35 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. if (@ARGV[0] eq "") { @ARGV[0] = "g.in"; }
  4.  
  5. $HTML = @ARGV[0];
  6.  
  7. open(HTML);
  8.  
  9. @fileinput = <HTML>;
  10.  
  11. $i = 0; $text = "";
  12. foreach $line(@fileinput) {
  13.     if ($i == 0) {
  14.         $i = 1;
  15.         $hash = substr($line, 0, 13);
  16.         $salt = substr($hash, 0, 2);
  17.     } else {
  18.         $text = $text.' '.$line;
  19.     }
  20. }
  21. close (HTML);
  22.  
  23. # To lowercase
  24. $text = lc($text);
  25. # Extract only letter and spaces
  26. $text =~ s/[^a-z ]//g;
  27. $text =~ s/\n//g;
  28. # Put words in array
  29. @words_raw = split(' ', $text);
  30. # Remove duplicated words in array
  31. %seen = (); @words = grep { ! $seen{$_} ++ } @words_raw;
  32.  
  33. $i = 0; %words = ();
  34.  
  35. open (MYFILE, '>>log.txt');
  36. foreach $word(@words) {$words{$i} = $word;$i++;print MYFILE $word."\n";}
  37. close (MYFILE);
  38.  
  39. # Test all combinations
  40. @glues = ('2','4','6','8');
  41. while (($k1, $word) = each(%words)) {
  42.     $l1 = length($word);
  43.     delete($words{$k1});
  44.     if ($l1 != 0 && 7 > $l1) {
  45.         while (($k2, $word2) = each(%words)) {
  46.             $length = length($word2) + $l1;
  47.             if ($length != $l1) {
  48.                 if ($length > 3 && 8 > $length) {
  49.                     foreach $glue(@glues) {
  50.                         if (crypt($word.$glue.$word2, $salt) eq $hash) {
  51.                             print $word.$glue.$word2."\n";
  52.                             exit;
  53.                         } elsif (crypt($word2.$glue.$word, $salt) eq $hash) {
  54.                             print $word2.$glue.$word."\n";
  55.                             exit;
  56.                         }
  57.                     }
  58.                 }
  59.             } else {
  60.                 delete($words{$k2});
  61.             }
  62.         }
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement