If a domain is not found and consists of more than two parts, try it by stripping...
authorArt Cancro <ajc@citadel.org>
Fri, 28 Jul 2023 03:38:22 +0000 (23:38 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 28 Jul 2023 03:38:22 +0000 (23:38 -0400)
infanticide.pm

index 3ad11d8e2f0cd4bfd3de3d5fd057f35679eda098..56072fde628fc51af262e9d621a0bd1319ecf080 100755 (executable)
@@ -53,6 +53,17 @@ sub infanticide_get_creation_date {
                        # 2017-06-02T13:15:42Z
                }
        }
+       if ($cDate eq "") {
+               syslog('debug', "infanticide: no creation date for " . $domain_to_test);
+
+               # If the FQDN is made up of more than two components (for example, mail.spammers.com)
+               # try stripping components until it's down to two
+               $dots = ($domain_to_test =~ tr/.//);
+               if ($dots > 1) {
+                       return(infanticide_get_creation_date(substr $domain_to_test, index($domain_to_test, ".")+1));
+               }
+
+       }
        return($cDate);
 }
 
@@ -66,7 +77,6 @@ sub check_for_disposable_domain() {
        my $domain = $fromarr[1];
        my $creationDate = infanticide_get_creation_date($domain);
        if ($creationDate eq "") {
-               syslog('debug', "infanticide: no creation date for " . $domain);
                return(0);
        }
        my $dt = str2time($creationDate);