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

Commit

Permalink
When possible usernames are found, add them to the PromiscKernel aler…
Browse files Browse the repository at this point in the history
…t summary (#1624)
  • Loading branch information
arcrose committed May 8, 2020
1 parent 68fbf17 commit e0008fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions alerts/plugins/possible_usernames.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def enrich(alert: dict, syslog_evts: types.List[dict]) -> dict:
new `details.possible_usernames` field.
'''

summary = alert.get('summary', '')

details = alert.get('details', {})

scan_results = [
Expand All @@ -94,6 +96,12 @@ def enrich(alert: dict, syslog_evts: types.List[dict]) -> dict:

alert['details'] = details

if len(possible_usernames) > 0:
alert['summary'] = '{}; Possible users: {}'.format(
summary,
', '.join(possible_usernames),
)

return alert


Expand Down
1 change: 1 addition & 0 deletions tests/alerts/plugins/test_possible_usernames.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def test_enrichment(self):
# Ensure possible users found and duplicates removed.
assert len(enriched['details']['possible_usernames']) == 1
assert enriched['details']['possible_usernames'][0] == 'tester1'
assert 'tester1' in enriched['summary']

def test_hostname_detection(self):
from alerts.plugins.possible_usernames import _most_common_hostname
Expand Down

0 comments on commit e0008fb

Please sign in to comment.