How to use dtapi - 6 common examples

To help you get started, we’ve selected a few dtapi 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 grcninja / Small_Tasks / dt_vt_ip_hunter.py View on Github external
def get_dt_domains(ip):
    d = ""
    try:
        dt_response = dtapi.dtapi.reverse_ip(ip)
        for domain in dtapi.dtapi.domainlist_reverseip(dt_response):
            d = d + domain + ";"
    except: d = "N/A"
    return d
github grcninja / Small_Tasks / ip_hunter_rdap_geoip.py View on Github external
for line in f:
        ip = line.strip(" \n\t\r abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+`-={}|[]\\:;<>\/,")
        if ip in seen: continue
        f2.write(ip+"\n")
        seen.add(ip)


#General re-useable objects
geoip = GeoDB(maxmind_db_path)
showme = ShodanNode()

#configure Domain Tools API access
dt_creds = get_creds("domain_tools")
dt_user = dt_creds.pop("user")
dt_apikey = dt_creds.pop("api_key")
dtapi.dtapi.configure(dt_user, dt_apikey, usessl=True)

work = file_len(process_file_name)
print(str(work)+" ips to process\n")

with open(process_file_name,"r") as fin, open(output_file_name,"w",newline='',encoding="ascii", errors="ignore") as csvfile:

    #set up CSV file
    fieldnames = ["ip_addr" ,
                  "whois_abuse_email",
                  "whois_handle" ,
                  "whois_asn" ,
                  "whois_asn_country_code" ,
                  "whois_network_cidr" ,
                  "whois_contact_address" ,
                  "whois_contact_emails" ,
                  "whois_contact_phone" ,
github grcninja / Small_Tasks / ip_hunter_rdap_geoip.py View on Github external
dom = tc_data.pop("domain_resolutions")#this key returns a list
        domstring = ""
        if len(dom) == 0:
            domstring = "None found"
        for x in range(len(dom)):
            entry = dom[x]
            domstring = domstring + entry
        tc_domain_resolutions = domstring
        
        tc_verdict = tc_data.pop("verdict_response_code")
        tc_data.clear()

        #Get Domain Tools Data
        dt_domains = ""
        try:
            response = dtapi.dtapi.reverse_ip(addr)
            for domain in dtapi.dtapi.domainlist_reverseip(response):
                dt_domains = dt_domains + domain + ";"
        except:
            dt_domains = "None found"


        #Get WhoIs Data
        try:
           
            obj = IPWhois(addr, timeout=20)
            results = obj.lookup_rdap()#default depth is 0, we only need top level values for the file

            whois_asn = (newline_clean(results['asn']))
            whois_asn_country_code = (newline_clean(results['asn_country_code']))
            whois_network_cidr = (newline_clean(results['network']['cidr']))
            tmp_links = (newline_clean(results['network']['links']))
github grcninja / Small_Tasks / dt_vt_ip_hunter.py View on Github external
import sys

def get_dt_domains(ip):
    d = ""
    try:
        dt_response = dtapi.dtapi.reverse_ip(ip)
        for domain in dtapi.dtapi.domainlist_reverseip(dt_response):
            d = d + domain + ";"
    except: d = "N/A"
    return d

dt_credfile = os.path.expanduser('~/api_creds/dtapi.txt')
with open(dt_credfile,'r') as dt_creds:
    dtuser = dt_creds.readline().strip()
    dtkey = dt_creds.readline().strip()
dtapi.dtapi.configure(dtuser, dtkey, usessl=True)

vt_credfile = os.path.expanduser('~/api_creds/vtapi.txt')
with open(vt_credfile,'r') as vt_creds:
    vtuser = vt_creds.readline().strip()
    vtkey = vt_creds.readline().strip()

dt = datetime.date.today()
input_file_name = os.path.normcase(str(input('Enter the full path to your file, include the file name and extension: ')))
output_path = os.getcwd()
output_name = ("IP_reverse_search_dtvt"+str(dt)+".csv")
output_file_name = os.path.join(output_path, output_name)

with open(input_file_name, "r") as fin, open(output_file_name,"w",newline='',encoding="ascii", errors="ignore") as csvfile:
    domains = ""
    hashes_undetected = ""
    hashes_detected = ""
github grcninja / Small_Tasks / dt_vt_ip_hunter.py View on Github external
def get_dt_domains(ip):
    d = ""
    try:
        dt_response = dtapi.dtapi.reverse_ip(ip)
        for domain in dtapi.dtapi.domainlist_reverseip(dt_response):
            d = d + domain + ";"
    except: d = "N/A"
    return d
github grcninja / Small_Tasks / ip_hunter_rdap_geoip.py View on Github external
domstring = ""
        if len(dom) == 0:
            domstring = "None found"
        for x in range(len(dom)):
            entry = dom[x]
            domstring = domstring + entry
        tc_domain_resolutions = domstring
        
        tc_verdict = tc_data.pop("verdict_response_code")
        tc_data.clear()

        #Get Domain Tools Data
        dt_domains = ""
        try:
            response = dtapi.dtapi.reverse_ip(addr)
            for domain in dtapi.dtapi.domainlist_reverseip(response):
                dt_domains = dt_domains + domain + ";"
        except:
            dt_domains = "None found"


        #Get WhoIs Data
        try:
           
            obj = IPWhois(addr, timeout=20)
            results = obj.lookup_rdap()#default depth is 0, we only need top level values for the file

            whois_asn = (newline_clean(results['asn']))
            whois_asn_country_code = (newline_clean(results['asn_country_code']))
            whois_network_cidr = (newline_clean(results['network']['cidr']))
            tmp_links = (newline_clean(results['network']['links']))
            for i in range(len(tmp_links)):

dtapi

Dynatrace API Python client

Apache-2.0
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages