发信人: demonalex(啊神)
整理人: workingnow(2004-02-28 13:16:54), 站内信件
|
#!usr/bin/perl
use LWP;
use Socket;
example();
$remote_ip=$ARGV[0];
$remote_port=$ARGV[1] || 80;
$pack_host=inet_aton($remote_ip);
$pack_all=sockaddr_in($remote_port,$pack_host);
socket(SOCK,AF_INET,SOCK_STREAM,6) || die "Can't build the Socket!\n";
$result1=connect(SOCK,$pack_all);
if(defined $result1){
print("The $remote_ip:$remote_port is Opened!\n");
close SOCK;
}else{
print("The $remote_ip:$remote_port is Closed!\n");
close SOCK;
exit 1;
}
#
print("Now is scanning the cgi string in uri.txt...\n\n");
#
$host=qq(http://$remote_ip:$remote_port);
$agent=LWP::UserAgent->new();
$agent->timeout(10);
#
$uri_input_file="uri.txt";
$log_output_file="cgi.log";
#
open(CONVERT,"<$uri_input_file") || die "Can't open the $uri_input_file(uri string file)...\n";
open(LOG,">>$log_output_file");
do{
$cgi_string=<CONVERT>;
chop($cgi_string);
$string=qq($host$cgi_string);
$request=HTTP::Request->new(GET=>$string);
$response=$agent->request($request);
if($response->is_success){
print("The $string is existent!\n");
print LOG ("The $string is existent!\n");
}
}while(defined $cgi_string);
close LOG;
close CONVERT;
print("\nAll cgi string is scaned in http://$remote_ip:$remote_port,please look up the $log_output_file:)\n");
exit 1;
#########################################################
sub example{
print("**************************\n");
print("* CopyRight By DemonAlex *\n");
print("**************************\n");
print("email:[email protected]\n");
print("Example: scan_cgi.exe ip [port]\n");
print("\n");
return;
}
#########################################################
---- You may say I am a dreamer
But I am not the only one
I hope someday you will join us
And the world will be as one.
http://demonalex.dark2s.org |
|