Skip to content

Commit

Permalink
Merge pull request #54 from adulau/master
Browse files Browse the repository at this point in the history
Various fixes and updates
  • Loading branch information
adulau committed Mar 16, 2015
2 parents 1eb6330 + 97b6b83 commit e35cc86
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The MongoDB database is called cvedb and there are 8 collections:
* capec (Common Attack Pattern Enumeration and Classification) - source NVD NIST
* ranking (ranking rules per group) - local cve-search
* d2sec (Exploitation reference from D2 Elliot Web Exploitation Framework) - source d2sec.com
* vfeed (cross-references to CVE ids (e.g. OVAL, OpenVAS, ...)) - source vfeed
* [vFeed](https://github.com/toolswatch/vFeed) (cross-references to CVE ids (e.g. OVAL, OpenVAS, ...)) - source [vFeed](https://github.com/toolswatch/vFeed)
* info (metadata of each collection like last-modified) - local cve-search

Updating the database
Expand Down
15 changes: 10 additions & 5 deletions bin/db_cpe_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
runPath = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(runPath, ".."))

from redis import exceptions as redisExceptions

from lib.Config import Configuration
from lib.Toolkit import pad

Expand All @@ -37,8 +39,11 @@
except Exception as ex:
print(ex)
pass
r.sadd("prefix:" + prefix, cpetype)
r.sadd("t:" + cpetype, vendor)
r.sadd("v:" + vendor, product)
if version:
r.sadd("p:" + product, version)
try:
r.sadd("prefix:" + prefix, cpetype)
r.sadd("t:" + cpetype, vendor)
r.sadd("v:" + vendor, product)
if version:
r.sadd("p:" + product, version)
except redisExceptions.ConnectionError:
sys.exit("Redis server not running on %s:%s"%(Configuration.getRedisHost(),Configuration.getRedisPort()))
10 changes: 10 additions & 0 deletions web/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,16 @@ def filterLast(r):

return render_template('index.html', settings=settings, cve=cve, r=r, pageLength=pageLength)

@app.route('/api/cvefor/<cpe>', methods=['GET'])
def apiCVEFor(cpe):
col = db['cves']
cpe=urllib.parse.unquote_plus(cpe)
vulns = col.find({"vulnerable_configuration": {'$regex': cpe}}).sort("Modified", -1)
r = []
for x in vulns:
x.pop('_id')
r.append(x)
return json.dumps(r)

@app.route('/api/cve/<cveid>', methods=['GET'])
def apiCVE(cveid):
Expand Down

0 comments on commit e35cc86

Please sign in to comment.