Skip to content

Commit

Permalink
Modify mozdefbot to handle events without _source
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnbus committed Dec 23, 2019
1 parent 089d415 commit 2bdffb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion bot/irc/mozdefbot.py
Expand Up @@ -303,7 +303,10 @@ def on_message(self, body, message):
"alertworker exception: unknown body type received %r" % body)
return

body_dict = full_body['_source']
body_dict = full_body
# Handle messages that have full ES dict
if '_source' in full_body:
body_dict = full_body['_source']

if 'notify_mozdefbot' in body_dict and body_dict['notify_mozdefbot'] is False:
# If the alert tells us to not notify, then don't post to IRC
Expand Down
6 changes: 5 additions & 1 deletion bot/slack/mozdefbot.py
Expand Up @@ -59,7 +59,11 @@ def on_message(self, body, message):
else:
logger.exception("mozdefbot_slack exception: unknown body type received %r" % body)
return
body_dict = full_body['_source']

body_dict = full_body
# Handle messages that have full ES dict
if '_source' in full_body:
body_dict = full_body['_source']

if 'notify_mozdefbot' in body_dict and body_dict['notify_mozdefbot'] is False:
# If the alert tells us to not notify, then don't post message
Expand Down

0 comments on commit 2bdffb9

Please sign in to comment.