Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 37 lines (31 sloc) 1.297 kb
491b0633 »
2012-06-28 Added Cuckoo Sandbox HPFeeds module
1 import json
2
3 from lib.cuckoo.common.abstracts import Report
4 from lib.cuckoo.common.exceptions import CuckooDependencyError, CuckooReportError
5
6 try:
7 import lib.hpfeeds as hpfeeds
8 except:
9 raise CuckooDependencyError("Unable to import HPFeeds library")
10
11 # This file should be placed in "modules/reporting/" in Cuckoo >= 0.4.
12 # You should have the hpfeeds.py library installed in "lib/" and you should
13 # place the following configuration section in "conf/reporting.conf":
14 #
15 # [hpfclient]
16 # enabled = on
17 # host = <host name>
18 # port = 10000
19 # ident = <ident>
20 # secret = <secret key>
21 # channel = <channel name>
22
23 class HPFClient(Report):
24 """Publishes the results on an HPFeeds broker channel."""
25
26 def run(self, results):
27 """Sends JSON report to HPFeeds channel.
28 @param results: Cuckoo results dict.
29 @raise CuckooReportError: if fails to write report.
30 """
31 try:
32 hpc = hpfeeds.HPC(self.options["host"], self.options["port"], self.options["ident"], self.options["secret"], timeout=60)
33 hpc.publish(self.options["channel"], json.dumps(results, sort_keys=False, indent=4))
34 hpc.close()
35 except hpfeeds.FeedException as e:
36 raise CuckooReportError("Failed to publish on HPFeeds channel: %s" % e.message)
Something went wrong with that request. Please try again.