Skip to content

Commit 5a75d58

Browse files
ENH: ctip parser: better error message for bogous reports
reports must not be dropped silently if their format is unknown (can also happen because of misconfiguration)
1 parent b861ee9 commit 5a75d58

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

intelmq/bots/parsers/microsoft/parser_ctip.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,15 @@ class MicrosoftCTIPParserBot(ParserBot):
210210
def parse(self, report):
211211
raw_report = utils.base64_decode(report.get("raw"))
212212
if raw_report.startswith('['):
213+
# Interflow
213214
self.recover_line = self.recover_line_json
214215
yield from self.parse_json(report)
215216
elif raw_report.startswith('{'):
217+
# Azure
216218
self.recover_line = self.recover_line_json_stream
217219
yield from self.parse_json_stream(report)
220+
else:
221+
raise ValueError("Can't parse the received message. It is neither a JSON list nor a JSON dictionary. Please report this bug.")
218222

219223
def parse_line(self, line, report):
220224
if line.get('version', None) == 1.5:

0 commit comments

Comments
 (0)