-
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 branch 'develop' of https://github.com/CERT-BDF/Cortex-Analyzers …
…into develop
- Loading branch information
Showing
232 changed files
with
2,947 additions
and
542 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
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 |
---|---|---|
|
@@ -5,3 +5,5 @@ thehive-templates/*.sh | |
|
||
.idea | ||
.DS_Store | ||
|
||
Cortex-analyzers.iml |
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
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
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,12 @@ | ||
{ | ||
"name": "CERTatPassiveDNS", | ||
"author": "Nils Kuhnert, CERT-Bund", | ||
"license": "AGPL-V3", | ||
"url": "https://github.com/BSI-CERT-Bund/cortex-analyzers", | ||
"version": "2.0", | ||
"baseConfig": "CERTatPassiveDNS", | ||
"config": {}, | ||
"description": "Checks CERT.at Passive DNS for a given domain, API Key via cert.at.", | ||
"dataTypeList": ["domain", "fqdn"], | ||
"command": "CERTatPassiveDNS/certat_passivedns.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,37 @@ | ||
#!/usr/bin/env python3 | ||
from cortexutils.analyzer import Analyzer | ||
from whois_wrapper import query | ||
|
||
|
||
class CERTatPassiveDNSAnalyzer(Analyzer): | ||
"""Very simple passive dns wrapper for pdns.cert.at. Needs no credentials because access is controlled through | ||
firewall rules. If you want to get access, you have to contact CERT.AT, but: | ||
CERT.AT pDNS is not a public service. It is only available for national / governmental CERTs in good standing with | ||
CERT.AT. For access, you have to get in contact with CERT.AT. | ||
""" | ||
def __init__(self): | ||
Analyzer.__init__(self) | ||
self.limit = self.get_param('config.limit', '100') | ||
|
||
def run(self): | ||
self.report({'results': query(self.getData(), int(self.limit))}) | ||
|
||
def summary(self, raw): | ||
taxonomies = [] | ||
level = "info" | ||
namespace = "CERT.at" | ||
predicate = "PassiveDNS" | ||
|
||
results = raw.get('results') | ||
r = len(results) | ||
if r == 0 or r == 1: | ||
value = "\"{} hit\"".format(r) | ||
else: | ||
value = "\"{} hits\"".format(r) | ||
|
||
taxonomies.append(self.build_taxonomy(level, namespace, predicate, value)) | ||
return {"taxonomies": taxonomies} | ||
|
||
if __name__ == '__main__': | ||
CERTatPassiveDNSAnalyzer().run() |
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 @@ | ||
cortexutils |
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,2 @@ | ||
#!/usr/bin/env bash | ||
whois -h pdns.cert.at " $1" |
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,55 @@ | ||
#!/usr/bin/env python3 | ||
from re import findall | ||
from subprocess import check_output | ||
|
||
|
||
def __query(domain, limit=100): | ||
"""Using the shell script to query pdns.cert.at is a hack, but python raises an error every time using subprocess | ||
functions to call whois. So this hack is avoiding calling whois directly. Ugly, but works. | ||
:param domain: The domain pdns is queried with. | ||
:type domain: str | ||
:param limit: Maximum number of results | ||
:type limit: int | ||
:returns: str -- Console output from whois call. | ||
:rtype: str | ||
""" | ||
s = check_output(['./whois.sh', '--limit {} {}'.format(limit, domain)], universal_newlines=True) | ||
return s | ||
|
||
|
||
def __process_results(results): | ||
"""Processes the result from __query to get valid json from every entry. | ||
:param results: Results from __query | ||
:type results: str | ||
:returns: python list of dictionaries containing the relevant results. | ||
:rtype: list | ||
""" | ||
result_list = [] | ||
|
||
# Splts the result and cuts first and last dataset which are comments | ||
split = results.split(sep='\n\n')[1:-1] | ||
|
||
for entry in split: | ||
entry_dict = {} | ||
for value in entry.split('\n'): | ||
if len(value) < 1: | ||
continue | ||
(desc, val) = value.split(': ') | ||
entry_dict[desc.replace('-', '')] = val.strip(' ') | ||
result_list.append(entry_dict) | ||
return result_list | ||
|
||
|
||
def query(domain: str, limit: int=100): | ||
"""Queries and returns a python dict with results. | ||
:param domain: domain that should be queried | ||
:type domain: str | ||
:param limit: number of entries to return | ||
:type limit: int | ||
:returns: query results | ||
:rtype: list | ||
""" | ||
return __process_results(__query(domain, limit)) |
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
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
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
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
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,16 @@ | ||
{ | ||
"name": "CuckooSandbox_File_Analysis_Inet", | ||
"version": "1.0", | ||
"author": "Andrea Garavaglia, LDO-CERT", | ||
"url": "https://github.com/garanews/Cortex-Analyzers", | ||
"license": "AGPL-V3", | ||
"baseConfig": "CuckooSandbox", | ||
"config": { | ||
"check_tlp": true, | ||
"max_tlp":1, | ||
"service": "file_analysis" | ||
}, | ||
"description": "Cuckoo Sandbox file analysis with Internet access.", | ||
"dataTypeList": ["file"], | ||
"command": "CuckooSandbox/cuckoosandbox_analyzer.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,16 @@ | ||
{ | ||
"name": "CuckooSandbox_Url_Analysis", | ||
"version": "1.0", | ||
"author": "Andrea Garavaglia, LDO-CERT", | ||
"url": "https://github.com/garanews/Cortex-Analyzers", | ||
"license": "AGPL-V3", | ||
"baseConfig": "CuckooSandbox", | ||
"config": { | ||
"check_tlp": true, | ||
"max_tlp":1, | ||
"service": "url_analysis" | ||
}, | ||
"description": "Cuckoo Sandbox URL analysis.", | ||
"dataTypeList": ["url"], | ||
"command": "CuckooSandbox/cuckoosandbox_analyzer.py" | ||
} |
Oops, something went wrong.