2019-05-08 16:52:49 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import base64
|
2019-05-29 03:26:14 +02:00
|
|
|
import json
|
|
|
|
from joe_parser import JoeParser
|
2019-05-08 16:52:49 +02:00
|
|
|
|
|
|
|
misperrors = {'error': 'Error'}
|
2020-01-24 14:51:10 +01:00
|
|
|
userConfig = {
|
2022-03-07 23:04:37 +01:00
|
|
|
"Import Executable": {
|
2020-01-24 14:51:10 +01:00
|
|
|
"type": "Boolean",
|
2022-03-07 23:04:37 +01:00
|
|
|
"message": "Import Executable Information (PE, elf or apk for instance)",
|
2020-01-24 14:51:10 +01:00
|
|
|
},
|
2020-01-24 15:17:35 +01:00
|
|
|
"Mitre Att&ck": {
|
2020-01-24 14:51:10 +01:00
|
|
|
"type": "Boolean",
|
|
|
|
"message": "Import Mitre Att&ck techniques",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-05-08 16:52:49 +02:00
|
|
|
inputSource = ['file']
|
|
|
|
|
2020-01-24 14:51:10 +01:00
|
|
|
moduleinfo = {'version': '0.2', 'author': 'Christian Studer',
|
2019-05-08 16:52:49 +02:00
|
|
|
'description': 'Import for Joe Sandbox JSON reports',
|
|
|
|
'module-type': ['import']}
|
|
|
|
|
|
|
|
moduleconfig = []
|
|
|
|
|
|
|
|
|
|
|
|
def handler(q=False):
|
|
|
|
if q is False:
|
|
|
|
return False
|
|
|
|
q = json.loads(q)
|
2020-01-24 14:51:10 +01:00
|
|
|
config = {
|
2022-03-07 23:04:37 +01:00
|
|
|
"import_executable": bool(int(q["config"]["Import Executable"])),
|
2020-01-24 14:51:10 +01:00
|
|
|
"mitre_attack": bool(int(q["config"]["Mitre Att&ck"])),
|
|
|
|
}
|
|
|
|
|
2019-05-08 16:52:49 +02:00
|
|
|
data = base64.b64decode(q.get('data')).decode('utf-8')
|
|
|
|
if not data:
|
|
|
|
return json.dumps({'success': 0})
|
2020-01-24 14:51:10 +01:00
|
|
|
|
|
|
|
joe_parser = JoeParser(config)
|
2019-06-03 10:35:58 +02:00
|
|
|
joe_parser.parse_data(json.loads(data)['analysis'])
|
|
|
|
joe_parser.finalize_results()
|
2019-05-08 16:52:49 +02:00
|
|
|
return {'results': joe_parser.results}
|
|
|
|
|
|
|
|
|
|
|
|
def introspection():
|
|
|
|
modulesetup = {}
|
|
|
|
try:
|
|
|
|
userConfig
|
|
|
|
modulesetup['userConfig'] = userConfig
|
|
|
|
except NameError:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
inputSource
|
|
|
|
modulesetup['inputSource'] = inputSource
|
|
|
|
except NameError:
|
|
|
|
pass
|
|
|
|
modulesetup['format'] = 'misp_standard'
|
|
|
|
return modulesetup
|
|
|
|
|
|
|
|
|
|
|
|
def version():
|
|
|
|
moduleinfo['config'] = moduleconfig
|
|
|
|
return moduleinfo
|