Commit 2bbd4530 authored by PidgeyL's avatar PidgeyL
Browse files

Merge branch 'master' of https://github.com/pidgeyl/cve-search

parents c3740cfc 0fbeb641
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -62,10 +62,10 @@ and Exposures database and the Common Platform Enumeration.

A more detailed documentation can be found in the Documentations folder of the project.

Database and collections
------------------------
Databases and collections
-------------------------

The MongoDB database is called cvedb and there are 8 collections:
The MongoDB database is called cvedb and there are 10 collections:

* cves (Common Vulnerabilities and Exposure items) - source NVD NIST
* cpe (Common Platform Enumeration items) - source NVD NIST
@@ -75,8 +75,16 @@ The MongoDB database is called cvedb and there are 8 collections:
* ranking (ranking rules per group) - local cve-search
* d2sec (Exploitation reference from D2 Elliot Web Exploitation Framework) - source d2sec.com
* [vFeed](https://github.com/toolswatch/vFeed) (cross-references to CVE ids (e.g. OVAL, OpenVAS, ...)) - source [vFeed](https://github.com/toolswatch/vFeed)
* Microsoft Bulletin (Security Vulnerabilities and Bulletin) - source [Microsoft](http://www.microsoft.com/en-us/download/details.aspx?id=36982)
* info (metadata of each collection like last-modified) - local cve-search

The Redis database has 3 databases:

* 10: The cpe (Common Platform Enumeration) cache - source MongoDB cvedb collection cpe
* 11: The notification database - source cve-search
* 12: The NIST reference databased is a cross-reference database to CVE ids against various vendors ID - source NVD NIST


Updating the database
---------------------

+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ if vSearch:
            else:
                csvoutput.writerow([item['id'], item['Published'], item['cvss'], item['summary'], refs, nl])
        elif htmlOutput:
            print("<h2>" + item['id'] + "<br></h2>CVSS score: " + item['cvss'] + "<br>" + "<b>" + item['Published'] + "<b><br>" + item['summary'] + "<br>")
            print("<h2>" + item['id'] + "<br></h2>CVSS score: " + str(item['cvss']) + "<br>" + "<b>" + item['Published'] + "<b><br>" + item['summary'] + "<br>")
            print("References:<br>")
            for entry in item['references']:
                print(entry + "<br>")
+4 −0
Original line number Diff line number Diff line
@@ -3,10 +3,13 @@ Host: localhost
Port: 6379
VendorsDB: 10
NotificationsDB: 11
RefDB: 12
[Mongo]
Host: localhost
Port: 27017
DB: cvedb
[dbmgt]
Tmpdir: ./tmp/
[FulltextIndex]
Indexdir: ./indexdir/
[Sources]
@@ -18,6 +21,7 @@ vFeed: http://www.toolswatch.org/vfeed/vfeed.db.tgz
vFeedStatus: http://www.toolswatch.org/update.dat
Vendor: https://nvd.nist.gov/download/vendorstatements.xml
CAPEC: http://capec.mitre.org/data/xml/capec_v2.6.xml
MSBULLETIN: http://download.microsoft.com/download/6/7/3/673E4349-1CA5-40B9-8879-095C72D5B49D/BulletinSearch.xlsx
Ref: https://cve.mitre.org/data/refs/refmap/allrefmaps.zip
[Webserver]
Host: 127.0.0.1
+11 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class last:

    def __init__(self, collection="cves", rankinglookup=False,
                 namelookup=False, vfeedlookup=False,
                 capeclookup=False, subscorelookup=False):
                 capeclookup=False, subscorelookup=False, reflookup=False):

        self.collectionname = collection
        self.rankinglookup = rankinglookup
@@ -47,6 +47,8 @@ class last:
            self.vfeed = connectdb['vfeed']
        if capeclookup:
            self.capec = connectdb['capec']
        if reflookup:
            self.ref = Configuration.getRedisRefConnection()

    def getcapec(self, cweid=None):
        if cweid is None or not self.capeclookup:
@@ -58,6 +60,12 @@ class last:
            capec.append(f)
        return capec

    def getref(self, cveid=None):
        if cveid is None or not self.ref:
            return False
        ref = self.ref.smembers(cveid)
        return ref

    def getcpe(self, cpeid=None):

        if not(self.namelookup):
@@ -188,5 +196,7 @@ def test_last():
    l = last(rankinglookup=False, vfeedlookup=True, capeclookup=True)
    print (l.getcve("CVE-2015-0597"))
    print (l.getcapec("200"))
    l = last(reflookup=True)
    print(l.getref("CVE-2015-0597"))
if __name__ == "__main__":
    test_last()
+22 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ class Configuration():
    ConfigParser.read(os.path.join(runPath, "../etc/configuration.ini"))
    default = {'redisHost': 'localhost', 'redisPort': 6379,
               'redisVendorDB': 10,      'redisNotificationsDB': 11,
               'redisRefDB': 12,
               'mongoHost': 'localhost', 'mongoPort': 27017,
               'mongoDB': "cvedb",
               'mongoUsername': '', 'mongoPassword': '',
@@ -44,10 +45,12 @@ class Configuration():
               'd2sec': "http://www.d2sec.com/exploits/elliot.xml",
               'vendor': "https://nvd.nist.gov/download/vendorstatements.xml",
               'capec': "http://capec.mitre.org/data/xml/capec_v2.6.xml",
               'msbulletin': "http://download.microsoft.com/download/6/7/3/673E4349-1CA5-40B9-8879-095C72D5B49D/BulletinSearch.xlsx",
               'ref': "https://cve.mitre.org/data/refs/refmap/allrefmaps.zip",
               'logging': True,           'logfile': "../log/cve-search.log",
               'maxLogSize': '100MB',     'backlog': 5,
               'Indexdir': './indexdir',
               'Tmpdir': './tmp',
               'includeCapec': True,      'includeD2Sec': True,
               'includeVFeed': True,      'includeVendor': True,
               'includeCWE': True,
@@ -120,6 +123,15 @@ class Configuration():
        redisDB = cls.readSetting("Redis", "NotificationsDB", cls.default['redisNotificationsDB'])
        return redis.StrictRedis(host=redisHost, port=redisPort, db=redisDB, charset="utf-8", decode_responses=True)

    @classmethod
    def getRedisRefConnection(cls):
        redisHost = cls.getRedisHost()
        redisPort = cls.getRedisPort()
        redisDB = cls.readSetting("Redis", "RefDB", cls.default['redisRefDB'])
        return redis.StrictRedis(host=redisHost, port=redisPort, db=redisDB, charset="utf-8", decode_responses=True)



    # Flask
    @classmethod
    def getFlaskHost(cls):
@@ -206,6 +218,10 @@ class Configuration():
    @classmethod
    def getCAPECDict(cls):
        return cls.readSetting("Sources", "CAPEC", cls.default['capec'])

    @classmethod
    def getMSBULLETINDict(cls):
        return cls.readSetting("Sources", "MSBULLETIN", cls.default['msbulletin'])
    # Logging

    @classmethod
@@ -243,6 +259,11 @@ class Configuration():
    def getBacklog(cls):
        return cls.readSetting("Logging", "Backlog", cls.default['backlog'])

    # Indexing
    @classmethod
    def getTmpdir(cls):
        return cls.readSetting("dbmgt", "Tmpdir", cls.default['Tmpdir'])

    # Indexing
    @classmethod
    def getIndexdir(cls):
Loading