feature: Draft of sightings support

pull/9/head
Sami Mokaddem 2017-11-17 11:46:51 +01:00
parent ec3ec66fa7
commit bacde8e71f
2 changed files with 14 additions and 2 deletions

View File

@ -28,8 +28,17 @@ class Trendings_helper:
for tag in tags:
self.addGenericTrending('TRENDINGS_TAGS', tag, timestamp)
def addSightings(self, event, categName, timestamp):
pass
def addSightings(self, timestamp):
timestampDate = datetime.datetime.fromtimestamp(float(timestamp))
timestampDate_str = util.getDateStrFormat(timestampDate)
keyname = "{}:{}".format("TRENDINGS_SIGHT_sightings", timestampDate_str)
self.serv_redis_db.incrby(keyname, 1)
def addFalsePositive(self, timestamp):
timestampDate = datetime.datetime.fromtimestamp(float(timestamp))
timestampDate_str = util.getDateStrFormat(timestampDate)
keyname = "{}:{}".format("TRENDINGS_SIGHT_false_positive", timestampDate_str)
self.serv_redis_db.incrby(keyname, 1)
''' GETTER '''

View File

@ -232,6 +232,9 @@ def handler_sighting(zmq_name, jsondata):
action = None
handleContribution(zmq_name, org, 'Sighting', categ, action, pntMultiplier=2)
handler_attribute(zmq_name, jsonsight, hasAlreadyBeenContributed=True)
trendings_helper.addSightings()
trendings_helper.addFalsePositive()
def handler_event(zmq_name, jsonobj):
#fields: threat_level_id, id, info