mimir.py 文件源码

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

项目:Mimir 作者: NullArray 项目源码 文件源码
def feed():
    b = 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/twitter-threat-feed")
    c.setopt(c.WRITEDATA, b)

    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 Threat Feed, formatting..."
    time.sleep(1)

    response_f = json.loads(b. getvalue())
    pprint(response_f)

    format = json.dumps(response_f, indent = 2)

    with open('feed.log', 'ab') as outfile:
        outfile.write(format)
        outfile.close()


    print "\n\nResults saved to 'feed.log' in the current directory"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号