Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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" ,
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 = ""