Skip to content

Commit 29e681e

Browse files
committed
add: Parsing processes called by the file analyzed in the joe sandbox report
1 parent d39fb7d commit 29e681e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

misp_modules/modules/import_mod/joe_import.py

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from collections import defaultdict
3+
from datetime import datetime
34
from pymisp import MISPEvent, MISPObject
45
import json
56
import base64
@@ -25,6 +26,9 @@
2526
'LegalCopyright': 'legal-copyright', 'OriginalFilename': 'original-filename',
2627
'ProductName': 'product-filename', 'ProductVersion': 'product-version',
2728
'Translation': 'lang-id'}
29+
process_object_fields = {'cmdline': 'command-line', 'name': 'name',
30+
'parentpid': 'parent-pid', 'pid': 'pid',
31+
'path': 'current-directory'}
2832
section_object_mapping = {'characteristics': ('text', 'characteristic'),
2933
'entropy': ('float', 'entropy'),
3034
'name': ('text', 'name'), 'rawaddr': ('hex', 'offset'),
@@ -43,6 +47,7 @@ def __init__(self, data):
4347

4448
def parse_joe(self):
4549
self.parse_fileinfo()
50+
self.parse_behavior()
4651
if self.references:
4752
self.build_references()
4853
self.finalize_results()
@@ -54,6 +59,24 @@ def build_references(self):
5459
for reference in self.references[object_uuid]:
5560
misp_object.add_reference(reference['idref'], reference['relationship'])
5661

62+
def parse_behavior(self):
63+
self.parse_behavior_system()
64+
self.parse_behavior_network()
65+
66+
def parse_behavior_network(self):
67+
network = self.data['behavior']['network']
68+
69+
def parse_behavior_system(self):
70+
processes = self.data['behavior']['system']['processes']['process'][0]
71+
general = processes['general']
72+
process_object = MISPObject('process')
73+
for feature, relation in process_object_fields.items():
74+
process_object.add_attribute(relation, **{'type': 'text', 'value': general[feature]})
75+
start_time = datetime.strptime('{} {}'.format(general['date'], general['time']), '%d/%m/%Y %H:%M:%S')
76+
process_object.add_attribute('start-time', **{'type': 'datetime', 'value': start_time})
77+
self.misp_event.add_object(**process_object)
78+
self.references[self.fileinfo_uuid].append({'idref': process_object.uuid, 'relationship': 'calls'})
79+
5780
def parse_fileinfo(self):
5881
fileinfo = self.data['fileinfo']
5982
file_object = MISPObject('file')

0 commit comments

Comments
 (0)