Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
moving plugins into mozdef data class (#1659)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phrozyn committed Jul 16, 2020
1 parent 08b0ae2 commit d1b66ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions mozdef_util/mozdef_util/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def add_required_fields(self):
self['source'] = self.DEFAULT_STRING
if 'summary' not in self:
self['summary'] = self.DEFAULT_STRING
if 'plugins' not in self:
self['plugins'] = []
if 'mozdef' not in self:
self['mozdef'] = {}
if 'plugins' not in self['mozdef']:
self['mozdef']['plugins'] = []
if 'details' not in self:
self['details'] = {}
4 changes: 3 additions & 1 deletion mq/lib/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def sendEventToPlugins(anevent, metadata, pluginList):
plugin_name = plugin[0].__module__.replace('plugins.', '')
executed_plugins.append(plugin_name)
# Tag all events with what plugins ran on it
anevent['plugins'] = executed_plugins
if 'mozdef' not in anevent:
anevent['mozdef'] = {}
anevent['mozdef']['plugins'] = executed_plugins

return (anevent, metadata)

Expand Down
2 changes: 1 addition & 1 deletion tests/mq/test_esworker_sns_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_syslog_event(self):
'tags': ['example-logs-mozdef'],
'timestamp': '2017-05-25T07:14:15+00:00',
'utctimestamp': '2017-05-25T07:14:15+00:00',
'plugins': [],
'mozdef': {'plugins': []},
'type': 'event'
}
self.search_and_verify_event(expected_event)

0 comments on commit d1b66ec

Please sign in to comment.