mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-14 02:28:23 +00:00
chg: [Domain UI] add unsafe_tags_check (taxo: dark-web + copine-scale) + hide unsafe domain img
This commit is contained in:
parent
ae9cd1d355
commit
15bd1cc78f
3 changed files with 39 additions and 6 deletions
|
@ -20,6 +20,21 @@ r_serv_tags = config_loader.get_redis_conn("ARDB_Tags")
|
||||||
r_serv_metadata = config_loader.get_redis_conn("ARDB_Metadata")
|
r_serv_metadata = config_loader.get_redis_conn("ARDB_Metadata")
|
||||||
config_loader = None
|
config_loader = None
|
||||||
|
|
||||||
|
def build_unsafe_tags():
|
||||||
|
unsafe_tags = set()
|
||||||
|
## CE content
|
||||||
|
unsafe_tags.add('dark-web:topic="pornography-child-exploitation"')
|
||||||
|
# add copine-scale tags
|
||||||
|
taxonomies = Taxonomies()
|
||||||
|
copine_scale = taxonomies.get('copine-scale')
|
||||||
|
if copine_scale:
|
||||||
|
for tag in copine_scale.machinetags():
|
||||||
|
unsafe_tags.add(tag)
|
||||||
|
return unsafe_tags
|
||||||
|
|
||||||
|
# set of unsafe tags
|
||||||
|
unsafe_tags = build_unsafe_tags()
|
||||||
|
|
||||||
def get_taxonomie_from_tag(tag):
|
def get_taxonomie_from_tag(tag):
|
||||||
return tag.split(':')[0]
|
return tag.split(':')[0]
|
||||||
|
|
||||||
|
@ -95,6 +110,17 @@ def get_tag_metadata(tag):
|
||||||
last_seen = r_serv_tags.hget('tag_metadata:{}'.format(tag), 'last_seen')
|
last_seen = r_serv_tags.hget('tag_metadata:{}'.format(tag), 'last_seen')
|
||||||
return {'tag': tag, 'first_seen': first_seen, 'last_seen': last_seen}
|
return {'tag': tag, 'first_seen': first_seen, 'last_seen': last_seen}
|
||||||
|
|
||||||
|
def is_tags_safe(ltags):
|
||||||
|
'''
|
||||||
|
Check if a list of tags contain an unsafe tag (CE, ...)
|
||||||
|
|
||||||
|
:param ltags: list of tags
|
||||||
|
:type ltags: list
|
||||||
|
:return: is a tag in the unsafe set
|
||||||
|
:rtype: boolean
|
||||||
|
'''
|
||||||
|
return unsafe_tags.isdisjoint(ltags)
|
||||||
|
|
||||||
def is_tag_in_all_tag(tag):
|
def is_tag_in_all_tag(tag):
|
||||||
if r_serv_tags.sismember('list_tags', tag):
|
if r_serv_tags.sismember('list_tags', tag):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -21,7 +21,7 @@ from Role_Manager import create_user_db, check_password_strength, check_user_rol
|
||||||
from Role_Manager import login_admin, login_analyst
|
from Role_Manager import login_admin, login_analyst
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'packages'))
|
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'packages'))
|
||||||
from Tag import get_modal_add_tags
|
import Tag
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib'))
|
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib'))
|
||||||
import Domain
|
import Domain
|
||||||
|
@ -65,9 +65,10 @@ def showDomain():
|
||||||
dict_domain = {**dict_domain, **domain.get_domain_correlation()}
|
dict_domain = {**dict_domain, **domain.get_domain_correlation()}
|
||||||
dict_domain['origin_item'] = domain.get_domain_last_origin()
|
dict_domain['origin_item'] = domain.get_domain_last_origin()
|
||||||
dict_domain['tags'] = domain.get_domain_tags()
|
dict_domain['tags'] = domain.get_domain_tags()
|
||||||
|
dict_domain['tags_safe'] = Tag.is_tags_safe(dict_domain['tags'])
|
||||||
dict_domain['history'] = domain.get_domain_history_with_status()
|
dict_domain['history'] = domain.get_domain_history_with_status()
|
||||||
dict_domain['crawler_history'] = domain.get_domain_items_crawled(items_link=True, epoch=epoch, item_screenshot=True, item_tag=True) # # TODO: handle multiple port
|
dict_domain['crawler_history'] = domain.get_domain_items_crawled(items_link=True, epoch=epoch, item_screenshot=True, item_tag=True) # # TODO: handle multiple port
|
||||||
dict_domain['crawler_history']['random_item'] = random.choice(dict_domain['crawler_history']['items'])
|
dict_domain['crawler_history']['random_item'] = random.choice(dict_domain['crawler_history']['items'])
|
||||||
|
|
||||||
return render_template("showDomain.html", dict_domain=dict_domain, bootstrap_label=bootstrap_label,
|
return render_template("showDomain.html", dict_domain=dict_domain, bootstrap_label=bootstrap_label,
|
||||||
modal_add_tags=get_modal_add_tags(dict_domain['domain'], tag_type="domain"))
|
modal_add_tags=Tag.get_modal_add_tags(dict_domain['domain'], tag_type="domain"))
|
||||||
|
|
|
@ -366,12 +366,18 @@
|
||||||
<div class="card my-2" style="background-color:#ecf0f1;">
|
<div class="card my-2" style="background-color:#ecf0f1;">
|
||||||
<div class="card-body py-2">
|
<div class="card-body py-2">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-3 text-center">
|
||||||
<input class="custom-range mt-2" id="blocks" type="range" min="1" max="50" value="13">
|
<button class="btn btn-primary" onclick="blocks.value=0;pixelate();">
|
||||||
|
<i class="fas fa-eye-slash"></i>
|
||||||
|
<span class="label-icon">Hide</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-6">
|
||||||
|
<input class="custom-range mt-2" id="blocks" type="range" min="1" max="50" value="{%if dict_domain['tags_safe']%}13{%else%}0{%endif%}">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3 text-center">
|
||||||
<button class="btn btn-primary" onclick="blocks.value=50;pixelate();">
|
<button class="btn btn-primary" onclick="blocks.value=50;pixelate();">
|
||||||
<i class="fas fa-search-plu"></i>
|
<i class="fas fa-search-"></i>
|
||||||
<span class="label-icon">Full resolution</span>
|
<span class="label-icon">Full resolution</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue