mirror of https://github.com/MISP/misp-modules
fix: [ods_enrich] Try to fix reading bytesio
parent
2842b27c50
commit
907ac1e935
|
@ -36,7 +36,7 @@ def handler(q=False):
|
||||||
num_sheets = len(doc.sheets)
|
num_sheets = len(doc.sheets)
|
||||||
try:
|
try:
|
||||||
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.algo.read_data(pandas_ods_reader.parsers.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)
|
||||||
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}]}
|
||||||
|
|
|
@ -304,7 +304,7 @@ class TestExpansions(unittest.TestCase):
|
||||||
encoded = b64encode(f.read()).decode()
|
encoded = b64encode(f.read()).decode()
|
||||||
query = {"module": "ods_enrich", "attachment": filename, "data": encoded}
|
query = {"module": "ods_enrich", "attachment": filename, "data": encoded}
|
||||||
response = self.misp_modules_post(query)
|
response = self.misp_modules_post(query)
|
||||||
self.assertEqual(self.get_values(response), '\n column_0\n0 ods test')
|
self.assertEqual(self.get_values(response), '\n column.0\n0 ods test')
|
||||||
|
|
||||||
def test_odt(self):
|
def test_odt(self):
|
||||||
filename = 'test.odt'
|
filename = 'test.odt'
|
||||||
|
|
Loading…
Reference in New Issue