chg: [Correlation UI + default taxonomies] add dark-web to default taxonomies + fix domain correlation url

pull/453/head
Terrtia 2019-11-18 09:46:15 +01:00
parent dd4ca9966a
commit 39be4ef916
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
3 changed files with 35 additions and 16 deletions

View File

@ -46,6 +46,27 @@ def is_galaxy_tag_enabled(galaxy, tag):
else: else:
return False return False
def enable_taxonomy(taxonomie, enable_tags=True):
'''
Enable a taxonomy. (UI)
:param taxonomie: MISP taxonomy
:type taxonomie: str
:param enable_tags: crawled domain
:type enable_tags: boolean
'''
taxonomies = Taxonomies()
if enable_tags:
taxonomie_info = taxonomies.get(taxonomie)
if taxonomie_info:
# activate taxonomie
r_serv_tags.sadd('active_taxonomies', taxonomie)
# activate taxonomie tags
for tag in taxonomie_info.machinetags():
r_serv_tags.sadd('active_tag_{}'.format(taxonomie), tag)
else:
print('Error: {}, please update pytaxonomies'.format(taxonomie))
# Check if tags are enabled in AIL # Check if tags are enabled in AIL
def is_valid_tags_taxonomies_galaxy(list_tags, list_tags_galaxy): def is_valid_tags_taxonomies_galaxy(list_tags, list_tags_galaxy):
if list_tags: if list_tags:

View File

@ -18,7 +18,13 @@ from flask_login import LoginManager, current_user, login_user, logout_user, log
import flask import flask
import importlib import importlib
from os.path import join from os.path import join
# # TODO: put me in lib/Tag
from pytaxonomies import Taxonomies
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'packages/')) sys.path.append(os.path.join(os.environ['AIL_BIN'], 'packages/'))
import Tag
sys.path.append('./modules/') sys.path.append('./modules/')
from User import User from User import User
@ -26,9 +32,6 @@ from User import User
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib/')) sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib/'))
import ConfigLoader import ConfigLoader
from pytaxonomies import Taxonomies
# Import config # Import config
import Flask_config import Flask_config
@ -217,20 +220,15 @@ def page_not_found(e):
return render_template('error/404.html'), 404 return render_template('error/404.html'), 404
# ========== INITIAL taxonomies ============ # ========== INITIAL taxonomies ============
# add default ail taxonomies default_taxonomies = ["infoleak", "gdpr", "fpf", "dark-web"]
r_serv_tags.sadd('active_taxonomies', 'infoleak')
r_serv_tags.sadd('active_taxonomies', 'gdpr') # enable default taxonomies
r_serv_tags.sadd('active_taxonomies', 'fpf') for taxo in default_taxonomies:
# add default tags Tag.enable_taxonomy(taxo)
taxonomies = Taxonomies()
for tag in taxonomies.get('infoleak').machinetags():
r_serv_tags.sadd('active_tag_infoleak', tag)
for tag in taxonomies.get('gdpr').machinetags():
r_serv_tags.sadd('active_tag_gdpr', tag)
for tag in taxonomies.get('fpf').machinetags():
r_serv_tags.sadd('active_tag_fpf', tag)
# ========== INITIAL tags auto export ============ # ========== INITIAL tags auto export ============
taxonomies = Taxonomies()
infoleak_tags = taxonomies.get('infoleak').machinetags() infoleak_tags = taxonomies.get('infoleak').machinetags()
infoleak_automatic_tags = [] infoleak_automatic_tags = []
for tag in taxonomies.get('infoleak').machinetags(): for tag in taxonomies.get('infoleak').machinetags():

View File

@ -243,7 +243,7 @@
<i class="{{ var_icon }}"></i> <i class="{{ var_icon }}"></i>
&nbsp;&nbsp;{{ dict_key }} &nbsp;&nbsp;{{ dict_key }}
</td> </td>
<td><a target="_blank" href="{{ url_for('correlation.show_correlation') }}?object_type=pgp&correlation_id={{ key_id }}&type_id={{ dict_key }}&correlation_objects=domain">{{ key_id }}</a></td> <td><a target="_blank" href="{{ url_for('correlation.show_correlation') }}?object_type=cryptocurrency&correlation_id={{ key_id }}&type_id={{ dict_key }}&correlation_objects=domain">{{ key_id }}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endif %} {% endif %}