mirror of https://github.com/MISP/misp-modules
code cleanup and formatting
parent
8d7d377464
commit
3e9589d0f4
|
@ -18,21 +18,33 @@ def handler(q=False):
|
||||||
misperrors['error'] = 'Vulnerability id missing'
|
misperrors['error'] = 'Vulnerability id missing'
|
||||||
return misperrors
|
return misperrors
|
||||||
|
|
||||||
|
ai_summary = ''
|
||||||
|
exploit_summary = ''
|
||||||
|
vuln_summary = ''
|
||||||
|
|
||||||
key = request['config'].get('apikey')
|
key = request['config'].get('apikey')
|
||||||
vulners_api = vulners.Vulners(api_key=key)
|
vulners_api = vulners.Vulners(api_key=key)
|
||||||
vulners_document = vulners_api.document(request.get('vulnerability'))
|
vulnerability = request.get('vulnerability')
|
||||||
vulners_exploits = vulners_api.searchExploit(request.get('vulnerability'))
|
vulners_document = vulners_api.document(vulnerability)
|
||||||
|
vulners_exploits = vulners_api.searchExploit(vulnerability)
|
||||||
|
vulners_ai_score = vulners_api.aiScore(vulnerability)
|
||||||
|
|
||||||
if vulners_document:
|
if vulners_document:
|
||||||
summary = vulners_document.get('description')
|
vuln_summary += vulners_document.get('description')
|
||||||
else:
|
else:
|
||||||
summary = 'Non existing CVE'
|
vuln_summary += 'Non existing CVE'
|
||||||
|
|
||||||
|
if vulners_ai_score:
|
||||||
|
ai_summary += 'Vulners AI Score is ' + str(vulners_ai_score[0]) + " "
|
||||||
|
|
||||||
if vulners_exploits:
|
if vulners_exploits:
|
||||||
|
exploit_summary += " || " + str(len(vulners_exploits[0])) + " Public exploits available:\n "
|
||||||
for exploit in vulners_exploits[0]:
|
for exploit in vulners_exploits[0]:
|
||||||
exploit_summary += exploit['title'] + " " + exploit['href'] + "\n"
|
exploit_summary += exploit['title'] + " " + exploit['href'] + "\n "
|
||||||
summary += vulners_exploits[1] + " Public exploits available:\n " + exploit_summary
|
exploit_summary += "|| Vulnerability Description: " + vuln_summary
|
||||||
|
|
||||||
|
summary = ai_summary + exploit_summary + vuln_summary
|
||||||
|
|
||||||
r = {'results': [{'types': mispattributes['output'], 'values': summary}]}
|
r = {'results': [{'types': mispattributes['output'], 'values': summary}]}
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue