mirror of https://github.com/CIRCL/AIL-framework
Merge branch 'master' into crawler_manager
commit
25d3cbacde
|
@ -28,15 +28,15 @@ def create_map_obj_event_uuid(event_uuid, global_id):
|
||||||
r_serv_objects.sadd('object:map:id_event:{}'.format(global_id), event_uuid)
|
r_serv_objects.sadd('object:map:id_event:{}'.format(global_id), event_uuid)
|
||||||
|
|
||||||
def get_user_list_of_obj_to_export(user_id, add_uuid=False):
|
def get_user_list_of_obj_to_export(user_id, add_uuid=False):
|
||||||
set_objs_to_export = []
|
objs_to_export = []
|
||||||
res = r_serv_objects.hgetall('user:all_objs_to_export:{}'.format(user_id))
|
res = r_serv_objects.hgetall('user:all_objs_to_export:{}'.format(user_id))
|
||||||
for global_id in res:
|
for global_id in res:
|
||||||
dict_obj = Correlate_object.get_global_id_from_id(global_id)
|
dict_obj = Correlate_object.get_global_id_from_id(global_id)
|
||||||
dict_obj['lvl'] = int(res[global_id])
|
dict_obj['lvl'] = int(res[global_id])
|
||||||
if add_uuid:
|
if add_uuid:
|
||||||
obj_dict['uuid'] = str(uuid.uuid4())
|
obj_dict['uuid'] = str(uuid.uuid4())
|
||||||
set_objs_to_export.append(dict_obj)
|
objs_to_export.append(dict_obj)
|
||||||
return set_objs_to_export
|
return objs_to_export
|
||||||
|
|
||||||
def add_user_object_to_export(user_id, obj_type, obj_id, lvl, obj_subtype=None):
|
def add_user_object_to_export(user_id, obj_type, obj_id, lvl, obj_subtype=None):
|
||||||
## TODO: check if user exist
|
## TODO: check if user exist
|
||||||
|
|
|
@ -83,7 +83,6 @@ def import_object_file():
|
||||||
@login_analyst
|
@login_analyst
|
||||||
def export_object():
|
def export_object():
|
||||||
user_id = current_user.get_id()
|
user_id = current_user.get_id()
|
||||||
l_obj_to_export = set()
|
|
||||||
|
|
||||||
# get user saved obj to export
|
# get user saved obj to export
|
||||||
l_obj_to_export = AILObjects.get_user_list_of_obj_to_export(user_id)
|
l_obj_to_export = AILObjects.get_user_list_of_obj_to_export(user_id)
|
||||||
|
|
|
@ -9,16 +9,16 @@
|
||||||
<option value="domain" {%if obj_type=="domain"%}selected{%endif%}>Domain</option>
|
<option value="domain" {%if obj_type=="domain"%}selected{%endif%}>Domain</option>
|
||||||
<option value="image" {%if obj_type=="image"%}selected{%endif%}>Image</option>
|
<option value="image" {%if obj_type=="image"%}selected{%endif%}>Image</option>
|
||||||
<option value="decoded" {%if obj_type=="decoded"%}selected{%endif%}>Decoded</option>
|
<option value="decoded" {%if obj_type=="decoded"%}selected{%endif%}>Decoded</option>
|
||||||
<option value="pgp;key" {%if obj_type=="pgp;key"%}selected{%endif%}>PGP - Key</option>
|
<option value="pgp;key" {%if obj_type=="pgp" and obj_subtype=="key"%}selected{%endif%}>PGP - Key</option>
|
||||||
<option value="pgp;name" {%if obj_type=="pgp;name"%}selected{%endif%}>PGP - Name</option>
|
<option value="pgp;name" {%if obj_type=="pgp" and obj_subtype=="name"%}selected{%endif%}>PGP - Name</option>
|
||||||
<option value="pgp;mail" {%if obj_type=="pgp;mail"%}selected{%endif%}>PGP - Mail</option>
|
<option value="pgp;mail" {%if obj_type=="pgp" and obj_subtype=="mail"%}selected{%endif%}>PGP - Mail</option>
|
||||||
<option value="cryptocurrency;bitcoin" {%if obj_type=="cryptocurrency;bitcoin"%}selected{%endif%}>Cryptocurrency - Bitcoin</option>
|
<option value="cryptocurrency;bitcoin" {%if obj_type=="cryptocurrency" and obj_subtype=="bitcoin"%}selected{%endif%}>Cryptocurrency - Bitcoin</option>
|
||||||
<option value="cryptocurrency;bitcoin-cash" {%if obj_type=="cryptocurrency;bitcoin-cash"%}selected{%endif%}>Cryptocurrency - Bitcoin Cash</option>
|
<option value="cryptocurrency;bitcoin-cash" {%if obj_type=="cryptocurrency" and obj_subtype=="bitcoin-cash"%}selected{%endif%}>Cryptocurrency - Bitcoin Cash</option>
|
||||||
<option value="cryptocurrency;dash" {%if obj_type=="cryptocurrency;dash"%}selected{%endif%}>Cryptocurrency - Dash</option>
|
<option value="cryptocurrency;dash" {%if obj_type=="cryptocurrency" and obj_subtype=="dash"%}selected{%endif%}>Cryptocurrency - Dash</option>
|
||||||
<option value="cryptocurrency;etherum" {%if obj_type=="cryptocurrency;etherum"%}selected{%endif%}>Cryptocurrency - Etherum</option>
|
<option value="cryptocurrency;etherum" {%if obj_type=="cryptocurrency" and obj_subtype=="etherum"%}selected{%endif%}>Cryptocurrency - Etherum</option>
|
||||||
<option value="cryptocurrency;litecoin" {%if obj_type=="cryptocurrency;litecoin"%}selected{%endif%}>Cryptocurrency - Litecoin</option>
|
<option value="cryptocurrency;litecoin" {%if obj_type=="cryptocurrency" and obj_subtype=="litecoin"%}selected{%endif%}>Cryptocurrency - Litecoin</option>
|
||||||
<option value="cryptocurrency;monero" {%if obj_type=="cryptocurrency;monero"%}selected{%endif%}>Cryptocurrency - Monero</option>
|
<option value="cryptocurrency;monero" {%if obj_type=="cryptocurrency" and obj_subtype=="monero"%}selected{%endif%}>Cryptocurrency - Monero</option>
|
||||||
<option value="cryptocurrency;zcash" {%if obj_type=="cryptocurrency;zcash"%}selected{%endif%}>Cryptocurrency - Zcash</option>
|
<option value="cryptocurrency;zcash" {%if obj_type=="cryptocurrency" and obj_subtype=="zcash"%}selected{%endif%}>Cryptocurrency - Zcash</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="text" class="form-control col-8 {%if obj_error%}is-invalid{%else%}is-valid{%endif%}" name="{{input_uuid}}" value="{{obj_id}}">
|
<input type="text" class="form-control col-8 {%if obj_error%}is-invalid{%else%}is-valid{%endif%}" name="{{input_uuid}}" value="{{obj_id}}">
|
||||||
<input class="form-control col-1" type="number" min="0" name="{{input_uuid}}" {%if obj_lvl%}value="{{obj_lvl}}"{%else%}value="0"{%endif%}>
|
<input class="form-control col-1" type="number" min="0" name="{{input_uuid}}" {%if obj_lvl%}value="{{obj_lvl}}"{%else%}value="0"{%endif%}>
|
||||||
|
@ -26,7 +26,8 @@
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{%if obj_type=="Object type..."%}
|
{%if obj_type=="Object type..."%}
|
||||||
Please select an object type.
|
Please select an object type.
|
||||||
|
{%else%}
|
||||||
|
Unknow or Invalid ID.
|
||||||
{%endif%}
|
{%endif%}
|
||||||
Unknow or Invalid ID.
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
<span class="btn btn-info input-group-addon add-field col-1"><i class="fas fa-plus"></i></span>
|
<span class="btn btn-info input-group-addon add-field col-1"><i class="fas fa-plus"></i></span>
|
||||||
</div>
|
</div>
|
||||||
{% for obj_dict in l_obj_to_export %}
|
{% for obj_dict in l_obj_to_export %}
|
||||||
{% with obj_type=obj_dict['type'], obj_id=obj_dict['id'], obj_lvl=obj_dict['lvl'], input_uuid=obj_dict, obj_error=False%}
|
{% with obj_type=obj_dict['type'], obj_subtype=obj_dict.get('subtype', None), obj_id=obj_dict['id'], obj_lvl=obj_dict['lvl'], input_uuid=obj_dict, obj_error=False%}
|
||||||
{% include 'import_export/block_to_export_input.html' %}
|
{% include 'import_export/block_to_export_input.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
{% for obj_dict in l_obj_invalid %}
|
{% for obj_dict in l_obj_invalid %}
|
||||||
{% with obj_type=obj_dict['type'], obj_id=obj_dict['id'], obj_lvl=obj_dict['lvl'], input_uuid=obj_dict['uuid'], obj_error=True%}
|
{% with obj_type=obj_dict['type'], obj_subtype=obj_dict.get('subtype', None), obj_id=obj_dict['id'], obj_lvl=obj_dict['lvl'], input_uuid=obj_dict['uuid'], obj_error=True%}
|
||||||
{% include 'import_export/block_to_export_input.html' %}
|
{% include 'import_export/block_to_export_input.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in New Issue