mimir.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Mimir 作者: NullArray 项目源码 文件源码
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"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号