-
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.
#68 Initial commit of the Yeti analyzer
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Yeti", | ||
"author": "CERT-BDF", | ||
"license": "AGPL-V3", | ||
"url": "https://github.com/CERT/cortex-analyzers", | ||
"version": "1.0", | ||
"baseConfig": "Yeti", | ||
"config": { | ||
"check_tlp": false, | ||
"max_tlp": 3 | ||
}, | ||
"description": "Fetch observable details from a Yeti", | ||
"dataTypeList": ["domain", "fqdn", "ip", "url", "hash"], | ||
"command": "Yeti/yeti.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,2 @@ | ||
cortexutils | ||
git+https://github.com/yeti-platform/pyeti |
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 python | ||
# -*- coding: utf-8 -*- | ||
|
||
import pyeti | ||
from cortexutils.analyzer import Analyzer | ||
|
||
|
||
class YetiAnalyzer(Analyzer): | ||
|
||
def __init__(self): | ||
Analyzer.__init__(self) | ||
self.url = self.getParam('config.url', None, 'Missing URL for Yeti API') | ||
|
||
def summary(self, raw): | ||
count = len(raw.get('findings', [])) | ||
value = "\"{}\" item(s)".format(count) | ||
|
||
result = { | ||
"taxonomies": [{ | ||
"level": "info", | ||
"namespace": "YETI", | ||
"predicate": "Search", | ||
"value": value | ||
}] | ||
} | ||
return result | ||
|
||
def run(self): | ||
api = pyeti.YetiApi("{}/api/".format(self.url)) | ||
data = self.getData() | ||
|
||
try: | ||
result = api.observable_search(value=data) | ||
self.report({ | ||
'findings': result | ||
}) | ||
except: | ||
self.error('An issue occurred while calling Yeyi API') | ||
|
||
if __name__ == '__main__': | ||
YetiAnalyzer().run() |