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
 #
670c4116
 #Contacted
6ef3b045
 #Kamagurka TIMOUTS (Should be up in about a week)
670c4116
 #
238e706b
 
532901be
 print "Creating LWP agent ($LWP::VERSION)...\n";
 my $lua = LWP::UserAgent->new(
     keep_alive => 1,
b57d3dbe
     timeout => 15,
532901be
     agent => "Tor MirrorCheck Agent"
 );
 
 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
     my $trace = "project/trace/www.torproject.org"; # Location of recent update info
     $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 = (
         mirror000 => {
             adminContact => "tor AT goodeid DOT com",
             orgName => "goodeid.com",
5ed1054b
             isoCC => "CA",
fafbb604
             subRegion => "",
644dacb7
             region => "North America",
fafbb604
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor-node.goodeid.com/",
             httpsWebsiteMirror => "https://tor-node.goodeid.com/",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor-node.goodeid.com/dist/",
             httpsDistMirror => "https://tor-node.goodeid.com/dist/",
             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",
             httpWebsiteMirror => "",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
72c3928b
             httpDistMirror => "http://www.oignon.net/dist/",
f4378f13
             httpsDistMirror => "https://oignon.net/dist/",
fe0b5ab8
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
         },
 
532901be
        mirror002 => {
ab4b6992
             adminContact => "operator AT hermetix DOT org",
d6db243b
             orgName => "Hermetix",
532901be
             isoCC => "CA",
             subRegion => "QC",
             region => "North America",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.hermetix.org/",
             rsyncWebsiteMirror => "",
aa2f3edf
             httpDistMirror => "",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
        mirror003 => {
940ab031
             adminContact => "",
d6db243b
             orgName => "Boinc",
532901be
             isoCC => "CH",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.boinc.ch/",
             ftpWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             httpDistMirror => "http://tor.boinc.ch/dist/",
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
        mirror004 => {
ab4b6992
             adminContact => "peihanru AT gmail DOT com",
d6db243b
             orgName => "Anonymity",
532901be
             isoCC => "CN",
             subRegion => "",
             region => "Asia",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
97d7533a
             httpWebsiteMirror => "http://tor.cypherpunks.cn/",
532901be
             ftpWebsiteMirror => "",
             rsyncWebsiteMirror => "",
97d7533a
             httpDistMirror => "http://tor.cypherpunks.cn/dist/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
d7011be8
        mirror005 => {
ab4b6992
             adminContact => "citizen428 AT gmail DOT com",
d6db243b
             orgName => "Bbs",
532901be
             isoCC => "DE",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.blingblingsquad.net/",
             ftpWebsiteMirror => "",
             rsyncWebsiteMirror => "",
99420d9a
             httpDistMirror => "",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
6f73b9b1
        mirror006 => {
d6f80b85
             orgName => "Berapla",
             isoCC => "DE",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://download.berapla.de/mirrors/tor/",
             ftpWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             httpDistMirror => "http://download.berapla.de/mirrors/tor/dist/",
             rsyncDistMirror => "",
             updateDate => "Unknown",
         },
532901be
 
6f73b9b1
        mirror007 => {
ab4b6992
             adminContact => "cm AT cybermirror DOT org",
d6db243b
             orgName => "Cybermirror",
532901be
             isoCC => "DE",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.cybermirror.org/",
             ftpWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             httpDistMirror => "http://tor.cybermirror.org/dist/",
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
6f73b9b1
        mirror008 => {
ab4b6992
             adminContact => "contact AT algorithmus DOT com",
532901be
             orgName => "Spline",
             isoCC => "DE",
             subRegion => "FU",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
8c5bd823
             httpWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
             rsyncWebsiteMirror => "",
8c5bd823
             httpDistMirror => "http://rem.spline.de/tor/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
        mirror009 => {
ab4b6992
             adminContact => "beaver AT trash DOT net",
d6db243b
             orgName => "Onionland",
532901be
             isoCC => "DE",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://mirror.onionland.org/",
             ftpWebsiteMirror => "",
             rsyncWebsiteMirror => "rsync: mirror.onionland.org::tor/",
             httpDistMirror => "http://mirror.onionland.org/dist/",
70407d20
             rsyncDistMirror => "rsync://mirror.onionland.org::tor/dist/",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
d6f80b85
        mirror011 => {
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",
940ab031
             httpWebsiteMirror => "http://tor.zdg-gmbh.eu/",
532901be
             ftpWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
532901be
             httpDistMirror => "http://tor.zdg-gmbh.eu/dist/",
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
d6f80b85
        mirror012 => {
ab4b6992
             adminContact => "kurt AT miroir-francais DOT fr",
532901be
             orgName => "CRAN",
             isoCC => "FR",
d6db243b
             subRegion => "Ile de France",
532901be
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
aa2f3edf
             httpWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "rsync://miroir-francais.fr::tor",
532901be
             ftpWebsiteMirror => "ftp://miroir-francais.fr/pub/tor/",
aa2f3edf
             httpDistMirror => "http://tor.miroir-francais.fr/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
d6f80b85
        mirror013 => {
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
         },
 
d6f80b85
        mirror014 => {
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
         },
 
d6f80b85
        mirror015 => {
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
         },
 
d6f80b85
        mirror016 => {
ab4b6992
             adminContact => "root AT kamagurka DOT org",
d6db243b
             orgName => "Kamagurka",
532901be
             isoCC => "NL",
             subRegion => "Haarlem",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.kamagurka.org/",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.kamagurka.org/dist/",
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
d6f80b85
        mirror017 => {
ab4b6992
             adminContact => "mirrorsosmirror.nl",
532901be
             orgName => "OS Mirror",
             isoCC => "NL",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
aa2f3edf
             httpWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "rsync://rsync.osmirror.nl::tor/",
532901be
             ftpWebsiteMirror => "ftp://ftp.osmirror.nl/pub/tor/",
aa2f3edf
             httpDistMirror => "http://tor.osmirror.nl/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
 
d6f80b85
        mirror018 => {
ab4b6992
             adminContact => "evert AT meulie DOT net",
d6db243b
             orgName => "Meulie",
532901be
             isoCC => "NO",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
8c5bd823
             httpWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
8c5bd823
             httpDistMirror => "http://tor.meulie.net/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
d6f80b85
        mirror019 => {
ab4b6992
             adminContact => "ghirai AT ghirai DOT com",
d6db243b
             orgName => "Ghirai",
532901be
             isoCC => "UK",
             subRegion => "London",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
8c5bd823
             httpWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
8c5bd823
             httpDistMirror => "http://www.ghirai.com/tor/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
ee2fdcd1
 	mirror020 => {
             adminContact => "",
             orgName => "ax",
             isoCC => "DE",
             subRegion => "",
             region => "DE",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.initrd.net/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
         },
 
d6f80b85
        mirror021 => {
ab4b6992
 	    adminContact => "hostmaster AT zombiewerks DOT com",
cfa2b38c
             orgName => "TheOnionRouter",
532901be
             isoCC => "US",
ece98df7
             subRegion => "New Jersey",
532901be
             region => "North America",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://www.theonionrouter.com/",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
             httpDistMirror => "http://www.theonionrouter.com/dist/",
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
d6f80b85
        mirror022 => {
ab4b6992
             adminContact => "jeroen AT unfix DOT org",
cfa2b38c
             orgName => "Unfix",
532901be
             isoCC => "CH",
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "True",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.unfix.org/",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
aa2f3edf
             httpDistMirror => "http://tor.unfix.org/dist/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
 
d6f80b85
        mirror023 => {
ab4b6992
             adminContact => "jeroen AT unfix DOT org",
cfa2b38c
             orgName => "Sixx",
759dd463
             isoCC => "CH",
532901be
             subRegion => "",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "True",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://tor.sixxs.net/",
940ab031
             rsyncWebsiteMirror => "",
532901be
             ftpWebsiteMirror => "",
aa2f3edf
             httpDistMirror => "http://tor.sixxs.net/dist/",
532901be
             rsyncDistMirror => "",
a86b52c5
             updateDate => "Unknown",
532901be
         },
2599041d
 
932f4ff1
 	mirror024 => {
             adminContact => "scream AT nonvocalscream DOT com",
             orgName => "NVS",
             isoCC => "US",
             subRegion => "",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.nonvocalscream.com/",
             httpsWebsiteMirror => "https://tor.nonvocalscream.com/",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.nonvocalscream.com/dist/",
             httpsDistMirror => "https://tor.nonvocalscream.com/dist/",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
         },
 
d6f80b85
        mirror025 => {
ab4b6992
             adminContact => "web2005a AT year2005a.wiretapped DOT net",
aa2f3edf
             orgName => "Wiretapped",
             isoCC => "AU",
             subRegion => "Sydney",
             region => "Oceania",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
aa2f3edf
             ftpWebsiteMirror => "ftp://ftp.mirrors.wiretapped.net/pub/security/cryptography/network/tor/",
             httpDistMirror => "http://www.mirrors.wiretapped.net/security/cryptography/network/tor/",
             rsyncDistMirror => "",
             updateDate => "Unknown",
940ab031
         },
2599041d
 
d6f80b85
         mirror026 => {
fc3928ac
             adminContact => "tormaster AT xpdm DOT us",
cfa2b38c
             orgName => "Xpdm",
4c0fefd4
             isoCC => "US",
             subRegion => "",
             region => "North America",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "Unknown",
             httpWebsiteMirror => "http://torproj.xpdm.us/",
7237e767
             httpsWebsiteMirror => "https://torproj.xpdm.us/",
940ab031
             rsyncWebsiteMirror => "",
4c0fefd4
             ftpWebsiteMirror => "",
7237e767
             httpDistMirror => "http://torproj.xpdm.us/dist/",
             httpsDistMirror => "https://torproj.xpdm.us/dist/",
4c0fefd4
             rsyncDistMirror => "",
             hiddenServiceMirror => "http://h3prhz46uktgm4tt.onion/",
             updateDate => "Unknown",
940ab031
         },
4c0fefd4
 
d6f80b85
         mirror027 => {
ab4b6992
             adminContact => "internetfreebeijing AT gmail DOT com",
68ef8ba8
             orgName => "Unknown",
             isoCC => "CN",
             subRegion => "China",
             region => "Asia",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://free.be.ijing2008.cn/tor/",
             httpsWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
68ef8ba8
             ftpWebsiteMirror => "",
             httpDistMirror => "http://free.be.ijing2008.cn/tor/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
940ab031
         },
68ef8ba8
 
d6f80b85
         mirror028 => {
ab4b6992
             adminContact => "security AT hostoffice DOT hu",
87080eec
             orgName => "Unknown",
             isoCC => "HU",
             subRegion => "Hungary",
             region => "Europe",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://mirror.tor.hu/",
             httpsWebsiteMirror => "",
940ab031
             rsyncWebsiteMirror => "",
87080eec
             ftpWebsiteMirror => "",
             httpDistMirror => "http://mirror.tor.hu/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
940ab031
         },
6f73b9b1
 
d6f80b85
         mirror029 => {
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 => "",
             httpDistMirror => "http://tordistua.reactor-xg.kiev.ua",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
940ab031
         },
6f73b9b1
 
d6f80b85
 	mirror030 => {
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
 
c7112e94
 	mirror031 => {
             adminContact => "",
             orgName => "Ask Apache",
             isoCC => "US",
             subRegion => "California",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.askapache.com/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
6f73b9b1
             httpDistMirror => "",
c7112e94
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
c7112e94
 	mirror032 => {
             adminContact => "",
             orgName => "I'm on the roof",
             isoCC => "US",
             subRegion => "",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://mirror.imontheroof.com/tor-mirror/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://mirror.imontheroof.com/tor-mirror/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
54ef3364
 	mirror033 => {
             adminContact => "",
81cd6114
             orgName => "bullog",
54ef3364
             isoCC => "CN",
             subRegion => "",
             region => "CN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.bullog.org/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.bullog.org/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
54ef3364
 	mirror034 => {
             adminContact => "",
81cd6114
             orgName => "digitip",
54ef3364
             isoCC => "CN",
             subRegion => "",
             region => "CN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.digitip.net/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.digitip.net/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
54ef3364
 	mirror035 => {
             adminContact => "",
81cd6114
             orgName => "shizhao",
54ef3364
             isoCC => "CN",
             subRegion => "",
             region => "CN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.shizhao.org/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.shizhao.org/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
54ef3364
 	mirror036 => {
             adminContact => "",
81cd6114
             orgName => "ranyunfei",
54ef3364
             isoCC => "CN",
             subRegion => "",
             region => "CN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.ranyunfei.com/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.ranyunfei.com/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
54ef3364
 	mirror037 => {
             adminContact => "",
81cd6114
             orgName => "wuerkaixi",
54ef3364
             isoCC => "CN",
             subRegion => "",
             region => "CN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.wuerkaixi.com/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.wuerkaixi.com/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
54ef3364
 	mirror038 => {
             adminContact => "",
81cd6114
             orgName => "izaobao",
54ef3364
             isoCC => "CN",
             subRegion => "",
             region => "CN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.izaobao.com/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.izaobao.com/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
54ef3364
 	mirror039 => {
             adminContact => "",
81cd6114
             orgName => "anothr",
54ef3364
             isoCC => "CN",
             subRegion => "",
             region => "CN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.anothr.com/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.anothr.com/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
c819dd8d
         },
6f73b9b1
 
54ef3364
 	mirror040 => {
             adminContact => "",
81cd6114
             orgName => "zuola",
54ef3364
             isoCC => "CN",
             subRegion => "",
             region => "CN",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "http://tor.zuo.la/",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
             httpDistMirror => "http://tor.zuo.la/dist/",
             httpsDistMirror => "",
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
5fca6508
         },
 
 	mirror041 => {
             adminContact => "BarkerJr AT barkerjr DOT net",
             orgName => "BarkerJr",
             isoCC => "US",
             subRegion => "",
             region => "US",
             ipv4 => "True",
             ipv6 => "False",
             loadBalanced => "No",
             httpWebsiteMirror => "",
             httpsWebsiteMirror => "",
             rsyncWebsiteMirror => "",
             ftpWebsiteMirror => "",
11ff8aab
             httpDistMirror => "http://www.cebolla.us/dist/",
             httpsDistMirror => "https://www.cebolla.us/dist/",
5fca6508
             rsyncDistMirror => "",
             hiddenServiceMirror => "",
             updateDate => "Unknown",
932f4ff1
         }
fe0b5ab8
 
5fca6508
 
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;
 $tortime = FetchDate("http://www.torproject.org/");
 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") {
 	  if ( "$m{$server}{'updateDate'}" eq "$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);