使用perl脚本

时间:2017-03-19 16:50:03

标签: perl proxy

我目前正在使用单个代理,但我想通过添加代理列表来改进我的脚本。我怎么能这样做?

#!/usr/bin/perl
use HTTP::Request;
use LWP::UserAgent;
use IO::Select;
use HTTP::Response;
use Term::ANSIColor;
use HTTP::Request::Common qw(POST);
use HTTP::Request::Common qw(GET);
use URI::URL;
use IO::Socket::INET;
use strict
use warnings
my $ua = LWP::UserAgent->new;
$ua->proxy( 'http', 'http://127.0.0.1:8088' );    # Single Proxy
$tmp="tmp";
    if (-e $tmp) 
    {
    }
    else
    {
        mkdir $tmp or die "Error creating directory: $tmp";
    }
$logo="             
";

print $logo;
print "\t";
print colored("[ CMS DETECTOR ]",'white on_blue'),"\n\n\n";
print colored ("Start At $datetime",'white on_red'),"\n\n";

open(tarrget,"<$ARGV[0]") or die "I need a list \n";
while(<tarrget>){
chomp($_);
$site = $_;
if($site !~ /http:\/\//) { $site = "http://$site/"; };
efrez();
}
sub efrez($site){
$ua->default_header( "Connection" => "keep-alive" );
$ua->agent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31");
$ua->timeout (10);

my $efreez = $ua->get("$site")->content;
if($efreez =~/wp-content\/themes\/|wp-content\/plugins\/|wordpress/) {
    print colored("[WORDPRESS] $site",'white on_magenta'),"\n\n\n";
open(save, '>>tmp/wordpress.txt');
    print save "$site\n";
    close(save);
}
elsif($efreez =~/<script type=\"text\/javascript\" src=\"\/media\/system\/js\/mootools.js\"><\/script>|Joomla!|Joomla|joomla/) {
    print colored("[JOOMLA] $site",'white on_magenta'),"\n\n\n";
open(save, '>>tmp/joomla.txt');
    print save "$site\n";   
    close(save);
    }

elsif($efreez =~/\/modules\/system\/system.menus.css|\/sites\/default\/files\/|<meta name=\"Generator\" content=\"Drupal 7/) {
    print colored("[DRUPAL] $site",'white on_magenta'),"\n\n\n";

open(save, '>>tmp/Drupal.txt'); 
    print save "$site\n";   
    close(save);
    }else{
    print "\n[UNKNOWN] $site\n";
}
}

我尝试使用 proxified ,但它没有用。

我需要使用250到300个不同的代理(脚本应该每30分钟更改一次代理)。我还需要一些特殊的过滤器来启用和禁用列表中的代理;像 灰名单

有没有机制来实现这些东西?

0 个答案:

没有答案