From 56cbd72b6526bf6b777cb62cea5f4be99b390463 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Sun, 28 Jan 2018 18:12:40 +0100 Subject: [PATCH] Fixed data treatment & other updates --- misp_modules/modules/import_mod/csvimport.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misp_modules/modules/import_mod/csvimport.py b/misp_modules/modules/import_mod/csvimport.py index e5ff3b0..4076902 100644 --- a/misp_modules/modules/import_mod/csvimport.py +++ b/misp_modules/modules/import_mod/csvimport.py @@ -47,7 +47,7 @@ def handler(q=False): def findDelimiter(header, data): n = len(header) if n > 1: - for d in (';', '|', '/', ','): + for d in (';', '|', '/', ',', ' '): if data[0].count(d) == (n-1): return d, n else: @@ -59,7 +59,7 @@ def buildAttributes(header, dataValues, delimiter, length): if delimiter is None: mispType = header[0] for data in dataValues: - attributes.append({'type': mispType, 'value': data}) + attributes.append({'type': mispType, 'value': data.strip()}) else: # split fields that should be recognized as misp attribute types from the others list2pop, misp, head = findMispTypes(header) @@ -107,7 +107,7 @@ def findMispTypes(header): else: head.append(h) # return list of indexes of the misp types, list of the misp types, remaining fields that will be attribute fields - return list2pop, misp, head + return list2pop, misp, list(reversed(head)) def introspection(): return mispattributes