-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #714 from DomainTools/DT-config_clean_up
DomainToolsIris config cleanup
- Loading branch information
Showing
7 changed files
with
128 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
responders/DomainToolsIris_AddRiskyDNSTag/DomainToolsIris_AddRiskyDNSTag.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "DomainToolsIris_AddRiskyDNSTag", | ||
"version": "1.0", | ||
"author": "DomainTools", | ||
"url": "https://github.com/TheHive-Project/Cortex-Analyzers", | ||
"license": "AGPL-V3", | ||
"description": "Add Tag saying that the case contains a risky DNS.", | ||
"dataTypeList": ["thehive:case_artifact"], | ||
"command": "DomainToolsIris_AddRiskyDNSTag/domaintoolsiris_responder.py", | ||
"baseConfig": "DomainToolsIris", | ||
"configurationItems": [ | ||
{ | ||
"name": "high_risk_threshold", | ||
"description": "Risk score threshold to be considered high risk.", | ||
"type": "number", | ||
"multi": false, | ||
"required": false, | ||
"defaultValue": 70 | ||
} | ||
] | ||
} |
41 changes: 41 additions & 0 deletions
41
responders/DomainToolsIris_AddRiskyDNSTag/domaintoolsiris_responder.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
# encoding: utf-8 | ||
|
||
|
||
from cortexutils.responder import Responder | ||
|
||
|
||
class DomainToolsIris(Responder): | ||
def __init__(self): | ||
Responder.__init__(self) | ||
|
||
def run(self): | ||
Responder.run(self) | ||
if self.get_param("data.dataType") == "domain": | ||
self.report({"data": self.get_data()}) | ||
else: | ||
self.report({"data": 'Can only operate on "domain" observables'}) | ||
|
||
def operations(self, raw): | ||
build_list = [] | ||
taxonomies = ( | ||
raw.get("data", {}) | ||
.get("reports", {}) | ||
.get("DomainToolsIris_Investigate_1_0", {}) | ||
.get("taxonomies", None) | ||
) | ||
|
||
for x in taxonomies: | ||
if x["predicate"] == "Risk Score": | ||
if int(x["value"]) > int(self.get_param("config.high_risk_threshold")): | ||
build_list.append( | ||
self.build_operation("AddTagToCase", tag="DT:Risky DNS") | ||
) | ||
build_list.append( | ||
self.build_operation("AddTagToArtifact", tag="DT:Risky DNS") | ||
) | ||
return build_list | ||
|
||
|
||
if __name__ == "__main__": | ||
DomainToolsIris().run() |
Empty file.
20 changes: 20 additions & 0 deletions
20
responders/DomainToolsIris_CheckMaliciousTags/DomainToolsIris_CheckMaliciousTags.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "DomainToolsIris_CheckMaliciousTags", | ||
"version": "1.0", | ||
"author": "DomainTools", | ||
"url": "https://github.com/TheHive-Project/Cortex-Analyzers", | ||
"license": "AGPL-V3", | ||
"description": "Add Tag saying that the observable and case have a malicious tag in their Iris Tags.", | ||
"dataTypeList": ["thehive:case_artifact"], | ||
"command": "DomainToolsIris_CheckMaliciousTags/domaintoolsiris_responder.py", | ||
"baseConfig": "DomainToolsIris", | ||
"configurationItems": [ | ||
{ | ||
"name": "monitored_iris_tags", | ||
"description": "Monitored Iris tags.", | ||
"type": "string", | ||
"multi": true, | ||
"required": false | ||
} | ||
] | ||
} |
46 changes: 46 additions & 0 deletions
46
responders/DomainToolsIris_CheckMaliciousTags/domaintoolsiris_responder.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
# encoding: utf-8 | ||
|
||
|
||
from cortexutils.responder import Responder | ||
|
||
|
||
class DomainToolsIris(Responder): | ||
def __init__(self): | ||
Responder.__init__(self) | ||
|
||
def run(self): | ||
Responder.run(self) | ||
if self.get_param("data.dataType") == "domain": | ||
self.report({"data": self.get_data()}) | ||
else: | ||
self.report({"data": 'Can only operate on "domain" observables'}) | ||
|
||
def operations(self, raw): | ||
build_list = [] | ||
taxonomies = ( | ||
raw.get("data", {}) | ||
.get("reports", {}) | ||
.get("DomainToolsIris_Investigate_1_0", {}) | ||
.get("taxonomies", None) | ||
) | ||
|
||
for x in taxonomies: | ||
if x["predicate"] == "IrisTags": | ||
malicious_tags_set = set(self.get_param("config.monitored_iris_tags")) | ||
domain_tags_set = set(x["value"].split(",")) | ||
|
||
if len(malicious_tags_set.intersection(domain_tags_set)): | ||
build_list.append( | ||
self.build_operation( | ||
"AddTagToArtifact", tag="DT:Malicious Domain" | ||
) | ||
) | ||
build_list.append( | ||
self.build_operation("AddTagToCase", tag="DT:Malicious Domain") | ||
) | ||
return build_list | ||
|
||
|
||
if __name__ == "__main__": | ||
DomainToolsIris().run() |
Empty file.