Un simple programa verificar que un proxy funciona bien
Imagen
(http://doddyhackman.webcindario.com/images/proxytester.jpg)
#!usr/bin/perl
#Proxy Tester (C) Doddy Hackman 2011
use Tk;
use Tk::FileSelect;
use LWP::UserAgent;
if ($^O eq 'MSWin32') {
use Win32::Console;
Win32::Console::Free();
}
my $nave = LWP::UserAgent->new;
$nave->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12");
$nave->timeout(5);
my $new = MainWindow->new();
$new->title("Proxy Tester v0.1 (C) Doddy Hackman 2011");
$new->geometry("390x330+50+50");
$new->resizable(0,0);
$new->Label(-text=>"File : ",-font=>"Impact1")->place(-y=>10,-x=>10);
my $filex = $new->Entry(-width=>40)->place(-y=>13,-x=>50);
$new->Button(-text=>"Browse",-width=>10,-command=>\&bro)->place(-y=>10,-x=>300);
$new->Label(-text=>"Proxy OK")->place(-y=>50,-x=>65);
my $proxy_buenos = $new->Listbox()->place(-y=>"80",-x=>"40");
$new->Label(-text=>"Proxy Failed")->place(-y=>50,-x=>230);
my $proxy_malos = $new->Listbox()->place(-y=>"80",-x=>"200");
$new->Button(-text=>"Scan",-width=>64,-command=>\&scan)->place(-y=>255);
$new->Button(-text=>"About",-width=>64,-command=>\&about)->place(-y=>277);
$new->Button(-text=>"Exit",-width=>64,-command=>\&ex)->place(-y=>299);
MainLoop;
sub bro {
$new->update;
$browse = $new->FileSelect(-directory => "/");
my $file = $browse->Show;
$filex->configure (-text =>$file);
}
sub scan {
$proxy_buenos->delete(0.0,"end");
$proxy_malos->delete(0.0,"end");
my $archivo = $filex->get;
open(FILE,$archivo);
my @lineasa = <FILE>;
close FILE;
chomp @lineasa;
my @lineas = repes(@lineasa);
chomp @lineas;
for my $pro(@lineas) {
chomp $pro;
print $pro."\n";
$new->update;
$nave->proxy("http",$pro);
my $test = $nave->get("http://127.0.0.1/"); #Mod
if ($test->is_success) {
$proxy_buenos->insert("end",$pro);
} else {
$proxy_malos->insert("end",$pro);
}
}
}
sub about {
my $venta = MainWindow->new();
$venta->geometry("300x180+20+20");
$venta->title("About");
$venta->resizable(0,0);
$venta->Label(-text=>"\nProxy Tester\n\n\nProgrammer : Doddy Hackman\n\nContact : lepuke[at]hotmail[com]\n\n")->pack();
$venta->Button(-text=>"Exit",-width=>20,-command => [$venta => 'destroy'])->pack()
}
sub ex { exit 1; }
sub repes {
foreach $test(@_) {
push @limpio,$test unless $repe{$test}++;
}
return @limpio;
}
# ¿ The End ?