mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 00:28:22 +00:00
chg: [misp export] add username
This commit is contained in:
parent
7470792902
commit
c2281828d1
4 changed files with 37 additions and 2 deletions
|
@ -17,6 +17,8 @@ import Decoded
|
|||
import Domain
|
||||
import Screenshot
|
||||
|
||||
import Username
|
||||
|
||||
import Correlate_object
|
||||
|
||||
import AILObjects
|
||||
|
@ -181,6 +183,28 @@ def export_pgp(pgp_type, pgp_value):
|
|||
l_obj_attr.append( obj.add_attribute('user-id-email', value=pgp_value) )
|
||||
return obj
|
||||
|
||||
def export_username(username_type, username):
|
||||
dict_metadata = Username.correlation.get_metadata(username_type, username)
|
||||
|
||||
obj_attrs = []
|
||||
if username_type == 'telegram':
|
||||
obj = MISPObject('telegram-account', standalone=True)
|
||||
obj_attrs.append( obj.add_attribute('username', value=username) )
|
||||
|
||||
elif username_type == 'twitter':
|
||||
obj = MISPObject('twitter-account', standalone=True)
|
||||
obj_attrs.append( obj.add_attribute('name', value=username) )
|
||||
|
||||
else:
|
||||
obj = MISPObject('user-account', standalone=True)
|
||||
obj_attrs.append( obj.add_attribute('username', value=username) )
|
||||
|
||||
obj.first_seen = dict_metadata['first_seen']
|
||||
obj.last_seen = dict_metadata['last_seen']
|
||||
# for obj_attr in obj_attrs:
|
||||
# for tag in self.get_tags():
|
||||
# obj_attr.add_tag(tag)
|
||||
return obj
|
||||
|
||||
# filter objects to export, export only object who correlect which each other
|
||||
def filter_obj_linked(l_obj):
|
||||
|
@ -214,7 +238,7 @@ def add_obj_to_create_by_lvl(all_obj_to_export, set_relationship, dict_obj, lvl)
|
|||
obj_correlations = Correlate_object.get_object_correlation(dict_obj['type'], dict_obj['id'], requested_correl_type=dict_obj.get('subtype', None))
|
||||
for obj_type in obj_correlations:
|
||||
dict_new_obj = {'type': obj_type}
|
||||
if obj_type=='pgp' or obj_type=='cryptocurrency':
|
||||
if obj_type=='pgp' or obj_type=='cryptocurrency' or obj_type=='username':
|
||||
for subtype in obj_correlations[obj_type]:
|
||||
dict_new_obj['subtype'] = subtype
|
||||
for obj_id in obj_correlations[obj_type][subtype]:
|
||||
|
@ -283,6 +307,9 @@ def create_misp_obj(obj_type, obj_id):
|
|||
elif obj_type == 'pgp':
|
||||
obj_subtype, obj_id = obj_id.split(':', 1)
|
||||
return export_pgp(obj_subtype, obj_id)
|
||||
elif obj_type == 'username':
|
||||
obj_subtype, obj_id = obj_id.split(':', 1)
|
||||
return export_username(obj_subtype, obj_id)
|
||||
elif obj_type == 'domain':
|
||||
return export_domain(obj_id)
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
<div class="card-header">
|
||||
<i class="fas fa-project-diagram"></i> Graph
|
||||
<span class="float-right">
|
||||
{% if dict_object["object_type"] != "username" %}
|
||||
{% if dict_object["object_type"] != "" %}
|
||||
{% with obj_type=dict_object["object_type"], obj_id=dict_object["correlation_id"], obj_subtype=dict_object["metadata"]["type_id"],obj_lvl=1%}
|
||||
{% include 'import_export/block_add_user_object_to_export.html' %}
|
||||
{% endwith %}
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
<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>
|
||||
|
||||
<option value="username;telegram" {%if obj_type=="username" and obj_subtype=="telegram"%}selected{%endif%}>Username - telegram</option>
|
||||
<option value="username;twitter" {%if obj_type=="username" and obj_subtype=="twitter"%}selected{%endif%}>Username - twitter</option>
|
||||
<option value="username;jabber" {%if obj_type=="username" and obj_subtype=="jabber"%}selected{%endif%}>Username - jabber</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%}>
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
<option value="cryptocurrency;litecoin">Cryptocurrency - Litecoin</option>
|
||||
<option value="cryptocurrency;monero">Cryptocurrency - Monero</option>
|
||||
<option value="cryptocurrency;zcash">Cryptocurrency - Zcash</option>
|
||||
<option value="username;telegram">Username - telegram</option>
|
||||
<option value="username;twitter">Username - twitter</option>
|
||||
<option value="username;jabber">Username - jabber</option>
|
||||
</select>
|
||||
<input type="text" class="form-control col-8" name="first_obj_to_export" id="obj_input_id">
|
||||
<input class="form-control col-1" type="number" min="0" value="0" name="first_obj_to_export" id="obj_input_lvl">
|
||||
|
|
Loading…
Reference in a new issue