update-mirrors.pl
532901be
 #!/usr/bin/perl -w
 use warnings;
 use strict;
 use LWP::Simple;
 use LWP;
 use Date::Parse;
759dd463
 use Date::Format;
532901be
 
238e706b
 #
 # A quick hack by Jacob Appelbaum <jacob@appelbaum.net>
940ab031
 # LWP suggestions by Leigh Honeywell
238e706b
 # This is Free Software (GPLv3)
 # http://www.gnu.org/licenses/gpl-3.0.txt
 #
838938ca
 # CHANGELOG
 # 20091003 Code changes to elimiate the need for a trailing slash in addresses for script runtime
 # 20091004 Code changes to increase out of date tolerance to 48 hours
 # 20091028 Code changes to increase timout to 30 seconds (attempting to # resolve "unknown" status')
 # 20091028 Code changes to change user agent of script
 # 20100807 Remove dead mirrors.
238e706b
 
532901be
 print "Creating LWP agent ($LWP::VERSION)...\n";
 my $lua = LWP::UserAgent->new(
     keep_alive => 1,
55e27233
     timeout => 30,
69c4ddc9
     agent => "Tor MirrorCheck Agent"
532901be
 );
 
 sub sanitize {
     my $taintedData = shift;
     my $cleanedData;
     my $whitelist = '-a-zA-Z0-9: +';
 
     # clean the data, return cleaned data
     $taintedData =~ s/[^$whitelist]//go;
     $cleanedData = $taintedData;
 
     return $cleanedData;
 }
 
 sub FetchDate {
     my $url = shift; # Base url for mirror
3b0a6878
     my $trace = "project/trace/www-master.torproject.org"; # this file should always exist
532901be
     $url = "$url$trace";
 
     print "Fetching possible date from: $url\n";
 
     my $request = new HTTP::Request GET => "$url";
     my $result = $lua->request($request);
a86b52c5
     my $code = $result->code();
     print "Result code $code\n";
532901be
 
a86b52c5
     if ($result->is_success && $code eq "200"){
532901be
        my $taint = $result->content;
        my $content = sanitize($taint);
        if ($content) {
940ab031
 
532901be
             my $date = str2time($content);
 
             if ($date) {
                 print "We've fetched a date $date.\n";
                 return $date;
             } else {
                 print "We've haven't fetched a date.\n";
                 return "Unknown";
             }
 
         } else {
             print "Unable to fetch date, empty content returned.\n";
             return "Unknown";
         }
940ab031
 
532901be
     } else {
        print "Our request failed, we had no result.\n";
        return "Unknown";
     }
a86b52c5
 
     return "Unknown";
532901be
 }
 
 # This is the list of all known Tor mirrors
 # Add new mirrors to the bottom!
fafbb604
 my %m = (
 
76ebe69b
         
         mirror000 => {
             adminContact => "coralcdn.org",
             orgName => "CoralCDN",
             isoCC => "INT",
             subRegion => "",
             region => "INT",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Yes",
             httpWebsiteMirror => "http://www.torproject.org.nyud.net/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://www.torproject.org.nyud.net/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
         },
 
fe0b5ab8
         mirror001 => {
             adminContact => "BarkerJr AT barkerjr DOT net",
             orgName => "BarkerJr",
             isoCC => "FR",
             subRegion => "",
             region => "FR",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
a0226d94
             httpWebsiteMirror => "http://www.oignon.net/",
4a46cda9
             httpsWebsiteMirror => "https://www.oignon.net/",
fe0b5ab8
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
72c3928b
             httpDistMirror => "http://www.oignon.net/dist/",
4a46cda9
             httpsDistMirror => "https://www.oignon.net/dist/",
fe0b5ab8
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
         },
 
838938ca
        mirror003 => {
ab4b6992
             adminContact => "citizen428 AT gmail DOT com",
79e6ad8b
             orgName => "[[:bbs:]]",
532901be
             isoCC => "DE",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.blingblingsquad.net/",
e44f4a70
             httpsWebsiteMirror => "https://tor.blingblingsquad.net/",
532901be
             ftpWebsiteMirror => "",
             rsyncWebsiteMirror => "",
d9806a25
             httpDistMirror => "",
             httpsDistMirror => "",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
838938ca
 	    mirror006 => {
44a792e5
             adminContact => "BarkerJr AT barkerjr DOT net",
             orgName => "BarkerJr",
             isoCC => "US",
             subRegion => "",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
e2724479
             httpWebsiteMirror => "http://www.torproject.us/",
             httpsWebsiteMirror => "https://www.torproject.us/",
567072db
             rsyncWebsiteMirror => "rsync://rsync.torproject.us/tor",
44a792e5
             ftpWebsiteMirror => "",
e2724479
             httpDistMirror => "http://www.torproject.us/dist/",
             httpsDistMirror => "https://www.torproject.us/dist/",
567072db
             rsyncDistMirror => "rsync://rsync.torproject.us/tor/dist",
44a792e5
             hiddenServiceMirror => "",
             updateDate => "Unknown",
         },
 
838938ca
        mirror007 => {
ab4b6992
             adminContact => "info AT zentrum-der-gesundheit DOT de",
d6db243b
             orgName => "Zentrum der Gesundheit",
532901be
             isoCC => "DK",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
ef0bc85c
             httpWebsiteMirror => "http://tor.idnr.ws/",
532901be
             ftpWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
ef0bc85c
             httpDistMirror => "http://tor.idnr.ws/dist/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
838938ca
        mirror008 => {
ab4b6992
             adminContact => "root AT amorphis DOT eu",
d6db243b
             orgName => "Amorphis",
532901be
             isoCC => "NL",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.amorphis.eu/",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.amorphis.eu/dist/",
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
838938ca
        mirror009 => {
ab4b6992
             adminContact => "mirror AT bit DOT nl",
532901be
             orgName => "BIT BV",
             isoCC => "NL",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
8c5bd823
             httpWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "ftp://ftp.bit.nl/mirror/tor/",
8c5bd823
             httpDistMirror => "http://ftp.bit.nl/mirror/tor/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
838938ca
        mirror010 => {
ab4b6992
             adminContact => "webmaster AT ccc DOT de",
532901be
             orgName => "CCC",
             isoCC => "NL",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.ccc.de/",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.ccc.de/dist/",
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
838938ca
        mirror013 => {
ab4b6992
 	    adminContact => "hostmaster AT zombiewerks DOT com",
cfa2b38c
             orgName => "TheOnionRouter",
10839949
             isoCC => "IS",
             subRegion => "",
             region => "Iceland",
532901be
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
a57cbe31
             httpWebsiteMirror => "http://theonionrouter.com/",
             httpsWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
a57cbe31
             httpDistMirror => "http://theonionrouter.com/dist/",
             httpsDistMirror => "",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
a57cbe31
     mirror014 => {
         adminContact => "tormaster AT xpdm DOT us",
         orgName => "Xpdm",
         isoCC => "US",
         subRegion => "",
         region => "North America",
         ipv4 => "True",
         ipv6 => "False",
         loadBalanced => "Unknown",
         httpWebsiteMirror => "http://torproj.xpdm.us/",
         httpsWebsiteMirror => "https://torproj.xpdm.us/",
         rsyncWebsiteMirror => "",
         ftpWebsiteMirror => "",
         httpDistMirror => "http://torproj.xpdm.us/dist/",
         httpsDistMirror => "https://torproj.xpdm.us/dist/",
         rsyncDistMirror => "",
         hiddenServiceMirror => "http://h3prhz46uktgm4tt.onion/",
         updateDate => "Unknown",
         },
838938ca
         mirror016 => {
ab4b6992
             adminContact => "security AT hostoffice DOT hu",
87080eec
             orgName => "Unknown",
             isoCC => "HU",
             subRegion => "Hungary",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
f45ba876
             httpWebsiteMirror => "http://mirror.tor.hu/",
87080eec
             httpsWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
87080eec
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://mirror.tor.hu/dist/",
87080eec
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
940ab031
         },
6f73b9b1
 
838938ca
         mirror017 => {
ece98df7
             adminContact => "",
b2daa681
             orgName => "Technica-03",
518a040b
             isoCC => "UA",
ece98df7
             subRegion => "Ukraine",
             region => "Eastern Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://torua.reactor-xg.kiev.ua/",
             httpsWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
ece98df7
             ftpWebsiteMirror => "",
a0226d94
             httpDistMirror => "http://tordistua.reactor-xg.kiev.ua/",
ece98df7
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
940ab031
         },
6f73b9b1
 
838938ca
 	    mirror018 => {
940ab031
             adminContact => "",
             orgName => "chaos darmstadt",
             isoCC => "DE",
             subRegion => "Germany",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://mirrors.chaos-darmstadt.de/tor-mirror/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://mirrors.chaos-darmstadt.de/tor-mirror/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c7112e94
         },
6f73b9b1
 
838938ca
 	mirror019 => {
da69ab61
             adminContact => "webmaster AT askapache DOT com",
             orgName => "AskApache",
c7112e94
             isoCC => "US",
             subRegion => "California",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.askapache.com/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
da69ab61
             httpDistMirror => "http://tor.askapache.com/dist/",
c7112e94
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
838938ca
 	mirror020 => {
ddfe7fb7
             adminContact => " mail AT benjamin-meier DOT info ",
             orgName => "beme it",
6355d769
             isoCC => "DE",
54ef3364
             subRegion => "",
ddfe7fb7
             region => "DE",
54ef3364
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
ddfe7fb7
             httpWebsiteMirror => "http://tor.beme-it.de/",
2412008c
             httpsWebsiteMirror => "https://tor.beme-it.de/",
6355d769
             rsyncWebsiteMirror => "rsync://tor.beme-it.de/tor",
54ef3364
             ftpWebsiteMirror => "",
ddfe7fb7
             httpDistMirror => "http://tor.beme-it.de/dist/",
2412008c
             httpsDistMirror => "https://tor.beme-it.de/dist/",
6355d769
             rsyncDistMirror => "rsync://tor.beme-it.de/tor/dist",
54ef3364
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
838938ca
         mirror021 => {
56e53786
             adminContact => "",
65d4c20f
             orgName => "India Tor Fans",
56e53786
             isoCC => "IN",
             subRegion => "",
             region => "IN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
df83e179
             httpWebsiteMirror => "http://www.torproject.org.in/",
56e53786
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://www.torproject.org.in/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
         },
 
838938ca
         mirror024 => {
bf3c67eb
             adminContact => "",
65d4c20f
             orgName => "homosu",
b55e8536
             isoCC => "SE",
bf3c67eb
             subRegion => "",
b55e8536
             region => "SE",
bf3c67eb
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.homosu.net/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://tor.homosu.net/dist/",
bf3c67eb
             httpsDistMirror => "",
             rsyncDistMirror => "",
e2a7cfa7
             hiddenServiceMirror => "",
86771c7f
         },
e2a7cfa7
 
838938ca
         mirror025 => {
e2a7cfa7
             adminContact => "margus.random at mail.ee",
             orgName => "CyberSIDE",
65fa2bbd
             isoCC => "EE",
e2a7cfa7
             subRegion => "",
             region => "EE",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://cyberside.planet.ee/tor/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
dcf4e3fd
             httpDistMirror => "http://cyberside.net.ee/tor/",
e2a7cfa7
             httpsDistMirror => "",
             rsyncDistMirror => "",
962a1385
             hiddenServiceMirror => "",
9133d82f
         },
962a1385
 
08265341
         mirror028 => {
b5630580
             adminContact => "",
c95b68b3
             orgName => "NW Linux",
b5630580
             isoCC => "US",
             subRegion => "WA",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
3b0a6878
             httpWebsiteMirror => "http://torproject.nwlinux.us/",
b5630580
             httpsWebsiteMirror => "",
99e7e300
             rsyncWebsiteMirror => "rsync://nwlinux.us/tor-web",
b5630580
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://torproject.nwlinux.us/dist/",
b5630580
             httpsDistMirror => "",
99e7e300
             rsyncDistMirror => "rsync://nwlinux.us/tor-dist",
1042f856
             hiddenServiceMirror => "",
         },
8276ea18
         mirror029 => {
1042f856
             adminContact => "",
             orgName => "LazyTiger",
             isoCC => "FR",
             subRegion => "",
             region => "FR",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.taiga-san.net/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://tor.taiga-san.net/dist/",
1042f856
             httpsDistMirror => "",
             rsyncDistMirror => "",
b4cd62c2
             hiddenServiceMirror => "",
         },
8276ea18
         mirror030 => {
b4cd62c2
             adminContact => "",
             orgName => "searchprivate",
             isoCC => "US",
             subRegion => "TX",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
3b0a6878
             httpWebsiteMirror => "http://tor.searchprivate.com/",
b4cd62c2
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://tor.searchprivate.com/dist/",
b4cd62c2
             httpsDistMirror => "",
             rsyncDistMirror => "",
5afd7fcd
             hiddenServiceMirror => "",
         },
8276ea18
         mirror031 => {
5afd7fcd
             adminContact => "",
             orgName => "cyberarmy",
             isoCC => "AT",
             subRegion => "",
             region => "AT",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
3b0a6878
             httpWebsiteMirror => "http://tor.cyberarmy.at/",
5afd7fcd
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
0d07397a
             httpDistMirror => "",
5afd7fcd
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
         },
         mirror032 => {
             adminContact => "",
c26f8224
             orgName => "torproject.is",
5afd7fcd
             isoCC => "IS",
             subRegion => "",
             region => "IS",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
c26f8224
             httpWebsiteMirror => "http://torproject.is/",
5afd7fcd
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://torproject.is/dist/",
5afd7fcd
             httpsDistMirror => "",
             rsyncDistMirror => "",
9133d82f
             hiddenServiceMirror => "",
78a6df20
         },
         mirror033 => {
             adminContact => "",
             orgName => "torservers",
             isoCC => "DE",
             subRegion => "",
             region => "DE",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://www.torservers.net/mirrors/torproject.org/",
             httpsWebsiteMirror => "https://www.torservers.net/mirrors/torproject.org/",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://www.torservers.net/mirrors/torproject.org/dist/",
             httpsDistMirror => "https://www.torservers.net/mirrors/torproject.org/dist/",
78a6df20
             rsyncDistMirror => "",
             hiddenServiceMirror => "http://hbpvnydyyjbmhx6b.onion/mirrors/torproject.org/",
f7418f8c
         },
57ca6a7c
         mirror036 => {
             adminContact => "",
             orgName => "",
             isoCC => "NL",
             subRegion => "",
             region => "NL",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "",
3b0a6878
             httpsDistMirror => "https://www.coevoet.nl/tor/dist/",
57ca6a7c
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
5282718c
       },
da77fe78
         mirror037 => {
             adminContact => "",
c26f8224
             orgName => "crypto.is",
da77fe78
             isoCC => "IS",
             subRegion => "",
c26f8224
             region => "Iceland",
da77fe78
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
3b0a6878
             httpWebsiteMirror => "https://torproject.crypto.is/",
             httpsWebsiteMirror => "https://torproject.crypto.is/",
da77fe78
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "https://torproject.crypto.is/dist/",
             httpsDistMirror => "https://torproject.crypto.is/dist/",
35949ea1
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
       },
         mirror038 => {
             adminContact => "",
             orgName => "",
             isoCC => "LT",
             subRegion => "",
             region => "LT",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
3b0a6878
             httpWebsiteMirror => "http://tor.vesta.nu/",
35949ea1
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://tor.vesta.nu/dist/",
da77fe78
             httpsDistMirror => "",
             rsyncDistMirror => "",
d7f8d17a
             hiddenServiceMirror => "",
92b68711
       },
         mirror040 => {
             adminContact => "",
             orgName => "",
             isoCC => "DE",
             subRegion => "",
             region => "DE",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
3b0a6878
             httpWebsiteMirror => "http://tor.freie-re.de/",
92b68711
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://tor.freie-re.de/dist/",
92b68711
             httpsDistMirror => "",
             rsyncDistMirror => "",
358be1ed
             hiddenServiceMirror => "",
       },
         mirror041 => {
             adminContact => "",
1f462980
             orgName => "Host4site",
358be1ed
             isoCC => "IL",
             subRegion => "",
             region => "IL",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://mirror.host4site.co.il/torproject.org/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
3b0a6878
             httpDistMirror => "http://mirror.host4site.co.il/torproject.org/dist/",
358be1ed
             httpsDistMirror => "",
             rsyncDistMirror => "",
80ba63d5
             hiddenServiceMirror => "",
a5c36a47
       },
         mirror043 => {
             adminContact => "",
             orgName => "factor.cc",
109e2076
             isoCC => "DE",
a5c36a47
             subRegion => "",
109e2076
             region => "DE",
a5c36a47
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.factor.cc/",
3b0a6878
             httpsWebsiteMirror => "https://factor.cc/tor/",
a5c36a47
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.factor.cc/dist/",
109e2076
             httpsDistMirror => "https://factor.cc/tor/dist/",
a5c36a47
             rsyncDistMirror => "",
066fd852
             hiddenServiceMirror => "",
       },
         mirror044 => {
             adminContact => "",
57799df2
             orgName => "torproject.nl",
066fd852
             isoCC => "NL",
             subRegion => "",
             region => "NL",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://www.torproject.nl/",
             httpsWebsiteMirror => "https://www.torproject.nl/",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://www.torproject.nl/dist/",
             httpsDistMirror => "https://www.torproject.nl/dist/",
             rsyncDistMirror => "",
f56169bb
             hiddenServiceMirror => "",
       },
         mirror045 => {
             adminContact => "",
             orgName => "",
             isoCC => "TN",
             subRegion => "",
             region => "TN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.mirror.tn/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.mirror.tn/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
da77fe78
             hiddenServiceMirror => "",
df990e60
       },
b8618cd9
         mirror045 => {
df990e60
             adminContact => "",
             orgName => "",
b8618cd9
             isoCC => "TN",
df990e60
             subRegion => "",
b8618cd9
             region => "TN",
df990e60
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "",
b8618cd9
             httpsWebsiteMirror => "https://torproject.antagonism.org/",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "https://torproject.antagonism.org/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
b8de9898
             hiddenServiceMirror => "",
       },
         mirror046 => {
             adminContact => "",
             orgName => "",
             isoCC => "DE",
             subRegion => "",
             region => "DE",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://mirror.open-networx.org/torproject.org/",
             httpsWebsiteMirror => "https://mirror.open-networx.org/torproject.org/",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://mirror.open-networx.org/torproject.org/dist/",
             httpsDistMirror => "https://mirror.open-networx.org/torproject.org/dist/",
             rsyncDistMirror => "",
df990e60
             hiddenServiceMirror => "",
7454d51d
       },
         mirror048 => {
             adminContact => "",
             orgName => "",
             isoCC => "AT",
             subRegion => "",
             region => "AT",
             ipv4 => "True",
             ipv6 => "True",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.dont-know-me.at/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.dont-know-me.at/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
6f37444e
             hiddenServiceMirror => "",
         },
         mirror049 => {
             adminContact => "IceBear",
43b72c60
             orgName => "myRL.net",
6f37444e
             isoCC => "IS",
             subRegion => "",
             region => "IS",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.myrl.net/",
             httpsWebsiteMirror => "https://tor.myrl.net/",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.myrl.net/dist/",
             httpsDistMirror => "https://tor.myrl.net/dist/",
             rsyncDistMirror => "",
8a0e3858
             hiddenServiceMirror => "",
         },
         mirror050 => {
             adminContact => "",
ecb76586
             orgName => "borgmann.tv",
8a0e3858
             isoCC => "DE",
             subRegion => "",
             region => "DE",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.borgmann.tv/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.borgmann.tv/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
2242997b
             hiddenServiceMirror => "",
30b13f29
         },
         mirror051 => {
             adminContact => "",
             orgName => "torland",
acbd4748
             isoCC => "GB",
30b13f29
             subRegion => "",
acbd4748
             region => "GB",
30b13f29
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
d933529b
             httpWebsiteMirror => "http://mirror.torland.me/torproject.org/",
             httpsWebsiteMirror => "https://mirror.torland.me/torproject.org/",
30b13f29
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
d933529b
             httpDistMirror => "http://mirror.torland.me/torproject.org/dist/",
             httpsDistMirror => "https://mirror.torland.me/torproject.org/dist/",
30b13f29
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
         },
         mirror052 => {
             adminContact => "",
             orgName => "spline",
             isoCC => "DE",
             subRegion => "",
             region => "DE",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.spline.de/",
a081ea3e
             httpsWebsiteMirror => "https://tor.spline.inf.fu-berlin.de/",
30b13f29
             rsyncWebsiteMirror => "rsync://ftp.spline.de/tor",
             ftpWebsiteMirror => "ftp://ftp.spline.de/pub/tor",
             httpDistMirror => "http://tor.spline.de/dist/",
a081ea3e
             httpsDistMirror => "https://tor.spline.inf.fu-berlin.de/dist/",
30b13f29
             rsyncDistMirror => "rsync://ftp.spline.de/tor/dist",
             hiddenServiceMirror => "",
9620cfee
         },
         mirror053 => {
             adminContact => "",
             orgName => "",
             isoCC => "AT",
             subRegion => "",
             region => "AT",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://torproject.ph3x.at/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://torproject.ph3x.at/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
e5d33ddf
             hiddenServiceMirror => "",
         },
         mirror054 => {
             adminContact => "",
8aea804d
             orgName => "hessmo",
e5d33ddf
             isoCC => "US",
             subRegion => "",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://mirror.hessmo.com/tor/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
8aea804d
             httpDistMirror => "http://mirror.hessmo.com/tor/dist/",
e5d33ddf
             httpsDistMirror => "",
             rsyncDistMirror => "",
4471d2f9
             hiddenServiceMirror => "",
         },
         mirror055 => {
             adminContact => "",
             orgName => "",
             isoCC => "EU",
             subRegion => "",
             region => "EU",
             ipv4 => "True",
             ipv6 => "True",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.unregistered.eu/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.unregistered.eu/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
cf826d52
             hiddenServiceMirror => "",
         },
         mirror056 => {
             adminContact => "",
             orgName => "",
3be7370f
             isoCC => "IT",
cf826d52
             subRegion => "",
3be7370f
             region => "IT",
cf826d52
             ipv4 => "True",
             ipv6 => "True",
             loadBalanced => "No",
             httpWebsiteMirror => "http://torproject.jcsh.it/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://torproject.jcsh.it/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
6d89f509
             hiddenServiceMirror => "",
         },
         mirror057 => {
             adminContact => "",
             orgName => "",
             isoCC => "PT",
             subRegion => "",
             region => "PT",
             ipv4 => "True",
             ipv6 => "True",
             loadBalanced => "No",
             httpWebsiteMirror => "",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "https://5coluna.com/downloads/tor/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
9620cfee
             hiddenServiceMirror => "",
2242997b
         }
532901be
 );
 
 my $count = values %m;
 print "We have a total of $count mirrors\n";
 print "Fetching the last updated date for each mirror.\n";
 
3d7f7acd
 my $tortime;
3b0a6878
 $tortime = FetchDate("https://www.torproject.org/");
8c8f898f
 # Adjust offical Tor time by out-of-date offset: number of days * seconds per day 
fa36305b
 $tortime -= 1 * 172800; 
3d7f7acd
 print "The official time for Tor is $tortime. \n";
 
532901be
 foreach my $server ( keys %m ) {
 
     print "Attempting to fetch from $m{$server}{'orgName'}\n";
 
     if ($m{$server}{'httpWebsiteMirror'}) {
         print "Attempt to fetch via HTTP.\n";
         $m{$server}{"updateDate"} = FetchDate("$m{$server}{'httpWebsiteMirror'}");
     } elsif ($m{$server}{'httpsWebsiteMirror'}) {
         print "Attempt to fetch via HTTPS.\n";
         $m{$server}{"updateDate"} = FetchDate("$m{$server}{'httpsWebsiteMirror'}");
     } elsif ($m{$server}{'ftpWebsiteMirror'}) {
         print "Attempt to fetch via FTP.\n";
         $m{$server}{"updateDate"} = FetchDate("$m{$server}{'ftpWebsiteMirror'}");
     } else {
         print "We were unable to fetch or store anything. We still have the following: $m{$server}{'updateDate'}\n";
     }
 
     print "We fetched and stored the following: $m{$server}{'updateDate'}\n";
 
  }
 
 
 print "We sorted the following mirrors by their date of last update: \n";
 foreach my $server ( sort { $m{$b}{'updateDate'} <=> $m{$a}{'updateDate'}} keys %m ) {
 
      print "\n";
      print "Mirror $m{$server}{'orgName'}: \n";
 
      foreach my $attrib ( sort keys %{$m{$server}} ) {
         print "$attrib = $m{$server}{$attrib}";
         print "\n";
      };
 }
 
 my $outFile = "include/mirrors-table.wmi";
 my $html;
 open(OUT, "> $outFile") or die "Can't open $outFile: $!";
 
940ab031
 # Here's where we open a file and print some wml include goodness
532901be
 # This is storted from last known recent update to unknown update times
 foreach my $server ( sort { $m{$b}{'updateDate'} <=> $m{$a}{'updateDate'}} keys %m ) {
 
bf099ff9
      my $time;
b57d3dbe
      if ( "$m{$server}{'updateDate'}" ne "Unknown") {
8c8f898f
 	  if ( $m{$server}{'updateDate'} > $tortime ) {
eafdc12d
 	    $time = "Up to date";
 	  } else { $time = "Out of date"; }
33d46751
      } else { $time = "Unknown"; }
759dd463
 print OUT <<"END";
      \n<tr>\n
          <td>$m{$server}{'isoCC'}</td>\n
          <td>$m{$server}{'orgName'}</td>\n
          <td>$time</td>\n
 END
 
      my %prettyNames = (
                         httpWebsiteMirror => "http",
                         httpsWebsiteMirror => "https",
                         ftpWebsiteMirror => "ftp",
                         rsyncWebsiteMirror => "rsync",
                         httpDistMirror => "http",
                         httpsDistMirror => "https",
                         rsyncDistMirrors => "rsync", );
 
      foreach my $precious ( sort keys %prettyNames )
532901be
      {
         if ($m{$server}{"$precious"}) {
             print OUT "    <td><a href=\"" . $m{$server}{$precious} . "\">" .
759dd463
                       "$prettyNames{$precious}</a></td>\n";
532901be
         } else { print OUT "    <td> - </td>\n"; }
      }
 
      print OUT "</tr>\n";
 }
 
 close(OUT);