How to use the passivetotal.common.utilities.is_ip function in passivetotal

To help you get started, we’ve selected a few passivetotal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stratosphereips / whois-similarity-distance / whois_similarity_index / wsd_domains.py View on Github external
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
github stratosphereips / whois-similarity-distance / whois_similarity_distance / util / whois_obj.py View on Github external
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
github passivetotal / python_api / examples / top_whois_display.py View on Github external
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)