Thread code test
(1 answers)
Opened by mixxer at 2017-05-17 22:11 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 #!/usr/bin/perl 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, $ip, $i, $j ); sub delay { select( undef, undef, undef, shift ); } print "\nDNS-SERVERLISTE ONLINE AKTUALISIEREN...\n"; system( "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( "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( "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( "rm -f $tmp_file" ); open ( $handle, "<", $dns_list_file ); @$list = <$handle>; close ( $handle ); chomp ( @$list ); @$list = grep( /.*\..*/, @$list ); # doppelte IP's kicken %$hash = map { $_, [] } @$list; @$list = keys( %$hash ); ####### # QUICKTEST FOR ALL SERVERS ########################### $i = $#$list + 1; print "QUICKTEST BEI $i DNS-SERVERN DURCHFÜHREN...\n"; system ( "rm -f $quick_test_file" ); $j = 1; for $ip ( @$list ){ print "Teste DNS-Server $j von $i: $ip\n"; system( "./dig-it.pl $ip www.google.com --quick >> $quick_test_file &" ); $j++; last if $j>30; delay( $test_clock ); } do { delay( $test_clock * 2 ); my $ps = qx[ps ax | grep dig-it.pl | grep -v grep]; $list = [ split( /\n/, $ps ) ]; $i = $#$list + 1; print "Warte auf $i DNS-Server...\n"; } while ( $i ); |