Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __get_top_level_domain__(self):
try:
if is_ip(self.domain) or not self.domain or self.domain == '':
return None
d = get_tld('http://www.'+self.domain)
if d.find('www.') >= 0:
return d.split('www.')[1]
else:
return d
except:
return None
def __get_top_level_domain__(self):
try:
if is_ip(self.domain) or not self.domain or self.domain == '':
return None
d = get_tld('http://www.'+self.domain)
if d.find('www.') >= 0:
return d.split('www.')[1]
else:
return d
except:
return None
import sys
from passivetotal.libs.dns import DnsRequest
from passivetotal.libs.dns import DnsUniqueResponse
from passivetotal.libs.whois import WhoisRequest
from passivetotal.libs.whois import WhoisResponse
from passivetotal.common.utilities import is_ip
query = sys.argv[1]
if not is_ip(query):
raise Exception("This script only accepts valid IP addresses!")
sys.exit(1)
# look up the unique resolutions
client = DnsRequest.from_config()
raw_results = client.get_unique_resolutions(query=query)
loaded = DnsUniqueResponse(raw_results)
whois_client = WhoisRequest.from_config()
for record in loaded.get_records()[:3]:
raw_whois = whois_client.get_whois_details(query=record.resolve)
whois = WhoisResponse(raw_whois)
print(record.resolve, whois.contactEmail)