-
Notifications
You must be signed in to change notification settings - Fork 393
Minor updates to alarms #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ def __init__(self): | |
| def run(self): | ||
| ret = initial_alarm_result | ||
| ret['info'] = info | ||
| ret['fields'] = ['@timestamp', 'host.name', 'user.name', 'ioc.type', 'file.name', 'file.hash.md5', 'ioc.domain', 'c2.message', 'alarm.alarm_filehash'] | ||
| ret['fields'] = ['agent.hostname','@timestamp', 'host.name', 'user.name', 'ioc.type', 'file.name', 'file.hash.md5', 'ioc.domain', 'c2.message', 'alarm.alarm_filehash'] | ||
| ret['groupby'] = [] | ||
| self.logger.debug('Running dummy alarm') | ||
| for r in self.alarm_dummy(): | ||
|
|
@@ -40,7 +40,7 @@ def run(self): | |
| return(ret) | ||
|
|
||
| def alarm_dummy(self): | ||
| q = "c2.log.type:ioc AND NOT tags:%s"%(info['submodule']) | ||
| q = "c2.log.type:ioc AND NOT tags:alarm_*" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep the submodule name so it will alert for everything that has not been alerted by
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense. |
||
| report = {} | ||
| report['alarm'] = False | ||
| report['fname'] = "alarm_check2" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ def __init__(self): | |
| def run(self): | ||
| ret = initial_alarm_result | ||
| ret['info'] = info | ||
| ret['fields'] = ['source.ip', 'source.nat.ip', 'source.geo.country_name', 'source.as.organization.name', 'redir.frontend.name', 'redir.backend.name', 'infra.attack_scenario', 'tags', 'redir.timestamp'] | ||
| ret['fields'] = ['agent.hostname','source.ip', 'source.nat.ip', 'source.geo.country_name', 'source.as.organization.name', 'redir.frontend.name', 'redir.backend.name', 'infra.attack_scenario', 'tags', 'redir.timestamp'] | ||
| ret['groupby'] = ['source.ip'] | ||
| try: | ||
| report = self.alarm_check() | ||
|
|
@@ -45,7 +45,7 @@ def run(self): | |
|
|
||
| def alarm_check(self): | ||
| # This check queries for IP's that aren't listed in any iplist* but do talk to c2* paths on redirectors\n | ||
| q = "NOT tags:iplist_* AND redir.backend.name:c2* AND tags:enriched_* AND NOT tags:%s"%(info['submodule']) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be self.info and not info, that's the bug I think
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. info is fine, the dict is global. |
||
| q = "NOT tags:iplist_* AND redir.backend.name:c2* AND NOT tags:alarm_httptraffic AND tags:enriched_*" | ||
| i = countQuery(q) | ||
| if i >= 10000: | ||
| i = 10000 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,12 +23,13 @@ | |
| class Module(): | ||
| def __init__(self): | ||
| self.logger = logging.getLogger(info['submodule']) | ||
| #print("class init") | ||
| pass | ||
|
|
||
| def run(self): | ||
| ret = initial_alarm_result | ||
| ret['info'] = info | ||
| ret['fields'] = ['@timestamp','source.ip','http.headers.useragent','source.nat.ip','redir.frontend.name','redir.backend.name','infra.attack_scenario'] | ||
| ret['fields'] = ['agent.hostname','@timestamp','source.ip','http.headers.useragent','source.nat.ip','redir.frontend.name','redir.backend.name','infra.attack_scenario'] | ||
| ret['groupby'] = ['source.ip','http.headers.useragent'] | ||
| try: | ||
| report = self.alarm_check() | ||
|
|
@@ -65,7 +66,7 @@ def alarm_check(self): | |
| qSub = qSub + " OR http.headers.useragent:%s" % keyword | ||
| qSub = qSub + ") " | ||
| #q = "%s AND redir.backendname:c2* AND tags:enrich_* AND NOT tags:alarm_* "%qSub | ||
| q = "%s AND redir.backend.name:c2* AND NOT tags:%s"%(qSub,info['submodule']) | ||
| q = "%s AND redir.backend.name:c2* AND NOT tags:alarm_useragent" % qSub | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true, likely has to be self.info as mentioned in some other item. |
||
| i = countQuery(q) | ||
| if i >= 10000: | ||
| i = 10000 | ||
|
|
||
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a loglevel variable in the config, so we can have more than just info and debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarcOverIP this still needs to be addressed before merging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree. let's implant a config.DEBUGLEVEL
This was just a quick fix to avoid disk from filling 100% in days