Perl WebMode(目录扫描/同IP域名扫描)
先说好,这玩意没有完工。目前只是做个整合。目前对其的要求是:
根据目标的域名,对网站爬虫,以及同IP域名分析,还有就是目录的扫描,系统的检测。
还有就是指纹识别。漏洞扫描等等。
目前该WebMode只是一部分,还在研究当中。还需要修改,只是把大致的框框弄出来。。
package WebMode; use HTTP::Request; use LWP::UserAgent; use Getopt::Long; use threads; use Thread::Semaphore; use Socket; use HTTP::Response; use HTTP::Request::Common; sub Waring_pr{ local($number)=shift; if($number==1) { print "---------------------------------------------------------------------\n"; print "perl WebMode.pl -Url http://www.baidu.com --Thread 10 -List loal.list\n"; print "---------------------------------------------------------------------\n"; exit(0); } else { print "---------------------------------------------------------------\n"; print "perl PostWeb.pl -url xxx.com -option POST/GET --output filename\n"; print "---------------------------------------------------------------\n"; exit(0); } } sub Grep_task{ local($url_other)=shift; @other_list=split(/<li>/,$url_other); foreach my $url(@other_list) { if($url=~m#href='(.*)'#) { push(@url,$1); } } @report_other_url=Report_Mode("@url"); if($report eq undef) { open FILE,">$task_name.html"; } else { open FILE,">$report.html"; } print FILE "@report_other_url"; close(FILE); } sub Report_Mode{ local($temp_url)=shift; @temp_url=split(/\s+/,$temp_url); push(@report_html,"<html>"); push(@report_html,"<head><title>Report</title></head>"); push(@report_html,"<body>"); foreach my $task_url (@temp_url) { print "----------------\n"; print "Url:$task_url\n"; print "----------------\n"; $task="<a href=\"$task_url\">$task_url</a><br />"; push(@report_url,$task); } push(@report_html,"@report_url"); push(@report_html,"</body>"); push(@report_html,"</html>"); return @report_html; } sub Check_null{ local($check_task)=shift; if($check_task =~m#\d#) { if($check_task <10) { $check_task=10; return $check_task; } else { return $check_task; } } else { if($check_task eq undef) { return Waring_pr(); } else { return $check_task; } } } sub Thread{ ($threads_max,$list_file,$weburl)=@_; Check_null($threads_max); Check_null($list_file); Check_null($weburl); my $signal_max=Thread::Semaphore->new($threads_max); open(FILE,$list_file); foreach(<FILE>) { if(${$signal_max}<=0) { for my $t(threads->list(threads::joinable)) { $t->join(); $signal_max->up(); } redo; } $signal_max->down(); chomp; $scan_task="$weburl/$_"; threads->create(\&Webscan,$scan_task); } for my $t(threads->list()) { $t->join(); } close(FILE); } sub Webscan{ local($scan_task)=shift; if($scan_task !~/^http/) { $scan_task="http://$scan_url"; } my $request=HTTP::Request->new(GET=>$scan_task); my $uat=LWP::UserAgent->new(); $uat->timeout(3); my $reponse=>$uat->request($request); if($response->status_line=~/200/) { print "[*] $scan_url=========[200][*]\n"; } elsif($response->status_line=~/403/) { print "[*] $scan_url=========[403][*]\n"; } } sub Post_send{ local($task_url)=shift; $agent=new LWP::UserAgent; $request=POST('http://tool.chinaz.com/Same/',[s=>$task_url]); $request->header('User-Agent'=>'Mozilla/5.0 (X11; Linux x86_64; rv:18.0)'); $request->header('Accept-Encoding'=>'zh-cn,en-us;q=0.7,en;q=0.3'); $response=$agent->request($request); if($response->is_success) { $url_tmp=$response->content; if($url_tmp=~m#<ul><li><span>(.*)</li></ul>#) { Grep_task($1); } } else { print "Error!!\n"; } } sub Get_send{ local($task_url)=shift; $agent=new LWP::UserAgent; $request=GET('http://www.baidu.com/'); $request->header('User-Agent'=>'Mozilla/5.0 (X11; Linux x86_64; rv:18.0)'); $request->header('Accept-Encoding'=>'zh-cn,en-us;q=0.7,en;q=0.3'); $response=$agent->request($request); if($response->is_success) { print "ok!\n"; } else { print "No\n"; } } 1;