#!/usr/bin/perl # # nshunter.pl # # Suche den schnellsten DNS-Server vor Ort # use strict; use warnings; my $tmp_file = './tmp.txt'; my $dns_list_file = './dns.txt'; my $quick_test_file = './quick.txt'; my $test_clock = 0.15; my ( $handle, $list, $hash, $ax, $i, $j ); sub delay { select( undef, undef, undef, shift ); } print "\nDNS-SERVERLISTE ONLINE AKTUALISIEREN...\n"; system( qq[wget -nv https://www.ungefiltert-surfen.de/nameserver/ch.txt -O $tmp_file] ); system( qq[cat $tmp_file > $dns_list_file] ); system( qq[echo >> $dns_list_file] ); system( qq[wget -nv https://www.ungefiltert-surfen.de/nameserver/de.txt -O $tmp_file] ); system( qq[cat $tmp_file >> $dns_list_file] ); system( qq[echo >> $dns_list_file] ); system( qq[wget -nv https://www.ungefiltert-surfen.de/nameserver/at.txt -O $tmp_file] ); system( qq[cat $tmp_file >> $dns_list_file] ); system( qq[echo >> $dns_list_file] ); system( qq[rm -f $tmp_file] ); open ( $ax, "<", $dns_list_file ); @$list = <$ax>; close ( $ax ); chomp ( @$list ); # IPv6 kicken @$list = grep( /.*\..*/, @$list ); # doppelte IP's kicken %$hash = map { $_, [] } @$list; @$list = keys( %$hash ); ####### # QUICKTEST FOR ALL SERVERS ########################### $i = $#$list + 1; $j = 1; print "QUICKTEST BEI $i DNS-SERVERN DURCHFÜHREN...\n"; system ( qq[rm -f $quick_test_file] ); for ( @$list ){ print "Teste DNS-Server $j von $i: $_\n"; system( qq[./nsquick.pl $_ www.google.com >> $quick_test_file &] ); $j++; last if $j>30; # test delay( $test_clock ); } do { delay( $test_clock * 2 ); my $ax = qx[ps ax | grep nsquick.pl | grep -v grep]; $list = [ split( /\n/, $ax ) ]; $i = $#$list + 1; print "Warte auf $i DNS-Server...\n"; } while ( $i );