mirror of https://github.com/CIRCL/AIL-framework
chg: [trackers + retro_hunts] show organisation
parent
b030382cdf
commit
478f8f47d1
|
@ -333,6 +333,8 @@ class Tracker:
|
|||
'last_seen': self.get_last_seen()}
|
||||
if 'org' in options:
|
||||
meta['org'] = self.get_org()
|
||||
if 'org_name' in options:
|
||||
meta['org_name'] = ail_orgs.Organisation(self.get_org()).get_name()
|
||||
if 'user' in options:
|
||||
meta['user'] = self.get_user()
|
||||
if 'level' in options:
|
||||
|
@ -725,21 +727,21 @@ def get_user_trackers_meta(user_id, tracker_type=None):
|
|||
metas = []
|
||||
for tracker_uuid in get_user_trackers(user_id, tracker_type=tracker_type):
|
||||
tracker = Tracker(tracker_uuid)
|
||||
metas.append(tracker.get_meta(options={'description', 'mails', 'sparkline', 'tags'}))
|
||||
metas.append(tracker.get_meta(options={'description', 'mails', 'org', 'org_name', 'sparkline', 'tags'}))
|
||||
return metas
|
||||
|
||||
def get_global_trackers_meta(tracker_type=None):
|
||||
metas = []
|
||||
for tracker_uuid in get_global_trackers(tracker_type=tracker_type):
|
||||
tracker = Tracker(tracker_uuid)
|
||||
metas.append(tracker.get_meta(options={'description', 'mails', 'sparkline', 'tags'}))
|
||||
metas.append(tracker.get_meta(options={'description', 'mails', 'org', 'org_name', 'sparkline', 'tags'}))
|
||||
return metas
|
||||
|
||||
def get_org_trackers_meta(user_org, tracker_type=None):
|
||||
metas = []
|
||||
for tracker_uuid in get_org_trackers(user_org, tracker_type=tracker_type):
|
||||
tracker = Tracker(tracker_uuid)
|
||||
metas.append(tracker.get_meta(options={'description', 'mails', 'sparkline', 'tags'}))
|
||||
metas.append(tracker.get_meta(options={'description', 'mails', 'org', 'org_name', 'sparkline', 'tags'}))
|
||||
return metas
|
||||
|
||||
def get_users_trackers_meta():
|
||||
|
@ -1556,6 +1558,10 @@ class RetroHunt:
|
|||
meta['nb_match'] = self.get_nb_match()
|
||||
if 'nb_objs' in options:
|
||||
meta['nb_objs'] = self.get_nb_objs()
|
||||
if 'org' in options:
|
||||
meta['org'] = self.get_org()
|
||||
if 'org_name' in options:
|
||||
meta['org_name'] = ail_orgs.Organisation(self.get_org()).get_name()
|
||||
if 'progress' in options:
|
||||
meta['progress'] = self.get_progress()
|
||||
if 'filters' in options:
|
||||
|
@ -1758,6 +1764,14 @@ def get_retro_hunts_global():
|
|||
def get_retro_hunts_org(org_uuid):
|
||||
return ail_orgs.get_org_objs_by_type(org_uuid, 'retro_hunt')
|
||||
|
||||
def get_retro_hunts_orgs():
|
||||
retros = []
|
||||
for retro_uuid in get_all_retro_hunt_tasks():
|
||||
retro = RetroHunt(retro_uuid)
|
||||
if retro.get_level() == 2:
|
||||
retros.append(retro_uuid)
|
||||
return retros
|
||||
|
||||
def get_retro_hunt_pending_tasks():
|
||||
return r_tracker.smembers('retro_hunts:pending')
|
||||
|
||||
|
@ -1785,7 +1799,7 @@ def get_retro_hunt_metas(trackers_uuid):
|
|||
tasks = []
|
||||
for task_uuid in trackers_uuid:
|
||||
retro_hunt = RetroHunt(task_uuid)
|
||||
tasks.append(retro_hunt.get_meta(options={'date', 'progress', 'nb_match', 'tags'}))
|
||||
tasks.append(retro_hunt.get_meta(options={'date', 'progress', 'org', 'org_name', 'nb_match', 'tags'}))
|
||||
return tasks
|
||||
|
||||
## Objects ##
|
||||
|
|
|
@ -167,7 +167,7 @@ def show_tracker():
|
|||
date_to = date_to.replace('-', '')
|
||||
|
||||
tracker = Tracker.Tracker(tracker_uuid)
|
||||
meta = tracker.get_meta(options={'description', 'level', 'mails', 'filters', 'sparkline', 'tags',
|
||||
meta = tracker.get_meta(options={'description', 'level', 'mails', 'org', 'org_name', 'filters', 'sparkline', 'tags',
|
||||
'user', 'webhooks', 'nb_objs'})
|
||||
|
||||
if meta['type'] == 'yara':
|
||||
|
@ -486,6 +486,13 @@ def retro_hunt_all_tasks():
|
|||
retro_hunts_org = Tracker.get_retro_hunt_metas(Tracker.get_retro_hunts_org(user_org))
|
||||
return render_template("retro_hunt_tasks.html", retro_hunts_global=retro_hunts_global, retro_hunts_org=retro_hunts_org, bootstrap_label=bootstrap_label)
|
||||
|
||||
@hunters.route('/retro_hunt/tasks/admin', methods=['GET'])
|
||||
@login_required
|
||||
@login_admin
|
||||
def retro_hunt_all_tasks_admin():
|
||||
retro_hunts_org = Tracker.get_retro_hunt_metas(Tracker.get_retro_hunts_orgs())
|
||||
return render_template("retro_hunt_tasks.html", retro_hunts_global=[], retro_hunts_org=retro_hunts_org, bootstrap_label=bootstrap_label)
|
||||
|
||||
@hunters.route('/retro_hunt/task/show', methods=['GET'])
|
||||
@login_required
|
||||
@login_read_only
|
||||
|
@ -512,7 +519,7 @@ def retro_hunt_show_task():
|
|||
if res:
|
||||
return res
|
||||
|
||||
dict_task = retro_hunt.get_meta(options={'creator', 'date', 'description', 'level', 'progress', 'filters', 'nb_objs', 'tags'})
|
||||
dict_task = retro_hunt.get_meta(options={'creator', 'date', 'description', 'level', 'org', 'org_name', 'progress', 'filters', 'nb_objs', 'tags'})
|
||||
rule_content = Tracker.get_yara_rule_content(dict_task['rule'])
|
||||
dict_task['filters'] = json.dumps(dict_task['filters'], indent=4)
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<thead class="bg-dark text-white">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Org</th>
|
||||
<th>Date</th>
|
||||
<th>Nb Matches</th>
|
||||
<th></th>
|
||||
|
@ -64,6 +65,9 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ dict_task['org_name'] }}<br>{{ dict_task['org'] }}
|
||||
</td>
|
||||
<td>{{ dict_task['date'][0:4]}}/{{ dict_task['date'][4:6]}}/{{ dict_task['date'][6:8]}}</td>
|
||||
<td>
|
||||
<b><h3 class="font-weight-bold text-primary">{{dict_task['nb_match']}}</h3></b>
|
||||
|
@ -108,6 +112,7 @@
|
|||
<thead class="bg-dark text-white">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Org</th>
|
||||
<th>Date</th>
|
||||
<th>Nb Matches</th>
|
||||
<th></th>
|
||||
|
@ -131,6 +136,9 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ dict_task['org_name'] }}<br>{{ dict_task['org'] }}
|
||||
</td>
|
||||
<td>{{ dict_task['date'][0:4]}}/{{ dict_task['date'][4:6]}}/{{ dict_task['date'][6:8]}}</td>
|
||||
<td>
|
||||
<b><h3 class="font-weight-bold text-primary">{{dict_task['nb_match']}}</h3></b>
|
||||
|
|
|
@ -129,6 +129,10 @@
|
|||
<td class="text-right"><b>Creator</b></td>
|
||||
<td>{{dict_task['creator']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right"><b>Org</b></td>
|
||||
<td>{{dict_task['org_name']}}<br>{{ dict_task['org'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right"><b>Filters</b></td>
|
||||
<td>
|
||||
|
|
|
@ -131,6 +131,10 @@
|
|||
<td class="text-right"><b>Creator</b></td>
|
||||
<td>{{meta['user']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right"><b>Org</b></td>
|
||||
<td>{{meta['org_name']}}<br>{{ meta['org'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right"><b>First Seen</b></td>
|
||||
<td>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Tracker</th>
|
||||
<th>Org</th>
|
||||
<th>First seen</th>
|
||||
<th>Last seen</th>
|
||||
<th>Emails</th>
|
||||
|
@ -92,6 +93,9 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ dict_uuid['org_name'] }}<br>{{ dict_uuid['org'] }}
|
||||
</td>
|
||||
<td>
|
||||
{% if dict_uuid['first_seen'] %}
|
||||
{{ dict_uuid['first_seen'][0:4] }}/{{ dict_uuid['first_seen'][4:6] }}/{{ dict_uuid['first_seen'][6:8] }}
|
||||
|
@ -130,6 +134,7 @@
|
|||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Tracker</th>
|
||||
<th>Org</th>
|
||||
<th>First seen</th>
|
||||
<th>Last seen</th>
|
||||
<th>Emails</th>
|
||||
|
@ -164,6 +169,9 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ dict_uuid['org_name'] }}<br>{{ dict_uuid['org'] }}
|
||||
</td>
|
||||
<td>
|
||||
{% if dict_uuid['first_seen'] %}
|
||||
{{ dict_uuid['first_seen'][0:4] }}/{{ dict_uuid['first_seen'][4:6] }}/{{ dict_uuid['first_seen'][6:8] }}
|
||||
|
@ -199,6 +207,7 @@
|
|||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Tracker</th>
|
||||
<th>Org</th>
|
||||
<th>First seen</th>
|
||||
<th>Last seen</th>
|
||||
<th>Email notification</th>
|
||||
|
@ -233,6 +242,9 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ dict_uuid['org_name'] }}<br>{{ dict_uuid['org'] }}
|
||||
</td>
|
||||
<td>
|
||||
{% if dict_uuid['first_seen'] %}
|
||||
{{ dict_uuid['first_seen'][0:4] }}/{{ dict_uuid['first_seen'][4:6] }}/{{ dict_uuid['first_seen'][6:8] }}
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
<thead class="bg-dark text-white">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Org</th>
|
||||
<th>Date</th>
|
||||
<th>last modified</th>
|
||||
<td>Info</td>
|
||||
|
@ -95,6 +96,7 @@
|
|||
</div>
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ dict_investigation['org_name']}}<br>{{ dict_investigation['org'] }}</td>
|
||||
<td>{{ dict_investigation['date']}}</td>
|
||||
<td>{{ dict_investigation['last_change']}}</td>
|
||||
<td>{{ dict_investigation['info']}}</td>
|
||||
|
|
Loading…
Reference in New Issue