Update get domain name

This commit is contained in:
RyanHiggins 2023-12-01 23:56:54 +01:00 committed by GitHub
parent 6c090ab928
commit 9d3ea8e90d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,8 +135,10 @@ def main():
def get_domain_from_fqdn(fqdn):
regex = r"(?:(?:\w|-)+\.)+(\w+\.\w+)$"
return re.search(regex, fqdn, re.IGNORECASE).group(1)
# Place the hyphen at the start of the character class to avoid misinterpretation
regex = r"(?:(?:[\w-]+)\.)+([\w-]+\.\w+)$"
match = re.search(regex, fqdn, re.IGNORECASE)
return match.group(1) if match else None
def get_ipv4_address():