Bienvenido a Tecnohackers

Tecnohackers » Programacion » Area de Programacion » Scripting. VBS, Batch, Bash, JavaSript.
 » 

[Perl Tk] Proxy Tester 0.5



Autor Tema: [Perl Tk] Proxy Tester 0.5  (Leído 1113 veces)

Desconectado Doddy

  • Veterano
  • ***
  • Mensajes: 249
  • Slow Mind
[Perl Tk] Proxy Tester 0.5
« en: Mayo 12, 2012, 08:55:33 pm »
Version Tk de un programa para buscar proxies de forma online.

Una imagen



El codigo

Código: You are not allowed to view links. Register or Login
#!usr/bin/perl
#Proxy Tester 0.5
#Version Tk
#Coded By Doddy H

use Cwd;
use Tk;
use Tk::FileSelect;
use Tk::Dialog;
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"
);

#if ($^O eq 'MSWin32') {
#use Win32::Console;
#Win32::Console::Free();
#}

my $color_texto = "green";
my $color_fondo = "black";

my $newd =
  MainWindow->new( -background => $color_fondo, -foreground => $color_texto );

$newd->title("Proxy Tester 0.5");
$newd->geometry("370x250+50+50");
$newd->resizable( 0, 0 );

$menula = $newd->Frame(
    -relief     => "sunken",
    -bd         => 1,
    -background => $color_fondo,
    -foreground => $color_texto
);
my $menulnowax = $menula->Menubutton(
    -text             => "Options",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
my $aboutnowax = $menula->Menubutton(
    -text             => "About",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
my $exitnowax = $menula->Menubutton(
    -text             => "Exit",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
$menula->pack( -side => "top", -fill => "x" );

$menulnowax->command(
    -label      => "Load Wordlist",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&loadword
);
$menulnowax->command(
    -label      => "Check Online",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&scan
);
$menulnowax->command(
    -label      => "Open Logs",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&openlogs
);

$aboutnowax->command(
    -label      => "About",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&aboutxa
);

$exitnowax->command(
    -label      => "Exit",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&exitnow
);

$newd->Label(
    -text       => "Proxy OK",
    -font       => "Impact",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -y => 40, -x => 75 );
my $proxy_buenos =
  $newd->Listbox( -background => $color_fondo, -foreground => $color_texto )
  ->place( -y => "80", -x => "40" );

$newd->Label(
    -text       => "Proxy Failed",
    -font       => "Impact",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -y => 40, -x => 220 );
my $proxy_malos =
  $newd->Listbox( -background => $color_fondo, -foreground => $color_texto )
  ->place( -y => "80", -x => "200" );

MainLoop;

sub openlogs {
    my $f = "proxy-founds.txt";
    if ( -f $f ) {
        system($f);
    }
    else {
        $newd->Dialog(
            -title            => "Error",
            -buttons          => ["OK"],
            -text             => "File Not Found",
            -background       => $color_fondo,
            -foreground       => $color_texto,
            -activebackground => $color_texto
        )->Show();
    }
}

sub loadword {

    my $newdax = MainWindow->new(
        -background => $color_fondo,
        -foreground => $color_texto
    );

    $newdax->title("Load Wordlist");
    $newdax->geometry("460x50+50+50");
    $newdax->resizable( 0, 0 );

    $newdax->Label(
        -text       => "File : ",
        -font       => "Impact1",
        -background => $color_fondo,
        -foreground => $color_texto
    )->place( -y => 10, -x => 10 );
    my $filex = $newdax->Entry(
        -width      => 40,
        -background => $color_fondo,
        -foreground => $color_texto
    )->place( -y => 13, -x => 50 );
    $newdax->Button(
        -text             => "Browse",
        -width            => 10,
        -command          => \&bro,
        -background       => $color_fondo,
        -foreground       => $color_texto,
        -activebackground => $color_texto
    )->place( -y => 13, -x => 300 );
    $newdax->Button(
        -text             => "Load",
        -width            => 10,
        -command          => \&pasouno,
        -background       => $color_fondo,
        -foreground       => $color_texto,
        -activebackground => $color_texto
    )->place( -y => 13, -x => 375 );

    sub bro {
        $newd->update;
        $browse = $newd->FileSelect( -directory => getcwd() );
        my $file = $browse->Show;
        $filex->configure( -text => $file );
    }

    sub pasouno {

        my $file = $filex->get;
        $newdax->destroy();

        if ( -f $file ) {

            open( FILE, $file );
            my @words = <FILE>;
            close FILE;

            chomp @words;

            my @proxies = repes(@words);

            $proxy_buenos->delete( 0.0, "end" );
            $proxy_malos->delete( 0.0, "end" );

            $newd->title("Proxy Tester 0.5 [+] Status : Testing ...");

            for my $pro (@proxies) {
                chomp $pro;
                $newd->update;
                if ( testnow($pro) ) {
                    $proxy_buenos->insert( "end", $pro );
                }
                else {
                    $proxy_malos->insert( "end", $pro );
                }

            }

        }
        else {
            $newd->Dialog(
                -title            => "Error",
                -buttons          => ["OK"],
                -text             => "File Not Found",
                -background       => $color_fondo,
                -foreground       => $color_texto,
                -activebackground => $color_texto
            )->Show();
        }
    }
    $newd->title("Proxy Tester 0.5");
}

sub scan {

    $proxy_buenos->delete( 0.0, "end" );
    $proxy_malos->delete( 0.0, "end" );

    $newd->title("Proxy Tester 0.5 [+] Status : Searching ...");

    my @uno = getproxys();
    my @dos = getxroxy();

    #my @tres = proxyip();
    #my @cuatro = proxylist();
    #my @cinco = proxies(); #big list

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

    $newd->update;
    $newd->title("Proxy Tester 0.5 [+] Status : Testing ...");

    my $cont = "0";
    for (@total) {
        $newd->update;
        if ( testnow($_) ) {
            $cont++;
            print "\a";    #BEEP
        }
    }
    $newd->title("Proxy Tester 0.5");
}

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/ ) {
        savefile( "proxy-founds.txt", $save );
        return true;
    }
}

sub getproxys {

    my @founds;
    my @volver;

    for my $num ( 1 .. 5 ) {
        $newd->update;
        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 ) {
        $newd->update;
        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 ) {
        $newd->update;
        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 aboutxa {

    $newd->Dialog(
        -title            => "About",
        -buttons          => ["OK"],
        -text             => "Coded By Doddy H",
        -background       => $color_fondo,
        -foreground       => $color_texto,
        -activebackground => $color_texto
    )->Show();

}

sub exitnow { exit 1; }

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

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

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

#The End ?
You are not allowed to view links. Register or Login

Tags:
Tags:

 


SMF 2.0.19 | SMF © 2016, Simple Machines
Paginas Afiliadas
Twitter - FaceBook - Daraxblog
Designed by Smf Personal