Skip to content
Snippets Groups Projects
Commit a6fd60ee authored by Václav Bartoš's avatar Václav Bartoš
Browse files

NERD: Added tag translation/filtration, hostname added as artifact

parent 64d0131c
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,24 @@ ...@@ -4,6 +4,24 @@
import requests import requests
from cortexutils.analyzer import Analyzer from cortexutils.analyzer import Analyzer
# Map of tag IDs to (name,level)-tuple used in summary (tags not listed here are not shown)
tag_map = {
'reconscanning': ('Scanner', 'suspicious'),
'attemptexploit': ('Exploit', 'malicious'),
'attemptlogin': ('Login', 'malicious'),
'malware': ('Malware', 'malicious'),
'availabilitydos': ('DDoS', 'malicious'),
'researchscanners': ('Research scanner', 'safe'),
'vpn': ('VPN', 'info'),
'nat': ('NAT', 'info'),
'dsl': ('DSL', 'info'),
'dynamicIP': ('Dynamic IP', 'info'),
'tor': ('Tor exit node', 'info'),
'spam': ('Spam', 'malicious'),
'reserved_ip': ('Reserved IP', 'info'),
}
class NERDAnalyzer(Analyzer): class NERDAnalyzer(Analyzer):
def __init__(self): def __init__(self):
Analyzer.__init__(self) Analyzer.__init__(self)
...@@ -31,14 +49,19 @@ class NERDAnalyzer(Analyzer): ...@@ -31,14 +49,19 @@ class NERDAnalyzer(Analyzer):
# Tags # Tags
for tag in raw['tags']: for tag in raw['tags']:
# TODO: filter tags, set different levels try:
taxonomies.append(self.build_taxonomy('info', 'NERD', 'Tag', tag)) tag_name, level = tag_map[tag]
except KeyError:
continue
taxonomies.append(self.build_taxonomy(level, 'NERD', 'Tag', tag_name))
return {'taxonomies': taxonomies} return {'taxonomies': taxonomies}
def artifacts(self, raw): def artifacts(self, raw):
"""Returns a list of indicators extracted from reply (empty in this case)""" """Returns a list of indicators extracted from reply (only "hostname" in this case)"""
return [] # TODO add hostname as a new indicator? if raw.get('hostname'):
return [{'dataType': 'fqdn', 'data': raw['hostname']}]
return []
def run(self): def run(self):
"""Main function run by Cortex to analyze an observable.""" """Main function run by Cortex to analyze an observable."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment