From 9007a7a37eb9329cb03d3b82c319efb066c7c368 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 27 Jul 2023 23:38:22 -0400 Subject: [PATCH] If a domain is not found and consists of more than two parts, try it by stripping parts one by one --- infanticide.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/infanticide.pm b/infanticide.pm index 3ad11d8..56072fd 100755 --- a/infanticide.pm +++ b/infanticide.pm @@ -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); -- 2.39.2