Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ yara | |
sigmatools | ||
stix2-patterns | ||
maclookup | ||
vulners |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import json | ||
import requests | ||
import vulners | ||
|
||
misperrors = {'error': 'Error'} | ||
mispattributes = {'input': ['vulnerability'], 'output': ['text']} | ||
moduleinfo = {'version': '0.1', 'author': 'Igor Ivanov', 'description': 'An expansion hover module to expand information about CVE id using Vulners API.', 'module-type': ['hover']} | ||
|
||
# Get API key from https://vulners.com/userinfo | ||
moduleconfig = ["apikey"] | ||
|
||
|
||
def handler(q=False): | ||
if q is False: | ||
return False | ||
request = json.loads(q) | ||
if not request.get('vulnerability'): | ||
misperrors['error'] = 'Vulnerability id missing' | ||
return misperrors | ||
|
||
key = q["config"]["apikey"] | ||
vulners_api = vulners.Vulners(api_key=key) | ||
vulners_document = vulners_api.document("CVE-2017-14174") | ||
if vulners_document: | ||
summary = vulners_document.get('description') | ||
else: | ||
summary = 'Non existing CVE' | ||
|
||
r = {'results': [{'types': mispattributes['output'], 'values': summary}]} | ||
return r | ||
|
||
|
||
def introspection(): | ||
return mispattributes | ||
|
||
|
||
def version(): | ||
moduleinfo['config'] = moduleconfig | ||
return moduleinfo |