chg: Add search info field with "\"

Related: https://github.com/MISP/MISP/issues/6616
pull/663/head
Raphaël Vinot 2020-11-19 14:54:48 +01:00
parent 75a7774887
commit e317b089b8
1 changed files with 14 additions and 0 deletions

View File

@ -908,12 +908,26 @@ class TestComprehensive(unittest.TestCase):
self.assertIs(events[0].attributes[-1].malware_binary, None) self.assertIs(events[0].attributes[-1].malware_binary, None)
# Search index # Search index
# # Timestamp
events = self.user_misp_connector.search_index(timestamp=first.timestamp.timestamp(), events = self.user_misp_connector.search_index(timestamp=first.timestamp.timestamp(),
pythonify=True) pythonify=True)
self.assertEqual(len(events), 1) self.assertEqual(len(events), 1)
self.assertEqual(events[0].info, 'foo bar blah') self.assertEqual(events[0].info, 'foo bar blah')
self.assertEqual(events[0].attributes, []) self.assertEqual(events[0].attributes, [])
# # Info
complex_info = r'C:\Windows\System32\notepad.exe'
e = events[0]
e.info = complex_info
e = self.user_misp_connector.update_event(e, pythonify=True)
# Issue: https://github.com/MISP/MISP/issues/6616
complex_info_search = r'C:\\Windows\\System32\\notepad.exe'
events = self.user_misp_connector.search_index(eventinfo=complex_info_search,
pythonify=True)
self.assertEqual(len(events), 1)
self.assertEqual(events[0].info, complex_info)
self.assertEqual(events[0].attributes, [])
# Contact reporter # Contact reporter
r = self.user_misp_connector.contact_event_reporter(events[0].id, 'This is a test') r = self.user_misp_connector.contact_event_reporter(events[0].id, 'This is a test')
self.assertEqual(r['message'], 'Email sent to the reporter.') self.assertEqual(r['message'], 'Email sent to the reporter.')