Created
March 19, 2018 20:03
-
-
Save atucom/1a3b5850c8a63ab74f3d72d8861d80c8 to your computer and use it in GitHub Desktop.
Chop off subdomains from an FQDN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
#pip3 install tldextract | |
#Hostnames listed one/line in supplied file | |
#@atucom | |
with open('ips.txt.ssl_and_dns.hostnames') as f: | |
hostnames = f.readlines() | |
for hostname in hostanmes: | |
domain = tldextract.extract(hostname) | |
print(domain.registered_domain) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment