Perl SMF Login [by Dreamclown]

#!usr/bin/perl

use LWP::UserAgent;
use HTTP::Cookies;

login_smf("user","password","http://localhost/index.php");
while(1){
}

sub login_smf{
my $user = $_[0];
my $password = $_[1];
my $target = $_[2];

$host = "$target?action=login";
$agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
$ua = LWP::UserAgent->new(agent => $agent,
timeout => 10
);
$res = $ua->get($host);
$phpses = get_setcookie($res->as_string());
$ua->default_header(
'Accept' => "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
'Accept-Charset' => "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
'Keep-Alive' => '115',
'Connection' => 'keep-alive',
'Referer' => "$target?PHPSESSID=" . $phpses . "action=login2",
'Cookie' => "PHPSESSID=$phpses"
);

$host = "$target?PHPSESSID=" . $phpses . "&action=login2";
$res = $ua->post($host,
[
'user' => $user,
'passwrd' => $password,
'cookieneverexp' => 'on',
'hash_passwrd' => ''
]
);
print "===========================================\n";
print "[+] Host : $target\n";
print "[+] Login in $user..\n";
print "[+] Pass in $password..\n";
$ct = $res->content();
$ua->default_header('Cookie' => set_cookie($res->as_string()));
$res = $ua->get($target);
if($res->content() =~m/$user/ig){
print "[+] Success...!\n";
}
else{print "[+] Failed..\n";}
}

sub get_setcookie{
my $var = $_[0];
if($var =~ /Set-Cookie: PHPSESSID=(.+);/){
return $1;
}
}

sub set_cookie{
my $var = $_[0];
my $phpses;
if($var =~m/Set-Cookie: ([^;]+);[^;]+/){
$smf = $1;
$var =~s/Set-Cookie: $1//ig;
}
if($var =~m/Set-Cookie: ([^;]+)/){
$phpses = $1;
}
return $phpses . "; " . $smf;
}

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

@edkung : มันติดมาอ่ะ หะหะ ของพี่เล็ก windows98se เขืยนน่ะ แถมให้เลย