def hosts():
a = StringIO.StringIO()
# Options for PyCurl
opts = ['X-HoneyDb-ApiId: ' + DB_API_ID, 'X-HoneyDb-ApiKey: ' + DB_API_KEY]
c.setopt(pycurl.HTTPHEADER, (opts))
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.URL, "https://riskdiscovery.com/honeydb/api/bad-hosts")
c.setopt(c.WRITEDATA, a)
try:
c.perform()
except Exception as e:
print "\n[" + t.red("!") + "]Critical. An error was raised with the following message"
print e
os.system("clear")
print "\n\n[" + t.green("+") + "]Retrieved Bad Hosts, formatting..."
time.sleep(1)
response_h = json.loads(a. getvalue())
pprint(response_h)
format = json.dumps(response_h, indent = 2)
with open('hosts.log', 'ab') as outfile:
outfile.write(format)
outfile.close()
print "\n\nResults saved to 'hosts.log' in the current directory"
评论列表
文章目录