check_tlsa
changeset 7 a2ce47570096
parent 6 10fc0d468fec
equal deleted inserted replaced
6:10fc0d468fec 7:a2ce47570096
   194 
   194 
   195 sub get_domains {
   195 sub get_domains {
   196     open(my $filehandle, '<', $domainlist);
   196     open(my $filehandle, '<', $domainlist);
   197 
   197 
   198     my $pattern = '^(?<domain>\S*\.[a-z]{2,4}?):{0,1}(?<port>[0-9]*$)';
   198     my $pattern = '^(?<domain>\S*\.[a-z]{2,4}?):{0,1}(?<port>[0-9]*$)';
   199     my %domain2check;
       
   200     while (<$filehandle>) {
   199     while (<$filehandle>) {
   201         if (/$pattern/ig) {
   200         if (/$pattern/ig) {
   202             $domain = $+{domain};
   201             $domain = $+{domain};
   203 
   202 
   204             if ("$+{port}" =~ /^\s*$/) { $port = '443'; }
   203             if ("$+{port}" =~ /^\s*$/) { $port = '443'; }
   205             else { $port   = $+{port}; }
   204             else { $port   = $+{port}; }
   206             $domain2check{$domain} = $port;
       
   207 
   205 
   208             check_tlsa($domain, $port);
   206             check_tlsa($domain, $port);
   209         }
   207         }
   210         else {
   208         else {
   211             die "$domainlist has wrong or malformed content\n";
   209             die "$domainlist has wrong or malformed content\n";