[Perl] Proxy Tester 0.5

Iniciado por BigBear, 12 Mayo 2012, 20:51 PM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Version mejorada de un programa para buscar proxies de forma online para despues verificar el estado de cada uno.

El codigo

Código (perl) [Seleccionar]

#!usr/bin/perl
#Proxy Tester 0.5
#Coded By Doddy H

use LWP::UserAgent;

my $nave = LWP::UserAgent->new();
$nave->timeout(5);
$nave->agent(
"Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
);

while (1) {
    head();
    print "\n[+] Option : ";
    chomp( my $op = <stdin> );

    if ( $op eq "1" ) {
        print "\n\n[+] File : ";
        chomp( my $file = <stdin> );
        if ( -f $file ) {
            print "\n[+] Opening file ...\n\n";
            open( FILE, $file );
            my @words = <FILE>;
            close FILE;
            my @proxies = repes(@words);
            print "[+] Proxies Found : " . int(@proxies) . "\n";
            print "\n[+] Testing ....\n\n";
            my $cont = "0";

            for (@proxies) {
                if ( testnow($_) ) {
                    $cont++;
                    print "\a";    #BEEP
                }
            }
            print "\n[+] Proxies Found : " . $cont . "\n";
            print "\n\n[+] Finished\n\n";
            <stdin>;
        }
        else {
            print "\n\n[-] File not found\n";
            copyright();
        }
    }

    if ( $op eq "2" ) {
        print "\n\n[+] Getting proxies ...\n\n";

        my @uno    = getproxys();
        my @dos    = getxroxy();
        my @tres   = proxyip();
        my @cuatro = proxylist();
        my @cinco  = proxies();     #big list

        my @total = ( @uno, @dos, @tres, @cuatro, @cinco );

        print "[+] Proxies Found : " . int(@total) . "\n";
        print "\n[+] Testing .....\n\n";

        my $cont = "0";
        for (@total) {
            if ( testnow($_) ) {
                $cont++;
                print "\a";         #BEEP
            }
        }

        print "\n[+] Proxies Found : " . $cont . "\n";
        print "\n\n[+] Finished\n\n";
        <stdin>;
    }

    if ( $op eq "3" ) {
        copyright();
    }

}
copyright();

sub testnow {

    my $ver = shift;

    my $pro;
    my $host;
    my $port;
    my $country;
    my $save;

    my $test_proxy = LWP::UserAgent->new();
    $test_proxy->timeout(5);
    $test_proxy->agent(
"Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
    );

    if ( $ver =~ /(.*):(.*)/ ) {
        ( $host, $port, $country ) = ( $1, $2, "Unknown" );
        $save = $host . ":" . $port;
    }

    if ( $ver =~ /(.*):(.*):(.*)/ ) {
        ( $host, $port, $country ) = ( $1, $2, $3 );
        $save = $host . ":" . $port . ":" . $country;
    }

    my $pro = $host . ":" . $port;

    $test_proxy->proxy( "http", "http://" . $pro );
    my $code = $test_proxy->get("http://www.whatismyip.com/")->content;

    if ( $code =~ /Your IP Address Is/ ) {
        print "[+] IP : $host\n";
        print "[+] Port : $port\n";
        print "[+] Country : $country\n\n";
        savefile( "proxy-founds.txt", $save );
        return true;
    }
}

sub getproxys {

    my @founds;
    my @volver;

    for my $num ( 1 .. 5 ) {
        my $code = toma(
"http://www.proxys.com.ar/index.php?act=list&port=&type=&country=&page=$num"
        );

        while ( $code =~
/<tr class="cells" onmouseover="this.className='cells2'" onmouseout="this.className='cells'">(.*?)<\/tr>/sig
          )
        {
            my $porcion = $1;
            chomp $porcion;

            if ( my @total = $porcion =~ m{<\s*td\s*>\s*(.*?)\s*</\s*td}mig ) {
                push( @founds, $total[1] . ":" . $total[2] . ":" . $total[4] );
            }
        }
    }

    my @volver = repes(@founds);
    return @volver;

}

sub getxroxy {

    my @founds_final;
    my @founds;

    for my $num ( 0 .. 26 ) {

        open( FILE, ">>proxy.txt" );

        my $code = toma(
"http://www.xroxy.com/proxylist.php?port=&type=&ssl=&country=&latency=1000&reliability=&sort=reliability&desc=true&pnum=$num"
        );

        while ( $code =~
            /proxy:name=XROXY proxy&host=(.*?)&port=(.*?)&notes=(.*?)&/sig )
        {
            my ( $ip, $port, $pais ) = ( $1, $2, $3 );
            $port =~ s/&isSocks=true//sig;
            $port =~ s/&socksversion=4a//sig;
            push( @founds, "$ip:$port:$pais" );
            print FILE "$ip:$port\n";
        }
    }

    my @founds_final = repes(@founds);
    return @founds_final;

}

sub proxies {

    my @founds_final;
    my @founds;

    for my $i ( 1 .. 10 ) {

        my $code =
          toma( "http://proxies.my-proxy.com/proxy-list-" . $i . ".html" );

        my @found = $code =~ m/(\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}:\d+)/g;

        for (@found) {
            push( @founds, "$_:Unknown" );
        }

    }

    my @founds_final = repes(@founds);
    return @founds_final;

}

sub proxyip {

    my @founds_final;
    my @founds;

    my $code = toma("http://proxy-ip-list.com/free-usa-proxy-ip.html");

    if ( $code =~ /<tbody class="table_body">(.*?)<\/table>/sig ) {
        my $codedos = $1;

        while ( $codedos =~
/<tr><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td><\/tr>/mig
          )
        {
            my ( $ip, $pais ) = ( $1, $5 );
            push( @founds, "$ip:$pais" );
        }
    }

    my @founds_final = repes(@founds);
    return @founds_final;

}

sub proxylist {

    my @founds_final;
    my @founds;

    my $code = toma("http://www.proxylist.net/");

    while ( $code =~
/<tr><td><a href="(.*?)">(.*?)<\/a><\/td><td><a href="(.*?)">(.*?)<\/a><\/td>/mig
      )
    {
        my ( $ip, $pais ) = ( $2, $4 );
        push( @founds, "$ip:$pais" );
    }

    my @founds_final = repes(@founds);
    return @founds_final;

}

sub head {
    print qq(


@@@@@                        @@@@@                       
@    @                         @               @         
@    @                         @               @         
@    @ @@  @@@  @  @ @  @      @     @@@   @@  @@  @@@  @@
@@@@@  @  @   @ @  @ @  @      @    @   @ @  @ @  @   @ @
@      @  @   @  @@  @  @      @    @@@@@  @   @  @@@@@ @
@      @  @   @  @@  @  @      @    @       @  @  @     @
@      @  @   @ @  @  @@       @    @   @ @  @ @  @   @ @
@      @   @@@  @  @  @        @     @@@   @@   @  @@@  @
                       @                                   
                     @@                                   


[++] Options

[+] 1 : Load wordlist
[+] 2 : Check Online
[+] 3 : Exit

);

}

sub copyright {
    print "\n\n(C) Doddy Hackman 2012\n\n";
    <stdin>;
    exit(1);
}

sub savefile {
    open( SAVE, ">>" . $_[0] );
    print SAVE $_[1] . "\n";
    close SAVE;
}

sub repes {
    my @limpio;
    foreach $test (@_) {
        push @limpio, $test unless $repe{$test}++;
    }
    return @limpio;
}

sub toma {
    return $nave->get( $_[0] )->content;
}

#The End ?