Merge branch 'master' into crawler_manager

This commit is contained in:
Terrtia 2021-03-08 16:35:22 +01:00
commit 25d3cbacde
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
4 changed files with 17 additions and 17 deletions

View file

@ -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)
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))
for global_id in res:
dict_obj = Correlate_object.get_global_id_from_id(global_id)
dict_obj['lvl'] = int(res[global_id])
if add_uuid:
obj_dict['uuid'] = str(uuid.uuid4())
set_objs_to_export.append(dict_obj)
return set_objs_to_export
objs_to_export.append(dict_obj)
return objs_to_export
def add_user_object_to_export(user_id, obj_type, obj_id, lvl, obj_subtype=None):
## TODO: check if user exist

View file

@ -83,7 +83,6 @@ def import_object_file():
@login_analyst
def export_object():
user_id = current_user.get_id()
l_obj_to_export = set()
# get user saved obj to export
l_obj_to_export = AILObjects.get_user_list_of_obj_to_export(user_id)

View file

@ -9,16 +9,16 @@
<option value="domain" {%if obj_type=="domain"%}selected{%endif%}>Domain</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="pgp;key" {%if obj_type=="pgp;key"%}selected{%endif%}>PGP - Key</option>
<option value="pgp;name" {%if obj_type=="pgp;name"%}selected{%endif%}>PGP - Name</option>
<option value="pgp;mail" {%if obj_type=="pgp;mail"%}selected{%endif%}>PGP - Mail</option>
<option value="cryptocurrency;bitcoin" {%if obj_type=="cryptocurrency;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;dash" {%if obj_type=="cryptocurrency;dash"%}selected{%endif%}>Cryptocurrency - Dash</option>
<option value="cryptocurrency;etherum" {%if obj_type=="cryptocurrency;etherum"%}selected{%endif%}>Cryptocurrency - Etherum</option>
<option value="cryptocurrency;litecoin" {%if obj_type=="cryptocurrency;litecoin"%}selected{%endif%}>Cryptocurrency - Litecoin</option>
<option value="cryptocurrency;monero" {%if obj_type=="cryptocurrency;monero"%}selected{%endif%}>Cryptocurrency - Monero</option>
<option value="cryptocurrency;zcash" {%if obj_type=="cryptocurrency;zcash"%}selected{%endif%}>Cryptocurrency - Zcash</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" and obj_subtype=="name"%}selected{%endif%}>PGP - Name</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" and obj_subtype=="bitcoin"%}selected{%endif%}>Cryptocurrency - Bitcoin</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" and obj_subtype=="dash"%}selected{%endif%}>Cryptocurrency - Dash</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" and obj_subtype=="litecoin"%}selected{%endif%}>Cryptocurrency - Litecoin</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" and obj_subtype=="zcash"%}selected{%endif%}>Cryptocurrency - Zcash</option>
</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 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">
{%if obj_type=="Object type..."%}
&nbsp;&nbsp;&nbsp; Please select an object type.
{%else%}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Unknow or Invalid ID.
{%endif%}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Unknow or Invalid ID.
</div>
</div>

View file

@ -73,7 +73,7 @@
<span class="btn btn-info input-group-addon add-field col-1"><i class="fas fa-plus"></i></span>
</div>
{% 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' %}
{% endwith %}
{% endfor %}
@ -81,7 +81,7 @@
<br>
{% 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' %}
{% endwith %}
{% endfor %}