diff --git a/bin/lib/Tracker.py b/bin/lib/Tracker.py index 5310fa73..bf691514 100755 --- a/bin/lib/Tracker.py +++ b/bin/lib/Tracker.py @@ -106,6 +106,9 @@ def get_tracker_tags(tracker_uuid): def get_tracker_mails(tracker_uuid): return list(r_serv_tracker.smembers('tracker:mail:{}'.format(tracker_uuid))) +def get_tracker_webhook(tracker_uuid): + return r_serv_tracker.hget('tracker:{}'.format(tracker_uuid), 'webhook') + def get_tracker_uuid_sources(tracker_uuid): return list(r_serv_tracker.smembers(f'tracker:sources:{tracker_uuid}')) @@ -129,7 +132,7 @@ def get_tracker_last_seen(tracker_uuid): else: return None -def get_tracker_metedata(tracker_uuid, user_id=False, description=False, level=False, tags=False, mails=False, sources=True, sparkline=False): +def get_tracker_metedata(tracker_uuid, user_id=False, description=False, level=False, tags=False, mails=False, sources=True, sparkline=False, webhook=False): dict_uuid = {} dict_uuid['tracker'] = get_tracker_by_uuid(tracker_uuid) dict_uuid['type'] = get_tracker_type(tracker_uuid) @@ -149,6 +152,8 @@ def get_tracker_metedata(tracker_uuid, user_id=False, description=False, level=F dict_uuid['tags'] = get_tracker_tags(tracker_uuid) if sparkline: dict_uuid['sparkline'] = get_tracker_sparkline(tracker_uuid) + if webhook: + dict_uuid['webhook'] = get_tracker_webhook(tracker_uuid) dict_uuid['uuid'] = tracker_uuid return dict_uuid diff --git a/var/www/modules/hunter/Flask_hunter.py b/var/www/modules/hunter/Flask_hunter.py index a04c7286..0d45c23e 100644 --- a/var/www/modules/hunter/Flask_hunter.py +++ b/var/www/modules/hunter/Flask_hunter.py @@ -96,6 +96,7 @@ def add_tracked_menu(): tracker_type = request.form.get("tracker_type") nb_words = request.form.get("nb_word", 1) description = request.form.get("description", '') + webhook = request.form.get("webhook", '') level = request.form.get("level", 0) tags = request.form.get("tags", []) mails = request.form.get("mails", []) @@ -125,7 +126,7 @@ def add_tracked_menu(): input_dict = {"tracker": tracker, "type": tracker_type, "nb_words": nb_words, "tags": tags, "mails": mails, "sources": sources, - "level": level, "description": description} + "level": level, "description": description, "webhook": webhook} user_id = current_user.get_id() # edit tracker if tracker_uuid: @@ -155,7 +156,7 @@ def edit_tracked_menu(): if res: # invalid access return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1] - dict_tracker = Tracker.get_tracker_metedata(tracker_uuid, user_id=True, level=True, description=True, tags=True, mails=True, sources=True) + dict_tracker = Tracker.get_tracker_metedata(tracker_uuid, user_id=True, level=True, description=True, tags=True, mails=True, sources=True, webhook=True) dict_tracker['tags'] = ' '.join(dict_tracker['tags']) dict_tracker['mails'] = ' '.join(dict_tracker['mails']) @@ -202,7 +203,7 @@ def show_tracker(): if date_to: date_to = date_to.replace('-', '') - tracker_metadata = Tracker.get_tracker_metedata(tracker_uuid, user_id=True, level=True, description=True, tags=True, mails=True, sources=True, sparkline=True) + tracker_metadata = Tracker.get_tracker_metedata(tracker_uuid, user_id=True, level=True, description=True, tags=True, mails=True, sources=True, sparkline=True, webhook=True) if tracker_metadata['type'] == 'yara': yara_rule_content = Tracker.get_yara_rule_content(tracker_metadata['tracker']) diff --git a/var/www/modules/hunter/templates/edit_tracker.html b/var/www/modules/hunter/templates/edit_tracker.html index 8d91c54b..279051fb 100644 --- a/var/www/modules/hunter/templates/edit_tracker.html +++ b/var/www/modules/hunter/templates/edit_tracker.html @@ -43,7 +43,7 @@
-
+
@@ -53,6 +53,12 @@
+
+
+
+
+
+
diff --git a/var/www/modules/hunter/templates/showTracker.html b/var/www/modules/hunter/templates/showTracker.html index 0faf20e6..77b1242d 100644 --- a/var/www/modules/hunter/templates/showTracker.html +++ b/var/www/modules/hunter/templates/showTracker.html @@ -74,6 +74,7 @@ Created by First seen Last seen + Webhook URL Tags Email @@ -95,6 +96,11 @@ {{ tracker_metadata['last_seen'][0:4] }}/{{ tracker_metadata['last_seen'][4:6] }}/{{ tracker_metadata['last_seen'][6:8] }} {% endif %} + + {% if tracker_metadata['wehook'] %} + {{ tracker_metadata['wehook'] }} + {% endif %} + {% for tag in tracker_metadata['tags'] %} diff --git a/var/www/modules/hunter/templates/trackersManagement.html b/var/www/modules/hunter/templates/trackersManagement.html index 007d8046..dc9a2545 100644 --- a/var/www/modules/hunter/templates/trackersManagement.html +++ b/var/www/modules/hunter/templates/trackersManagement.html @@ -2,224 +2,241 @@ - - + + - Tracker Management - + Tracker Management + - - - - + + + + - - - - - - + + + + + + - + .btn-link { + color: #000000 + } + + .mouse_pointer { + cursor: pointer; + } + + .lb-md { + font-size: 16px; + } + - {% include 'nav_bar.html' %} +{% include 'nav_bar.html' %} -
-
+
+
- {% include 'hunter/menu_sidebar.html' %} + {% include 'hunter/menu_sidebar.html' %} -
+
-
-
-
Your {{filter_type}} Trackers
-
-
- - - - - - - - - - - - - {% for dict_uuid in user_term %} - - - + + + + + + + {% endfor %} + +
TypeTrackerFirst seenLast seenEmail notificationsparkline
{{dict_uuid['type']}} +
+
+
Your {{ filter_type }} Trackers
+
+
+ + + + + + + + + + + + + + {% for dict_uuid in user_term %} + + + - - - - - - {% endfor %} - -
TypeTrackerFirst seenLast seenWebhook URLEmail notificationsparkline
{{ dict_uuid['type'] }} - {% if dict_uuid['term']%} - {% if dict_uuid['term']|length > 256 %} - {{ dict_uuid['term'][0:256]}}... - {% else %} - {{ dict_uuid['term']}} - {% endif %} + {% if dict_uuid['term'] %} + {% if dict_uuid['term']|length > 256 %} + {{ dict_uuid['term'][0:256] }}... + {% else %} + {{ dict_uuid['term'] }} + {% endif %} {% endif %} -
- {% for tag in dict_uuid['tags'] %} - - {{ tag }} - - {% endfor %} -
-
- {% if dict_uuid['first_seen'] %} - {{dict_uuid['first_seen'][0:4]}}/{{dict_uuid['first_seen'][4:6]}}/{{dict_uuid['first_seen'][6:8]}} - {% endif %} - - {% if dict_uuid['last_seen'] %} - {{dict_uuid['last_seen'][0:4]}}/{{dict_uuid['last_seen'][4:6]}}/{{dict_uuid['last_seen'][6:8]}} - {% endif %} - - {% for mail in dict_uuid['mails'] %} - {{ mail }}
- {% endfor %} -
-
-
+
+ {% for tag in dict_uuid['tags'] %} + + {{ tag }} + + {% endfor %} +
+
+ {% if dict_uuid['first_seen'] %} + {{ dict_uuid['first_seen'][0:4] }}/{{ dict_uuid['first_seen'][4:6] }}/ + {{ dict_uuid['first_seen'][6:8] }} + {% endif %} + + {% if dict_uuid['last_seen'] %} + {{ dict_uuid['last_seen'][0:4] }}/{{ dict_uuid['last_seen'][4:6] }}/ + {{ dict_uuid['last_seen'][6:8] }} + {% endif %} + + {% if dict_uuid['webhook'] %} + {{ dict_uuid['webhook'] }} + {% endif %} + + {% for mail in dict_uuid['mails'] %} + {{ mail }}
+ {% endfor %} +
+
+
-
-
-
Global {{filter_type}} Trackers
-
-
- - - - - - - - - - - - - {% for dict_uuid in global_term %} - - - + + + + + + + {% endfor %} + +
TypeTrackerFirst seenLast seenEmail notificationsparkline
{{dict_uuid['type']}} +
+
+
Global {{ filter_type }} Trackers
+
+
+ + + + + + + + + + + + + + {% for dict_uuid in global_term %} + + + - - - - - - {% endfor %} - -
TypeTrackerFirst seenLast seenWebhook URLEmail notificationsparkline
{{ dict_uuid['type'] }} - {% if dict_uuid['term']%} - {% if dict_uuid['term']|length > 256 %} - {{ dict_uuid['term'][0:256]}}... - {% else %} - {{ dict_uuid['term']}} - {% endif %} + {% if dict_uuid['term'] %} + {% if dict_uuid['term']|length > 256 %} + {{ dict_uuid['term'][0:256] }}... + {% else %} + {{ dict_uuid['term'] }} + {% endif %} {% endif %} -
- {% for tag in dict_uuid['tags'] %} - - {{ tag }} - - {% endfor %} -
-
- {% if dict_uuid['first_seen'] %} - {{dict_uuid['first_seen'][0:4]}}/{{dict_uuid['first_seen'][4:6]}}/{{dict_uuid['first_seen'][6:8]}} - {% endif %} - - {% if dict_uuid['last_seen'] %} - {{dict_uuid['last_seen'][0:4]}}/{{dict_uuid['last_seen'][4:6]}}/{{dict_uuid['last_seen'][6:8]}} - {% endif %} - - {% for mail in dict_uuid['mails'] %} - {{ mail }}
- {% endfor %} -
-
+
+ {% for tag in dict_uuid['tags'] %} + + {{ tag }} + + {% endfor %} +
+
+ {% if dict_uuid['first_seen'] %} + {{ dict_uuid['first_seen'][0:4] }}/{{ dict_uuid['first_seen'][4:6] }}/ + {{ dict_uuid['first_seen'][6:8] }} + {% endif %} + + {% if dict_uuid['last_seen'] %} + {{ dict_uuid['last_seen'][0:4] }}/{{ dict_uuid['last_seen'][4:6] }}/ + {{ dict_uuid['last_seen'][6:8] }} + {% endif %} + + {% if dict_uuid['webhook'] %} + {{ dict_uuid['webhook'] }} + {% endif %} + + {% for mail in dict_uuid['mails'] %} + {{ mail }}
+ {% endfor %} +
+
+
+ + +
+ + Create New Tracker + +
- - - - - - Create New Tracker - - -
-
-
+
+