Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use Getopt::Long;
- use vars qw(%opt);
- use threads;
- #----------------------------------------
- GetOptions(\%opt, "threads=i", "regex=s", "ignore-case", "i", "help", "h");
- print_usage()
- if($opt{"help"} || $opt{"h"});
- $opt{"regex"} = ($opt{"ignore-case"} || $opt{"i"}) ? qr/$opt{regex}/io : qr/$opt{regex}/o;
- #----------------------------------------
- my @chars = ('a'..'z', 'A'..'Z', 0..9, '.');
- my @threads = map {
- new threads( sub {
- my($thread_id) = @_;
- my($pass, $trip);
- while(1) {
- $pass = "";
- $pass .= $chars[rand @chars]
- for(1..rand(11)+4);
- $trip = substr(crypt($pass, substr($pass, 1, 2)), -10);
- print "!$trip=$pass\n"
- if($trip =~ $opt{"regex"});
- }
- }, $_)
- } (1..$opt{"threads"} || 1);
- $_->join() for(@threads);
- #----------------------------------------
- sub print_usage {
- die <<USAGE
- Usage:
- perl $0 [args]
- --regex=%
- -i --ignore-case
- --threads=%
- -h --help
- Example:
- perl $0 --regex="^admin" --ignore-case --threads=2
- USAGE
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement