Код:
# ------------------------------------------------------------------ # xcrack.pl -- Unix/Linux Password Cracker -- V1.00 # By manicx -- 22nd Dec 98 -- email from site # Get the latest from http://www.infowar.co.uk/manicx # usage = perl xcrack.pl PASSWORDFILE WORDFILE # --------------------------------------------------- # works under Windows all *nix i can find # --------------------------------------------------- # Updates: Now split into subs and read entire wordfile into an # array for extra speed plus breaks out of compare loop now on # password crack. Also it will now check for disabled accounts and # non-passworded accounts # This will probably be the last version of this. # I'll be moving to sockets now, look out on the site above. # start xcrack.pl #system("cls"); # This will clear the terminal/Dos screen # Then stick this info on the screen print ("\n \t\t-------------------------------"); print ("\n \t\t\t Xcrack V1.00"); print ("\n \t\thttp://www.infowar.co.uk/manicx"); print ("\n \t\t-------------------------------\n"); if ($#ARGV < 1) { usage(); # Print simple statement how to use program if no arguments exit; } $passlist = $ARGV[0]; # Our password File $wordlist = $ARGV[1]; # Our word list # ------------- Main Start --------------------------------- getwordlist(); # getting all words into array getpasslist(); # getting login and password print ("\n\tFinished - ", $wordlist, " - Against - ", $passlist); #------------------------------------------------------------ sub getpasslist{ open (PWD, $passlist) or die (" No Good Name for password File ", $passlist, "\n"); while (<PWD>) { ($fname, $encrypted, $uid, $gid, $cos, $home, $shell) = split ( /:/); if ($encrypted eq "\*") # Check if the account is Locked { print "Account :", $fname, " \t ------ Disabled\n"; next; # Skip to next read } if ($encrypted eq "x") # Check if the account is Locked { print "Account :", $fname, " \t ------ Disabled\n"; next; # Skip to next read } if ($encrypted eq "") # Check if the account has No Password { print "Account :", $fname, " \t ------ No Password\n"; next; # Skip to next read } enccompare(); # Call on next Sub } close (PWD); #closes the password file } #------------------------------------------------------------ sub getwordlist{ open (WRD, $wordlist) or die (" No Good Name for wordfile ", $wordlist, "\n"); while (<WRD>) { @tmp_array = split; # Getting the entire contents of our push @word_array, [@tmp_array]; # word file and stuffing it in here } close (WRD); #closes the wordlist } #------------------------------------------------------------ sub enccompare{ for $password ( @word_array) { $encword = crypt (@$password[0], $encrypted); # encrypt our word with the same salt if ($encword eq $encrypted) # as the encrypted password { print "Account :",$fname, " \t ------ \aPassword : ", @$password[0], "\n"; last; # Print the account name and password if broken then break loop } } } #------------------------------------------------------------ sub usage { print "usage = perl xcrack.pl PASSWORDFILE WORDFILE\n"; } # End xcrack.pl # simple usage if no #ARGV's