mirror of https://github.com/MISP/misp-modules
Return a text attribute for an hover only module
parent
199a23cc4b
commit
459bf08b9f
|
@ -2,8 +2,8 @@ import json
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
misperrors = {'error': 'Error'}
|
misperrors = {'error': 'Error'}
|
||||||
mispattributes = {'input': ['vulnerability'], 'output': ['']}
|
mispattributes = {'input': ['vulnerability'], 'output': ['text']}
|
||||||
moduleinfo = {'version': '0.1', 'author': 'Alexandre Dulaunoy', 'description': 'An expansion hover module to expand information about CVE id.', 'module-type': ['hover']}
|
moduleinfo = {'version': '0.2', 'author': 'Alexandre Dulaunoy', 'description': 'An expansion hover module to expand information about CVE id.', 'module-type': ['hover']}
|
||||||
moduleconfig = []
|
moduleconfig = []
|
||||||
cveapi_url = 'https://cve.circl.lu/api/cve/'
|
cveapi_url = 'https://cve.circl.lu/api/cve/'
|
||||||
|
|
||||||
|
@ -20,11 +20,14 @@ def handler(q=False):
|
||||||
r = requests.get(cveapi_url+request.get('vulnerability'))
|
r = requests.get(cveapi_url+request.get('vulnerability'))
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
vulnerability = json.loads(r.text)
|
vulnerability = json.loads(r.text)
|
||||||
|
if vulnerability.get('summary'):
|
||||||
|
summary = vulnerability['summary']
|
||||||
else:
|
else:
|
||||||
misperrors['error'] = 'cve.circl.lu API not accessible'
|
misperrors['error'] = 'cve.circl.lu API not accessible'
|
||||||
return misperrors['error']
|
return misperrors['error']
|
||||||
|
|
||||||
return vulnerability
|
r = {'results': [{'types': mispattributes['output'], 'values': summary}]}
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
def introspection():
|
def introspection():
|
||||||
|
|
Loading…
Reference in New Issue