コード例 #1
0
 def __process_result_pt__(self): # passive total
     d = self.__get_top_level_domain__()
     try:
         if d:
             client = WhoisRequest.from_config()
             raw_results = client.get_whois_details(query=d)
             self.raw_whois = raw_results
         elif not d:
             print("PT, domain null " + str(d) + " " + str(self.id))
     except:
         print("PT rejects " + str(self.domain) + " ")
コード例 #2
0
 def __init__(self):
     try:
         self.clients = {
             'ssl': SslRequest.from_config(),
             'dns': DnsRequest.from_config(),
             'enrichment': EnrichmentRequest.from_config(),
             'whois': WhoisRequest.from_config(),
             'attribute': AttributeRequest.from_config(),
         }
     except Exception:
         self.clients = None
コード例 #3
0
def call_whois(args):
    """Abstract call to WHOIS-based queries."""
    client = WhoisRequest.from_config()
    pruned = prune_args(query=args.query,
                        compact_record=args.compact,
                        field=args.field)

    if not args.field:
        data = client.get_whois_details(**pruned)
    else:
        data = client.search_whois_by_field(**pruned)

    return data
コード例 #4
0
ファイル: client.py プロジェクト: Rafiot/python_api
def call_whois(args):
    """Abstract call to WHOIS-based queries."""
    client = WhoisRequest.from_config()
    pruned = prune_args(
        query=args.query,
        compact_record=args.compact,
        field=args.field
    )

    if not args.field:
        data = client.get_whois_details(**pruned)
    else:
        data = client.search_whois_by_field(**pruned)

    return data
コード例 #5
0
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