mirror of https://github.com/MISP/misp-modules
fix: [ods_enrich] Better exception logging
parent
c5801d1776
commit
3fe7072bfb
|
@ -4,6 +4,7 @@ import np
|
||||||
import ezodf
|
import ezodf
|
||||||
import pandas_ods_reader
|
import pandas_ods_reader
|
||||||
import io
|
import io
|
||||||
|
import logging
|
||||||
|
|
||||||
misperrors = {'error': 'Error'}
|
misperrors = {'error': 'Error'}
|
||||||
mispattributes = {'input': ['attachment'],
|
mispattributes = {'input': ['attachment'],
|
||||||
|
@ -37,11 +38,10 @@ def handler(q=False):
|
||||||
for i in range(0, num_sheets):
|
for i in range(0, num_sheets):
|
||||||
ods = pandas_ods_reader.read_ods(ods_file, i, headers=False)
|
ods = pandas_ods_reader.read_ods(ods_file, i, headers=False)
|
||||||
ods_content = ods_content + "\n" + ods.to_string(max_rows=None)
|
ods_content = ods_content + "\n" + ods.to_string(max_rows=None)
|
||||||
print(ods_content)
|
|
||||||
return {'results': [{'types': ['freetext'], 'values': ods_content, 'comment': ".ods-to-text from file " + filename},
|
return {'results': [{'types': ['freetext'], 'values': ods_content, 'comment': ".ods-to-text from file " + filename},
|
||||||
{'types': ['text'], 'values': ods_content, 'comment': ".ods-to-text from file " + filename}]}
|
{'types': ['text'], 'values': ods_content, 'comment': ".ods-to-text from file " + filename}]}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
logging.exception(e)
|
||||||
err = "Couldn't analyze file as .ods. Error was: " + str(e)
|
err = "Couldn't analyze file as .ods. Error was: " + str(e)
|
||||||
misperrors['error'] = err
|
misperrors['error'] = err
|
||||||
return misperrors
|
return misperrors
|
||||||
|
|
Loading…
Reference in New Issue