mirror of https://github.com/MISP/misp-dashboard
update: Removed non-used var and function
parent
8446f3de96
commit
40d19cd4f2
|
@ -51,7 +51,6 @@ channelLastAwards = lastAwards
|
||||||
|
|
||||||
[RedisMap]
|
[RedisMap]
|
||||||
db=1
|
db=1
|
||||||
channelProc=CoordToProcess
|
|
||||||
channelDisp=PicToDisplay
|
channelDisp=PicToDisplay
|
||||||
pathMaxMindDB=./data/GeoLite2-City_20171003/GeoLite2-City.mmdb
|
pathMaxMindDB=./data/GeoLite2-City_20171003/GeoLite2-City.mmdb
|
||||||
|
|
||||||
|
|
|
@ -112,14 +112,6 @@ class EventMessage():
|
||||||
to_ret = { 'log': self.feed, 'feedName': self.feedName, 'zmqName': self.zmqName }
|
to_ret = { 'log': self.feed, 'feedName': self.feedName, 'zmqName': self.zmqName }
|
||||||
return 'data: {}\n\n'.format(json.dumps(to_ret))
|
return 'data: {}\n\n'.format(json.dumps(to_ret))
|
||||||
|
|
||||||
''' GENERAL '''
|
|
||||||
def getZrange(keyCateg, date, topNum, endSubkey=""):
|
|
||||||
date_str = util.getDateStrFormat(date)
|
|
||||||
keyname = "{}:{}{}".format(keyCateg, date_str, endSubkey)
|
|
||||||
data = serv_redis_db.zrange(keyname, 0, topNum-1, desc=True, withscores=True)
|
|
||||||
data = [ [record[0].decode('utf8'), record[1]] for record in data ]
|
|
||||||
return data
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
## ROUTE ##
|
## ROUTE ##
|
||||||
###########
|
###########
|
||||||
|
|
2
util.py
2
util.py
|
@ -1,7 +1,5 @@
|
||||||
import datetime, time
|
import datetime, time
|
||||||
|
|
||||||
ONE_DAY = 60*60*24
|
|
||||||
|
|
||||||
def getZrange(serv_redis_db, keyCateg, date, topNum, endSubkey=""):
|
def getZrange(serv_redis_db, keyCateg, date, topNum, endSubkey=""):
|
||||||
date_str = getDateStrFormat(date)
|
date_str = getDateStrFormat(date)
|
||||||
keyname = "{}:{}{}".format(keyCateg, date_str, endSubkey)
|
keyname = "{}:{}{}".format(keyCateg, date_str, endSubkey)
|
||||||
|
|
|
@ -27,7 +27,6 @@ ZMQ_URL = cfg.get('RedisGlobal', 'zmq_url')
|
||||||
CHANNEL = cfg.get('RedisLog', 'channel')
|
CHANNEL = cfg.get('RedisLog', 'channel')
|
||||||
CHANNEL_LASTCONTRIB = cfg.get('RedisLog', 'channelLastContributor')
|
CHANNEL_LASTCONTRIB = cfg.get('RedisLog', 'channelLastContributor')
|
||||||
CHANNEL_LASTAWARDS = cfg.get('RedisLog', 'channelLastAwards')
|
CHANNEL_LASTAWARDS = cfg.get('RedisLog', 'channelLastAwards')
|
||||||
CHANNEL_PROC = cfg.get('RedisMap', 'channelProc')
|
|
||||||
|
|
||||||
DEFAULT_PNTS_REWARD = cfg.get('CONTRIB', 'default_pnts_per_contribution')
|
DEFAULT_PNTS_REWARD = cfg.get('CONTRIB', 'default_pnts_per_contribution')
|
||||||
categories_in_datatable = json.loads(cfg.get('CONTRIB', 'categories_in_datatable'))
|
categories_in_datatable = json.loads(cfg.get('CONTRIB', 'categories_in_datatable'))
|
||||||
|
@ -35,7 +34,6 @@ DICO_PNTS_REWARD = {}
|
||||||
temp = json.loads(cfg.get('CONTRIB', 'pnts_per_contribution'))
|
temp = json.loads(cfg.get('CONTRIB', 'pnts_per_contribution'))
|
||||||
for categ, pnts in temp:
|
for categ, pnts in temp:
|
||||||
DICO_PNTS_REWARD[categ] = pnts
|
DICO_PNTS_REWARD[categ] = pnts
|
||||||
MAX_NUMBER_OF_LAST_CONTRIBUTOR = cfg.getint('CONTRIB', 'max_number_of_last_contributor')
|
|
||||||
|
|
||||||
serv_log = redis.StrictRedis(
|
serv_log = redis.StrictRedis(
|
||||||
host=cfg.get('RedisGlobal', 'host'),
|
host=cfg.get('RedisGlobal', 'host'),
|
||||||
|
@ -320,10 +318,13 @@ def main(zmqName):
|
||||||
socket.setsockopt_string(zmq.SUBSCRIBE, '')
|
socket.setsockopt_string(zmq.SUBSCRIBE, '')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
content = socket.recv()
|
try:
|
||||||
content.replace(b'\n', b'') # remove \n...
|
content = socket.recv()
|
||||||
zmq_name = zmqName
|
content.replace(b'\n', b'') # remove \n...
|
||||||
process_log(zmq_name, content)
|
zmq_name = zmqName
|
||||||
|
process_log(zmq_name, content)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
dico_action = {
|
dico_action = {
|
||||||
|
|
Loading…
Reference in New Issue