mirror of https://github.com/MISP/misp-modules
code cleanup and formatting
parent
8d7d377464
commit
3e9589d0f4
|
@ -18,20 +18,32 @@ def handler(q=False):
|
|||
misperrors['error'] = 'Vulnerability id missing'
|
||||
return misperrors
|
||||
|
||||
ai_summary = ''
|
||||
exploit_summary = ''
|
||||
vuln_summary = ''
|
||||
|
||||
key = request['config'].get('apikey')
|
||||
vulners_api = vulners.Vulners(api_key=key)
|
||||
vulners_document = vulners_api.document(request.get('vulnerability'))
|
||||
vulners_exploits = vulners_api.searchExploit(request.get('vulnerability'))
|
||||
vulnerability = 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:
|
||||
summary = vulners_document.get('description')
|
||||
vuln_summary += vulners_document.get('description')
|
||||
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:
|
||||
exploit_summary += " || " + str(len(vulners_exploits[0])) + " Public exploits available:\n "
|
||||
for exploit in vulners_exploits[0]:
|
||||
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}]}
|
||||
return r
|
||||
|
|
Loading…
Reference in New Issue