diff --git a/analyzers/Hunterio/Hunterio_domainsearch.json b/analyzers/Hunterio/Hunterio_domainsearch.json new file mode 100644 index 0000000..4857d6c --- /dev/null +++ b/analyzers/Hunterio/Hunterio_domainsearch.json @@ -0,0 +1,22 @@ +{ + "name": "Hunterio_DomainSearch", + "author": "RĂ©mi Allain, Cyberprotect", + "license": "AGPL-V3", + "url": "https://github.com/Cyberprotect/Cortex-Analyzers", + "version": "1.0", + "description": "hunter.io is a service to find email addresses from a domain.", + "dataTypeList": ["domain", "fqdn"], + "command": "Hunterio/hunterio_analyzer.py", + "baseConfig": "Hunterio", + "config": { + "service": "domainsearch", + "check_tlp": false + }, + "configurationItems": [{ + "name": "key", + "description": "api key of hunter.io", + "type": "string", + "multi": false, + "required": true + }] +} \ No newline at end of file diff --git a/analyzers/Hunterio/hunterio_analyzer.py b/analyzers/Hunterio/hunterio_analyzer.py new file mode 100755 index 0000000..4752e95 --- /dev/null +++ b/analyzers/Hunterio/hunterio_analyzer.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# encoding: utf-8 + +import requests +from cortexutils.analyzer import Analyzer + + +class Hunterio(Analyzer): + URI = "https://api.hunter.io/v2/" + + + def __init__(self): + Analyzer.__init__(self) + self.service = self.get_param('config.service', None, 'Service parameter is missing') + self.key = self.get_param('config.key', None, 'Missing hunter.io API key') + + def summary(self, raw): + + taxonomies = [] + namespace = "Hunter.io" + if self.service == 'domainsearch': + found = 0 + if(raw.get('meta') and raw['meta'].get('results')): + found = raw['meta'].get('results') + taxonomies.append(self.build_taxonomy('info', namespace, "Emails found", found)) + + return {"taxonomies": taxonomies} + + + def run(self): + Analyzer.run(self) + + if self.service == 'domainsearch' and (self.data_type == 'domain' or self.data_type == 'fqdn'): + try: + response = requests.get("{}domain-search?domain={}&api_key={}".format(self.URI, self.get_data(), self.key)) + self.report(response.json()) + except Exception as e: + self.unexpectedError(e) + else: + self.notSupported() + + +if __name__ == '__main__': + Hunterio().run() diff --git a/analyzers/Hunterio/requirements.txt b/analyzers/Hunterio/requirements.txt new file mode 100644 index 0000000..4a21dbf --- /dev/null +++ b/analyzers/Hunterio/requirements.txt @@ -0,0 +1,2 @@ +cortexutils +requests \ No newline at end of file