diff --git a/config/config.cfg.default b/config/config.cfg.default index 004327b..738b175 100644 --- a/config/config.cfg.default +++ b/config/config.cfg.default @@ -28,6 +28,7 @@ categories_in_datatable = ["internal_reference", "targeting_data", "antivirus_de default_pnts_per_contribution = 1 # array of the form [[category, pntsRcv], ...] pnts_per_contribution = [["payload_delivery", 5], ["artifact_dropped", 20], ["network_activity", 5]] +additional_help_text = ["Sightings multiplies earned points by 2", "Editing an attribute earns you the same as creating one"] [Log] field_to_plot = Attribute.category diff --git a/contributor_helper.py b/contributor_helper.py index 5039ba9..040c827 100644 --- a/contributor_helper.py +++ b/contributor_helper.py @@ -11,6 +11,18 @@ class Contributor_helper: self.MAX_NUMBER_OF_LAST_CONTRIBUTOR = cfg.getint('CONTRIB', 'max_number_of_last_contributor') self.categories_in_datatable = json.loads(cfg.get('CONTRIB', 'categories_in_datatable')) + self.default_pnts_per_contribution = json.loads(cfg.get('CONTRIB', 'default_pnts_per_contribution')) + temp = json.loads(cfg.get('CONTRIB', 'pnts_per_contribution')) + self.DICO_PNTS_REWARD = {} + for categ, pnts in temp: + self.DICO_PNTS_REWARD[categ] = pnts + # fill other categ with default points + for categ in self.categories_in_datatable: + if categ in self.DICO_PNTS_REWARD: + continue + else: + self.DICO_PNTS_REWARD[categ] = self.default_pnts_per_contribution + self.rankMultiplier = cfg.getfloat('CONTRIB' ,'rankMultiplier') self.levelMax = 16 diff --git a/server.py b/server.py index 999edfb..fb43da7 100755 --- a/server.py +++ b/server.py @@ -150,14 +150,18 @@ def geo(): def contrib(): categ_list = contributor_helper.categories_in_datatable categ_list_str = [ s[0].upper() + s[1:].replace('_', ' ') for s in contributor_helper.categories_in_datatable] + categ_list_points = [contributor_helper.DICO_PNTS_REWARD[categ] for categ in categ_list] currOrg = request.args.get('org') if currOrg is None: currOrg = "" return render_template('contrib.html', currOrg=currOrg, rankMultiplier=contributor_helper.rankMultiplier, + default_pnts_per_contribution=contributor_helper.default_pnts_per_contribution, + additional_help_text=json.loads(cfg.get('CONTRIB', 'additional_help_text')), categ_list=json.dumps(categ_list), categ_list_str=categ_list_str, + categ_list_points=categ_list_points, min_between_reload=cfg.getint('CONTRIB', 'min_between_reload') ) diff --git a/static/css/ranking.css b/static/css/ranking.css index 8a1473c..c517c11 100644 --- a/static/css/ranking.css +++ b/static/css/ranking.css @@ -4,9 +4,9 @@ } .questionBadgeText { - left: 15%; + left: -15%; position: relative; - bottom: 12%; + bottom: 18%; } .questionBadgeDiv { diff --git a/templates/contrib.html b/templates/contrib.html index ae7fdf6..6fa8de0 100644 --- a/templates/contrib.html +++ b/templates/contrib.html @@ -44,6 +44,49 @@ + +
@@ -83,7 +126,7 @@
-
+ diff --git a/zmq_subscriber.py b/zmq_subscriber.py index 53c6806..6848ef0 100755 --- a/zmq_subscriber.py +++ b/zmq_subscriber.py @@ -168,7 +168,7 @@ def handler_sighting(zmq_name, jsonsight): org = jsonsight['org'] categ = jsonsight['categ'] action = jsonsight['action'] - handleContribution(zmq_name, org, categ, action) + handleContribution(zmq_name, org, categ, action, pntMultiplier=2) return def handler_event(zmq_name, jsonobj):