Advertisement
theanonym

gentrip.pl

Nov 30th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.09 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use Getopt::Long;
  4. use vars qw(%opt);
  5. use threads;
  6. #----------------------------------------
  7. GetOptions(\%opt, "threads=i", "regex=s", "ignore-case", "i", "help", "h");
  8. print_usage()
  9.    if($opt{"help"} || $opt{"h"});
  10. $opt{"regex"} = ($opt{"ignore-case"} || $opt{"i"}) ? qr/$opt{regex}/io : qr/$opt{regex}/o;
  11. #----------------------------------------
  12. my @chars = ('a'..'z', 'A'..'Z', 0..9, '.');
  13. my @threads = map {
  14.    new threads( sub {
  15.       my($thread_id) = @_;
  16.       my($pass, $trip);
  17.       while(1) {
  18.          $pass = "";
  19.          $pass .= $chars[rand @chars]
  20.             for(1..rand(11)+4);
  21.          $trip = substr(crypt($pass, substr($pass, 1, 2)), -10);
  22.          print "!$trip=$pass\n"
  23.             if($trip =~ $opt{"regex"});
  24.       }
  25.    }, $_)
  26. } (1..$opt{"threads"} || 1);
  27. $_->join() for(@threads);
  28. #----------------------------------------
  29. sub print_usage {
  30.    die <<USAGE
  31. Usage:
  32.    perl $0 [args]
  33.       --regex=%
  34.       -i --ignore-case
  35.       --threads=%
  36.       -h --help
  37. Example:
  38.    perl $0 --regex="^admin" --ignore-case --threads=2
  39. USAGE
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement