From bb42e5d9c19d4765186bcc6a12813efe45d15175 Mon Sep 17 00:00:00 2001 From: Daniel Pascual Date: Mon, 13 May 2024 10:59:21 +0200 Subject: [PATCH 1/5] Google Threat Intelligence MISP module --- misp_modules/modules/expansion/__init__.py | 3 +- .../expansion/google_threat_intelligence.py | 330 ++++++++++++++++++ tests/test_expansions.py | 2 +- 3 files changed, 333 insertions(+), 2 deletions(-) create mode 100644 misp_modules/modules/expansion/google_threat_intelligence.py diff --git a/misp_modules/modules/expansion/__init__.py b/misp_modules/modules/expansion/__init__.py index 9b5150cb..baacbe9d 100644 --- a/misp_modules/modules/expansion/__init__.py +++ b/misp_modules/modules/expansion/__init__.py @@ -20,7 +20,8 @@ __all__ = ['cuckoo_submit', 'vmray_submit', 'bgpranking', 'circl_passivedns', 'c 'trustar_enrich', 'recordedfuture', 'html_to_markdown', 'socialscan', 'passive-ssh', 'qintel_qsentry', 'mwdb', 'hashlookup', 'mmdb_lookup', 'ipqs_fraud_and_risk_scoring', 'clamav', 'jinja_template_rendering','hyasinsight', 'variotdbs', 'crowdsec', - 'extract_url_components', 'ipinfo', 'whoisfreaks', 'ip2locationio', 'vysion'] + 'extract_url_components', 'ipinfo', 'whoisfreaks', 'ip2locationio', 'vysion', + 'google_threat_intelligence'] minimum_required_fields = ('type', 'uuid', 'value') diff --git a/misp_modules/modules/expansion/google_threat_intelligence.py b/misp_modules/modules/expansion/google_threat_intelligence.py new file mode 100644 index 00000000..b8ab05b9 --- /dev/null +++ b/misp_modules/modules/expansion/google_threat_intelligence.py @@ -0,0 +1,330 @@ +#!/usr/local/bin/python +# Copyright © 2024 The Google Threat Intelligence authors. All Rights Reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Threat Intelligence MISP expansion module.""" + +from urllib import parse +import vt +import pymisp +import logging + + +MISP_ATTRIBUTES = { + 'input': [ + 'hostname', + 'domain', + 'ip-src', + 'ip-dst', + 'md5', + 'sha1', + 'sha256', + 'url', + ], + 'format': 'misp_standard', +} + +MODULE_INFO = { + 'version': '1', + 'author': 'Google Threat Intelligence team', + 'description': '', + 'module-type': ['expansion'], + 'config': [ + 'apikey', + 'event_limit', + 'proxy_host', + 'proxy_port', + 'proxy_username', + 'proxy_password' + ] +} + +DEFAULT_RESULTS_LIMIT = 10 + + + + +class GoogleThreatIntelligenceParser: + """Main parser class to create the MISP event.""" + def __init__(self, client: vt.Client, limit: int) -> None: + with open('/tmp/vtlog.txt','wb') as f: + f.write('XXXLOG2') + self.client = client + self.limit = limit or DEFAULT_RESULTS_LIMIT + self.misp_event = pymisp.MISPEvent() + self.attribute = pymisp.MISPAttribute() + self.parsed_objects = {} + self.input_types_mapping = { + 'ip-src': self.parse_ip, + 'ip-dst': self.parse_ip, + 'domain': self.parse_domain, + 'hostname': self.parse_domain, + 'md5': self.parse_hash, + 'sha1': self.parse_hash, + 'sha256': self.parse_hash, + 'url': self.parse_url + } + self.proxies = None + + def query_api(self, attribute: dict) -> None: + """Get data from the API and parse it.""" + self.attribute.from_dict(**attribute) + self.input_types_mapping[self.attribute.type](self.attribute.value) + + def get_results(self) -> dict: + """Serialize the MISP event.""" + event = self.misp_event.to_dict() + results = { + key: event[key] for key in ('Attribute', 'Object') \ + if (key in event and event[key]) + } + return {'results': results} + + def create_gti_report_object(self, report): + """Create GTI report object.""" + report = report.to_dict() + permalink = ('https://www.virustotal.com/gui/' + f"{report['type']}/{report['id']}") + report_object = pymisp.MISPObject('Google-Threat-Intel-report') + report_object.add_attribute('permalink', type='link', value=permalink) + report_object.add_attribute( + 'Threat Score', type='text', + value=get_key( + report, 'attributes.gti_assessment.threat_score.value')) + report_object.add_attribute( + 'Verdict', type='text', + value=get_key( + report, 'attributes.gti_assessment.verdict.value').replace( + 'VERDICT_', '')) + report_object.add_attribute( + 'Severity', type='text', + value=get_key( + report, 'attributes.gti_assessment.severity.value').replace( + 'SEVERITY_', '')) + report_object.add_attribute( + 'Threat Label', type='text', + value=get_key( + report, ('attributes.popular_threat_classification' + '.suggested_threat_label'))) + self.misp_event.add_object(**report_object) + return report_object.uuid + + def parse_domain(self, domain: str) -> str: + """Create domain MISP object.""" + domain_report = self.client.get_object(f'/domains/{domain}') + + # DOMAIN + domain_object = pymisp.MISPObject('domain-ip') + domain_object.add_attribute( + 'domain', type='domain', value=domain_report.id) + + report_uuid = self.create_gti_report_object(domain_report) + domain_object.add_reference(report_uuid, 'analyzed-with') + self.misp_event.add_object(**domain_object) + return domain_object.uuid + + def parse_hash(self, file_hash: str) -> str: + """Create hash MISP object.""" + file_report = self.client.get_object(f'/files/{file_hash}') + file_object = pymisp.MISPObject('file') + for hash_type in ('md5', 'sha1', 'sha256'): + file_object.add_attribute( + hash_type, + **{'type': hash_type, 'value': file_report.get(hash_type)}) + + report_uuid = self.create_gti_report_object(file_report) + file_object.add_reference(report_uuid, 'analyzed-with') + self.misp_event.add_object(**file_object) + return file_object.uuid + + def parse_ip(self, ip: str) -> str: + """Create ip MISP object.""" + ip_report = self.client.get_object(f'/ip_addresses/{ip}') + + # IP + ip_object = pymisp.MISPObject('domain-ip') + ip_object.add_attribute('ip', type='ip-dst', value=ip_report.id) + + report_uuid = self.create_gti_report_object(ip_report) + ip_object.add_reference(report_uuid, 'analyzed-with') + self.misp_event.add_object(**ip_object) + return ip_object.uuid + + def parse_url(self, url: str) -> str: + """Create URL MISP object.""" + url_id = vt.url_id(url) + url_report = self.client.get_object(f'/urls/{url_id}') + + url_object = pymisp.MISPObject('url') + url_object.add_attribute('url', type='url', value=url_report.url) + + report_uuid = self.create_gti_report_object(url_report) + url_object.add_reference(report_uuid, 'analyzed-with') + self.misp_event.add_object(**url_object) + return url_object.uuid + + +def get_key(dictionary, key, default_value=''): + """Get value from nested dictionaries.""" + dictionary = dictionary or {} + keys = key.split('.') + field_name = keys.pop() + for k in keys: + if k not in dictionary: + return default_value + dictionary = dictionary[k] + return dictionary.get(field_name, default_value) + + +def get_proxy_settings(config: dict) -> dict: + """Returns proxy settings in the requests format or None if not set up.""" + proxies = None + host = config.get('proxy_host') + port = config.get('proxy_port') + username = config.get('proxy_username') + password = config.get('proxy_password') + + if host: + if not port: + raise KeyError( + ('The google_threat_intelligence_proxy_host config is set, ' + 'please also set the virustotal_proxy_port.')) + parsed = parse.urlparse(host) + if 'http' in parsed.scheme: + scheme = 'http' + else: + scheme = parsed.scheme + netloc = parsed.netloc + host = f'{netloc}:{port}' + + if username: + if not password: + raise KeyError(('The google_threat_intelligence_' + ' proxy_host config is set, please also' + ' set the virustotal_proxy_password.')) + auth = f'{username}:{password}' + host = auth + '@' + host + + proxies = { + 'http': f'{scheme}://{host}', + 'https': f'{scheme}://{host}' + } + return proxies + + +def dict_handler(request: dict): + """MISP entry point fo the module.""" + with open('/tmp/vtlog.txt','wb') as f: + f.write('XXXLOG1') + if not request.get('config') or not request['config'].get('apikey'): + return { + 'error': ('A Google Threat Intelligence api ' + 'key is required for this module.') + } + + if not request.get('attribute'): + return { + 'error': ('This module requires an "attribute" field as input,' + ' which should contain at least a type, a value and an' + ' uuid.') + } + + if request['attribute']['type'] not in MISP_ATTRIBUTES['input']: + return {'error': 'Unsupported attribute type.'} + + event_limit = request['config'].get('event_limit') + attribute = request['attribute'] + + try: + proxy_settings = get_proxy_settings(request.get('config')) + client = vt.Client( + request['config']['apikey'], + headers={ + 'x-tool': 'MISPModuleGTIExpansion', + }, + proxy=proxy_settings['http'] if proxy_settings else None) + parser = GoogleThreatIntelligenceParser( + client, int(event_limit) if event_limit else None) + parser.query_api(attribute) + except vt.APIError as ex: + return {'error': ex.message} + except KeyError as ex: + return {'error': str(ex)} + with open('/tmp/vtlog.txt','wb') as f: + f.write('XXXLOG2') + + return parser.get_results() + + +def introspection(): + """Returns the module input attributes required.""" + return MISP_ATTRIBUTES + + +def version(): + """Returns the module metadata.""" + return MODULE_INFO + + +if __name__ == '__main__': + # Testing/debug calls. + import os + api_key = os.getenv('GTI_API_KEY') + # File + request_data = { + 'config': {'apikey': api_key}, + 'attribute': { + 'type': 'sha256', + 'value': ('ed01ebfbc9eb5bbea545af4d01bf5f10' + '71661840480439c6e5babe8e080e41aa') + } + } + response = dict_handler(request_data) + report_obj = response['results']['Object'][0] + print(report_obj.to_dict()) + + # URL + request_data = { + 'config': {'apikey': api_key}, + 'attribute': { + 'type': 'url', + 'value': 'http://47.21.48.182:60813/Mozi.a' + } + } + response = dict_handler(request_data) + report_obj = response['results']['Object'][0] + print(report_obj.to_dict()) + + # Ip + request_data = { + 'config': {'apikey': api_key}, + 'attribute': { + 'type': 'ip-src', + 'value': '180.72.148.38' + } + } + response = dict_handler(request_data) + report_obj = response['results']['Object'][0] + print(report_obj.to_dict()) + + # Domain + request_data = { + 'config': {'apikey': api_key}, + 'attribute': { + 'type': 'domain', + 'value': 'qexyhuv.com' + } + } + response = dict_handler(request_data) + report_obj = response['results']['Object'][0] + print(report_obj.to_dict()) diff --git a/tests/test_expansions.py b/tests/test_expansions.py index 96017249..6e17e619 100644 --- a/tests/test_expansions.py +++ b/tests/test_expansions.py @@ -92,7 +92,7 @@ class TestExpansions(unittest.TestCase): query = {'module': 'apiosintds', 'ip-dst': '10.10.10.10'} response = self.misp_modules_post(query) - + try: self.assertTrue(self.get_values(response).startswith('IoC 10.10.10.10')) except AssertionError: From da072cc38a6cce5514aa5e493c58375c523c32c9 Mon Sep 17 00:00:00 2001 From: Daniel Pascual Date: Mon, 13 May 2024 19:50:46 +0200 Subject: [PATCH 2/5] Remove debug traces --- .../modules/expansion/google_threat_intelligence.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/misp_modules/modules/expansion/google_threat_intelligence.py b/misp_modules/modules/expansion/google_threat_intelligence.py index b8ab05b9..fd6db0c5 100644 --- a/misp_modules/modules/expansion/google_threat_intelligence.py +++ b/misp_modules/modules/expansion/google_threat_intelligence.py @@ -17,7 +17,6 @@ from urllib import parse import vt import pymisp -import logging MISP_ATTRIBUTES = { @@ -57,8 +56,6 @@ DEFAULT_RESULTS_LIMIT = 10 class GoogleThreatIntelligenceParser: """Main parser class to create the MISP event.""" def __init__(self, client: vt.Client, limit: int) -> None: - with open('/tmp/vtlog.txt','wb') as f: - f.write('XXXLOG2') self.client = client self.limit = limit or DEFAULT_RESULTS_LIMIT self.misp_event = pymisp.MISPEvent() @@ -224,8 +221,6 @@ def get_proxy_settings(config: dict) -> dict: def dict_handler(request: dict): """MISP entry point fo the module.""" - with open('/tmp/vtlog.txt','wb') as f: - f.write('XXXLOG1') if not request.get('config') or not request['config'].get('apikey'): return { 'error': ('A Google Threat Intelligence api ' @@ -260,8 +255,6 @@ def dict_handler(request: dict): return {'error': ex.message} except KeyError as ex: return {'error': str(ex)} - with open('/tmp/vtlog.txt','wb') as f: - f.write('XXXLOG2') return parser.get_results() From 3af14a7f6ede8ec4e45f3575d5e9f1182f2206eb Mon Sep 17 00:00:00 2001 From: Daniel Pascual Date: Mon, 13 May 2024 20:00:14 +0200 Subject: [PATCH 3/5] Logo and desc --- misp_modules/modules/expansion/google_threat_intelligence.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misp_modules/modules/expansion/google_threat_intelligence.py b/misp_modules/modules/expansion/google_threat_intelligence.py index fd6db0c5..3b767034 100644 --- a/misp_modules/modules/expansion/google_threat_intelligence.py +++ b/misp_modules/modules/expansion/google_threat_intelligence.py @@ -36,7 +36,8 @@ MISP_ATTRIBUTES = { MODULE_INFO = { 'version': '1', 'author': 'Google Threat Intelligence team', - 'description': '', + 'description': ('An expansion module to have the observable\'s threat' + ' score assessed by Google Threat Intelligence.'), 'module-type': ['expansion'], 'config': [ 'apikey', From bd9316b3131c8567de619e0a937d3682865f1f2d Mon Sep 17 00:00:00 2001 From: Daniel Pascual Date: Mon, 13 May 2024 20:15:39 +0200 Subject: [PATCH 4/5] doc --- docs/index.md | 1 + docs/logos/google_threat_intelligence.png | Bin 0 -> 4748 bytes documentation/README.md | 44 ++++++++++++++++------ 3 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 docs/logos/google_threat_intelligence.png diff --git a/docs/index.md b/docs/index.md index b3c588f9..817f9c49 100644 --- a/docs/index.md +++ b/docs/index.md @@ -38,6 +38,7 @@ For more information: [Extending MISP with Python modules](https://www.circl.lu/ * [EQL](misp_modules/modules/expansion/eql.py) - an expansion module to generate event query language (EQL) from an attribute. [Event Query Language](https://eql.readthedocs.io/en/latest/) * [Farsight DNSDB Passive DNS](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/farsight_passivedns.py) - a hover and expansion module to expand hostname and IP addresses with passive DNS information. * [GeoIP](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/geoip_country.py) - a hover and expansion module to get GeoIP information from geolite/maxmind. +* [Google Threat Intelligence] (https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/google_threat_intelligence.py) - An expansion module to have the observable's threat score assessed by Google Threat Intelligence. * [Greynoise](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/greynoise.py) - a hover to get information from greynoise. * [hashdd](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/hashdd.py) - a hover module to check file hashes against [hashdd.com](http://www.hashdd.com) including NSLR dataset. * [hibp](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/hibp.py) - a hover module to lookup against Have I Been Pwned? diff --git a/docs/logos/google_threat_intelligence.png b/docs/logos/google_threat_intelligence.png new file mode 100644 index 0000000000000000000000000000000000000000..d0aa76df55c37557113b9f2a6a4b3dd4a5bc34cf GIT binary patch literal 4748 zcmb_g_dgVlA3l+ikc1HOk-cZuk?qL%SmmrFoxR6dXJn)}89AGb$QjuudvsPuP7WDI z=d8=hcARgY|Ka<*UhnzC^Ll=Iet441O!OIUaNYm_01O}l9diJH>e1ib>^k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`yoU;522K+4LO*$T|GfGVbQ_k;4N*7?gJ$w~b8Wwp zJ5nofvYSlY@7()w^qrtz`twiTspQ6qOm^=gY*OXC#qP#ct(|xWi(#XWnTx2i#XP4n z)5Y@*mr`8KC(u^K=r(U-x9%|KV%)_^&E@s|8Lop!6430cL@w3rjHjweQ2niX=>uZb z@L7>m$Oh?#>G2G;ZIgA-i?4?|m0$GrbKw9tmF@iLgcY}IuYjD-_M5a?jZ4Q?WP=_^ zBHqUzC}L{2+ryI-Yor+}#JRBQ3M%L!qp6Q+FEwI5QJac$1Kk8_%Q`&W!d?5J2bd+3 zu07cqzfgT4TSMT+IF64ldo}Ys!jMfp`1gYGZsQd}wK>CU&R&M6GhP-gZPoshA1l2k zN6-YM3u}=XpoJurL;S!hzRBnj(_yDzv|yGZpPLJj@5Fq#C7)Z&9LS#1V=JAtoQFpF zo%YdRye;8lJYB&Q$ zRc2!1X*3g8IGd-kV*Ly#iJVNDUG3R^R$=fx(MxI%C9#?LIcT{WAewG!6-SzmE!CX$ zXWB>X5eu!5$}Dmo3N4Nrz+{1jl~zd?H{~}vQ#WoH@*o)eidbUoQV!o=c$lVc0Lq#Y zF_0X+tz}W_4v8#9_*0V~4lOZr$aH5oQ{z>d07LVS~nDV8yGWzsW(Xc(Ox^ z?2^mQdH3Z~Eo+wKH2%UpC_8aDl`*d?wm! zsym1SfuVpYzEXRyu;yfGZaMuH7r_~R#NOkAYi-7YMAnnyA%SBjo5L||DC?=Pv<+lZq zbM>0~QhRF&zEKz!|VwfY`U5$aHEAMjtp$TPk z7(Gc~j@H(1QgiraZ4vu9KIl}sdTfySJ&|LZj?E}Yv~osThe module takes a cpe attribute as input and queries the CVE search API to get its related vulnerabilities. +>The module takes a cpe attribute as input and queries the CVE search API to get its related vulnerabilities. >The list of vulnerabilities is then parsed and returned as vulnerability objects. > >Users can use their own CVE search API url by defining a value to the custom_API_URL parameter. If no custom API url is given, the default cve.circl.lu api url is used. @@ -640,6 +640,7 @@ Module to query a local copy of Maxmind's Geolite database. #### [google_search](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/google_search.py) + - **descrption**: >A hover module to get information about an url using a Google search. - **features**: @@ -655,6 +656,27 @@ Module to query a local copy of Maxmind's Geolite database. ----- +#### [google_threat_intelligence](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/google_threat_intelligence.py) + + + +- **description**: +An expansion module to have the observable's threat score assessed by Google Threat Intelligence. +- **features**: +>The module gives the Google Threat Intelligence assessment including a verdict for the given obsevable. [Example screeshot](https://github.com/MISP/MISP/assets/4747608/e275db2f-bb1e-4413-8cc0-ec3cb05e0414) +] +- **input**: +>'hostname', 'domain', 'ip-src', 'ip-dst', 'md5', 'sha1', 'sha256', 'url'. +- **output**: +>Text fields containing the threat score, the severity, the verdict and the threat label of the observable inspected. +- **references**: +>https://gtidocs.virustotal.com/reference +- **requirements**: +>- pymisp +>- vt + +----- + #### [greynoise](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/greynoise.py) @@ -745,7 +767,7 @@ Expansion module to fetch the html content from an url and convert it into markd HYAS Insight integration to MISP provides direct, high volume access to HYAS Insight data. It enables investigators and analysts to understand and defend against cyber adversaries and their infrastructure. - **features**: >This Module takes the IP Address, Domain, URL, Email, Phone Number, MD5, SHA1, Sha256, SHA512 MISP Attributes as input to query the HYAS Insight API. -> The results of the HYAS Insight API are than are then returned and parsed into Hyas Insight Objects. +> The results of the HYAS Insight API are than are then returned and parsed into Hyas Insight Objects. > >An API key is required to submit queries to the HYAS Insight API. > @@ -819,9 +841,9 @@ Module to access intelmqs eventdb. An expansion module to query IP2Location.io to gather more information on a given IP address. - **features**: ->The module takes an IP address attribute as input and queries the IP2Location.io API. ->Free plan user will get the basic geolocation informaiton, and different subsription plan will get more information on the IP address. -> Refer to [pricing page](https://www.ip2location.io/pricing) for more information on data available for each plan. +>The module takes an IP address attribute as input and queries the IP2Location.io API. +>Free plan user will get the basic geolocation informaiton, and different subsription plan will get more information on the IP address. +> Refer to [pricing page](https://www.ip2location.io/pricing) for more information on data available for each plan. > >More information on the responses content is available in the [documentation](https://www.ip2location.io/ip2location-documentation). - **input**: @@ -857,7 +879,7 @@ Module to query an IP ASN history service (https://github.com/D4-project/IPASN-H An expansion module to query ipinfo.io to gather more information on a given IP address. - **features**: ->The module takes an IP address attribute as input and queries the ipinfo.io API. +>The module takes an IP address attribute as input and queries the ipinfo.io API. >The geolocation information on the IP address is always returned. > >Depending on the subscription plan, the API returns different pieces of information then: @@ -883,7 +905,7 @@ An expansion module to query ipinfo.io to gather more information on a given IP IPQualityScore MISP Expansion Module for IP reputation, Email Validation, Phone Number Validation, Malicious Domain and Malicious URL Scanner. - **features**: >This Module takes the IP Address, Domain, URL, Email and Phone Number MISP Attributes as input to query the IPQualityScore API. -> The results of the IPQualityScore API are than returned as IPQS Fraud and Risk Scoring Object. +> The results of the IPQualityScore API are than returned as IPQS Fraud and Risk Scoring Object. > The object contains a copy of the enriched attribute with added tags presenting the verdict based on fraud score,risk score and other attributes from IPQualityScore. - **input**: >A MISP attribute of type IP Address(ip-src, ip-dst), Domain(hostname, domain), URL(url, uri), Email Address(email, email-src, email-dst, target-email, whois-registrant-email) and Phone Number(phone-number, whois-registrant-phone). @@ -1222,7 +1244,7 @@ Module to get information from AlienVault OTX. An expansion module to query the CIRCL Passive SSH. - **features**: >The module queries the Passive SSH service from CIRCL. -> +> > The module can be used an hover module but also an expansion model to add related MISP objects. > - **input**: @@ -1945,7 +1967,7 @@ Module to query a local instance of uwhois (https://github.com/rafiot/uwhoisd). An expansion module for https://whoisfreaks.com/ that will provide an enriched analysis of the provided domain, including WHOIS and DNS information. -Our Whois service, DNS Lookup API, and SSL analysis, equips organizations with comprehensive threat intelligence and attack surface analysis capabilities for enhanced security. +Our Whois service, DNS Lookup API, and SSL analysis, equips organizations with comprehensive threat intelligence and attack surface analysis capabilities for enhanced security. Explore our website's product section at https://whoisfreaks.com/ for a wide range of additional services catering to threat intelligence and attack surface analysis needs. - **features**: >The module takes a domain as input and queries the Whoisfreaks API with it. @@ -2084,7 +2106,7 @@ Module to process a query on Yeti. > - https://github.com/sebdraven/pyeti - **requirements**: > - pyeti -> - API key +> - API key ----- @@ -2241,7 +2263,7 @@ Simple export of a MISP event to PDF. > 'Activate_galaxy_description' is a boolean (True or void) to activate the description of event related galaxies. > 'Activate_related_events' is a boolean (True or void) to activate the description of related event. Be aware this might leak information on confidential events linked to the current event ! > 'Activate_internationalization_fonts' is a boolean (True or void) to activate Noto fonts instead of default fonts (Helvetica). This allows the support of CJK alphabet. Be sure to have followed the procedure to download Noto fonts (~70Mo) in the right place (/tools/pdf_fonts/Noto_TTF), to allow PyMisp to find and use them during PDF generation. -> 'Custom_fonts_path' is a text (path or void) to the TTF file of your choice, to create the PDF with it. Be aware the PDF won't support bold/italic/special style anymore with this option +> 'Custom_fonts_path' is a text (path or void) to the TTF file of your choice, to create the PDF with it. Be aware the PDF won't support bold/italic/special style anymore with this option - **input**: >MISP Event - **output**: From 6b7260229b5bf64c4ffc94422b9d66040560b602 Mon Sep 17 00:00:00 2001 From: Daniel Pascual Date: Mon, 13 May 2024 20:24:13 +0200 Subject: [PATCH 5/5] fix hedight --- documentation/README.md | 2 +- tests/test_expansions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/README.md b/documentation/README.md index 208317e2..11838066 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -658,7 +658,7 @@ Module to query a local copy of Maxmind's Geolite database. #### [google_threat_intelligence](https://github.com/MISP/misp-modules/tree/main/misp_modules/modules/expansion/google_threat_intelligence.py) - + - **description**: An expansion module to have the observable's threat score assessed by Google Threat Intelligence. diff --git a/tests/test_expansions.py b/tests/test_expansions.py index 6e17e619..96017249 100644 --- a/tests/test_expansions.py +++ b/tests/test_expansions.py @@ -92,7 +92,7 @@ class TestExpansions(unittest.TestCase): query = {'module': 'apiosintds', 'ip-dst': '10.10.10.10'} response = self.misp_modules_post(query) - + try: self.assertTrue(self.get_values(response).startswith('IoC 10.10.10.10')) except AssertionError: