Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2010-2014 Cuckoo Foundation. 2 # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org 3 # See the file 'docs/LICENSE' for copying permission. 4 5 import json 6 7 from lib.cuckoo.common.abstracts import Report 8 from lib.cuckoo.common.exceptions import CuckooDependencyError 9 from lib.cuckoo.common.exceptions import CuckooReportError 10 11 try: 12 import lib.hpfeeds as hpfeeds 13 except: 14 raise CuckooDependencyError("Unable to import HPFeeds library") 1517 """Publishes the results on an HPFeeds broker channel.""" 183020 """Sends JSON report to HPFeeds channel. 21 @param results: Cuckoo results dict. 22 @raise CuckooReportError: if fails to write report. 23 """ 24 try: 25 hpc = hpfeeds.HPC(self.options["host"], self.options["port"], self.options["ident"], self.options["secret"], timeout=60) 26 hpc.publish(self.options["channel"], json.dumps(results, sort_keys=False, indent=4)) 27 hpc.close() 28 except hpfeeds.FeedException as e: 29 raise CuckooReportError("Failed to publish on HPFeeds channel: %s" % e)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Apr 7 13:27:49 2014 | http://epydoc.sourceforge.net |