Skip to content

Commit 9e0e948

Browse files
tim427sebix
authored andcommitted
Added support for JSON containing multuple events
1 parent 9c71a9c commit 9e0e948

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

intelmq/bots/parsers/json/parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@
1212
from intelmq.lib.bot import ParserBot
1313
from intelmq.lib.message import MessageFactory
1414
from intelmq.lib.utils import base64_decode
15+
import json
1516

1617

1718
class JSONParserBot(ParserBot):
1819
"""Parse IntelMQ-JSON data"""
1920
splitlines = False
21+
multiple_events = False
2022

2123
def process(self):
2224
report = self.receive_message()
23-
if self.splitlines:
25+
if self.multiple_events:
26+
lines = [json.dumps(event) for event in json.loads(base64_decode(report['raw']))]
27+
elif self.splitlines:
2428
lines = base64_decode(report['raw']).splitlines()
2529
else:
2630
lines = [base64_decode(report['raw'])]

0 commit comments

Comments
 (0)