From f900cb7c68837204714f85e2e3e6c9e04042c794 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 May 2019 22:28:19 +0200 Subject: [PATCH] fix: Fixed introspection fields for csvimport & goamlimport - Added format field for goaml so the module is known as returning MISP attributes & objects - Fixed introspection to make the format, user config and input source fields visible from MISP (format also added at the same time) --- misp_modules/modules/import_mod/csvimport.py | 15 ++------------- misp_modules/modules/import_mod/goamlimport.py | 3 ++- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/misp_modules/modules/import_mod/csvimport.py b/misp_modules/modules/import_mod/csvimport.py index 2eec1c6..bb86014 100644 --- a/misp_modules/modules/import_mod/csvimport.py +++ b/misp_modules/modules/import_mod/csvimport.py @@ -12,7 +12,6 @@ moduleinfo = {'version': '0.1', 'author': 'Christian Studer', 'description': 'Import Attributes from a csv file.', 'module-type': ['import']} moduleconfig = [] -inputSource = ['file'] userConfig = {'header': { 'type': 'String', 'message': 'Define the header of the csv file, with types (included in MISP attribute types or attribute fields) separated by commas.\nFor fields that do not match these types, please use space or simply nothing between commas.\nFor instance: ip-src,domain, ,timestamp'}, @@ -20,6 +19,7 @@ userConfig = {'header': { 'type': 'Boolean', 'message': 'Tick this box ONLY if there is a header line, NOT COMMENTED, in the file (which will be skipped atm).' }} +mispattributes = {'userConfig': userConfig, 'inputSource': ['file'], 'format': 'misp_standard'} duplicatedFields = {'mispType': {'mispComment': 'comment'}, 'attrField': {'attrComment': 'comment'}} @@ -224,18 +224,7 @@ def handler(q=False): def introspection(): - modulesetup = {} - try: - userConfig - modulesetup['userConfig'] = userConfig - except NameError: - pass - try: - inputSource - modulesetup['inputSource'] = inputSource - except NameError: - pass - return modulesetup + return mispattributes def version(): diff --git a/misp_modules/modules/import_mod/goamlimport.py b/misp_modules/modules/import_mod/goamlimport.py index 7116b44..add6470 100644 --- a/misp_modules/modules/import_mod/goamlimport.py +++ b/misp_modules/modules/import_mod/goamlimport.py @@ -9,7 +9,8 @@ moduleinfo = {'version': 1, 'author': 'Christian Studer', 'description': 'Import from GoAML', 'module-type': ['import']} moduleconfig = [] -mispattributes = {'inputSource': ['file'], 'output': ['MISP objects']} +mispattributes = {'inputSource': ['file'], 'output': ['MISP objects'], + 'format': 'misp_standard'} t_from_objects = {'nodes': ['from_person', 'from_account', 'from_entity'], 'leaves': ['from_funds_code', 'from_country']}