Skip to content

Commit

Permalink
Added support for JSON containing multuple events
Browse files Browse the repository at this point in the history
  • Loading branch information
tim427 committed Dec 11, 2024
1 parent a486071 commit 209024c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion intelmq/bots/parsers/json/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@
from intelmq.lib.bot import ParserBot
from intelmq.lib.message import MessageFactory
from intelmq.lib.utils import base64_decode
import json


class JSONParserBot(ParserBot):
"""Parse IntelMQ-JSON data"""
splitlines = False
multiple_events = False

def process(self):
report = self.receive_message()
if self.splitlines:
if self.multiple_events:
lines = [json.dumps(event) for event in json.loads(base64_decode(report['raw']))]
elif self.splitlines:
lines = base64_decode(report['raw']).splitlines()
else:
lines = [base64_decode(report['raw'])]
Expand Down

0 comments on commit 209024c

Please sign in to comment.