Hallo,
zum Basteln swu.
Viele Grüße vom Buzzer
=Script für automatische Proxyconfiguration nach dem WPAD-Standard
Mozilla: Edit/Preferences/Advanced/Proxies
Automatic Proxy Configuration URL
http://localhost/wpad.cgi:
#!/usr/bin/perl
# Zufälligen Proxy-Server aus einer Liste suchen
# Liste steht unterhalb __END__
###########################################################################
use strict;
# entpuffern
$| = 1;
# Liste mit Proxies
my @raw = ();
foreach my $entry(<DATA>){
chomp $entry;
my ($host, $port) = split(/\s+/, $entry);
push @raw, "$host:$port";
}
# Liste mischen
shuffle(\@raw) if scalar @raw;
# einen gueltigen ziehen
my $proxy = shift @raw;
# das JavaScript ausgeben
print "Content-type: text/plain\n\n";
if($proxy){
print qq(
function FindProxyForURL(url, host) {
return "PROXY $proxy";
}
);
}
else{
print qq(
function FindProxyForURL(url, host) {
return "DIRECT";
}
);
}
exit;
###########################################################################
# fisher_yates_shuffle( \@array ) :
# generate a random permutation of @array in place
sub shuffle {
my $array = shift;
my $i;
for ($i = @$array; --$i; ) {
my $j = int rand ($i+1);
@$array[$i,$j] = @$array[$j,$i];
}
}
###########################################################################
# Angaben ohne Gewähr
# host port sonstige Angaben
__END__
59\.61.233.10 8080 high anonymity China 2007-06-06 Whois 2
66\.98.238.8 3128 transparent United States 2007-06-06 Whois 3
200\.171.124.197 3128 transparent Brazil 2007-06-06 Whois 3
69\.64.71.162 80 high anonymity United States 2007-06-06 Whois 2
80\.58.205.61 80 transparent Spain 2007-06-06 Whois 1