fix: [Trackers UI] fix sources logo + tracker metadata

This commit is contained in:
Terrtia 2021-06-21 17:25:12 +02:00
parent 24bc99218a
commit b81d70172c
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
3 changed files with 13 additions and 7 deletions

View file

@ -192,8 +192,8 @@ def edit_tracked_menu():
@login_read_only @login_read_only
def show_tracker(): def show_tracker():
user_id = current_user.get_id() user_id = current_user.get_id()
term_uuid = request.args.get('uuid', None) tracker_uuid = request.args.get('uuid', None)
res = Term.check_term_uuid_valid_access(term_uuid, user_id) res = Term.check_term_uuid_valid_access(tracker_uuid, user_id)
if res: # invalid access if res: # invalid access
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1] return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
@ -205,15 +205,15 @@ def show_tracker():
if date_to: if date_to:
date_to = date_to.replace('-', '') date_to = date_to.replace('-', '')
tracker_metadata = Tracker.get_tracker_metedata(term_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)
if tracker_metadata['type'] == 'yara': if tracker_metadata['type'] == 'yara':
yara_rule_content = Tracker.get_yara_rule_content(tracker_metadata['term']) yara_rule_content = Tracker.get_yara_rule_content(tracker_metadata['tracker'])
else: else:
yara_rule_content = None yara_rule_content = None
if date_from: if date_from:
res = Term.parse_get_tracker_term_item({'uuid': term_uuid, 'date_from': date_from, 'date_to': date_to}, user_id) res = Term.parse_get_tracker_term_item({'uuid': tracker_uuid, 'date_from': date_from, 'date_to': date_to}, user_id)
if res[1] !=200: if res[1] !=200:
return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1] return Response(json.dumps(res[0], indent=2, sort_keys=True), mimetype='application/json'), res[1]
tracker_metadata['items'] = res[0]['items'] tracker_metadata['items'] = res[0]['items']

View file

@ -61,7 +61,13 @@
<input id="description" name="description" class="form-control" placeholder="Tracker Description (optional)" type="text" {%if dict_tracker%}{%if dict_tracker['description']%}value="{{dict_tracker['description']}}"{%endif%}{%endif%}> <input id="description" name="description" class="form-control" placeholder="Tracker Description (optional)" type="text" {%if dict_tracker%}{%if dict_tracker['description']%}value="{{dict_tracker['description']}}"{%endif%}{%endif%}>
</div> </div>
<input id="sources" style="width:100%;" type="text" name="sources" placeholder="Sources to track (ALL IF EMPTY)" autocomplete="off"> <div class="input-group mb-2 mr-sm-2">
<div class="input-group-prepend">
<div class="input-group-text bg-dark text-white"><i class="fas fa-folder"></i></div>
</div>
<input id="sources" class="form-control" type="text" name="sources" placeholder="Sources to track (ALL IF EMPTY)" autocomplete="off">
</div>
</div> </div>
<div class="col-12 col-xl-3"> <div class="col-12 col-xl-3">
<div class="custom-control custom-switch mt-1"> <div class="custom-control custom-switch mt-1">

View file

@ -81,7 +81,7 @@
<tbody> <tbody>
<tr> <tr>
<td>{{ tracker_metadata['type'] }}</td> <td>{{ tracker_metadata['type'] }}</td>
<td>{{ tracker_metadata['term'] }}</td> <td>{{ tracker_metadata['tracker'] }}</td>
<td>{{ tracker_metadata['date'][0:4] }}/{{ tracker_metadata['date'][4:6] }}/{{ tracker_metadata['date'][6:8] }}</td> <td>{{ tracker_metadata['date'][0:4] }}/{{ tracker_metadata['date'][4:6] }}/{{ tracker_metadata['date'][6:8] }}</td>
<td>{{ tracker_metadata['level'] }}</td> <td>{{ tracker_metadata['level'] }}</td>
<td>{{ tracker_metadata['user_id'] }}</td> <td>{{ tracker_metadata['user_id'] }}</td>