Commit c2f3652e authored by Alexandre Dulaunoy's avatar Alexandre Dulaunoy
Browse files

Merge pull request #67 from adulau/master

Bug fixes and initial code for NIST reference
parents ede99dd6 9285b8db
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -24,9 +24,9 @@ db = Configuration.getMongoConnection()
collection = db.cves


def dumpallcveid():
def dumpallcveid(limit=False):
    cveid = []
    for x in collection.find({}).sort('_id', 1):
    for x in collection.find({}).sort('_id', 1).limit(limit):
        cveid.append(x['id'])
    return cveid

@@ -34,6 +34,7 @@ argParser = argparse.ArgumentParser(description='Dump database in JSON format')
argParser.add_argument('-r', default=False, action='store_true', help='Include ranking value')
argParser.add_argument('-v', default=False, action='store_true', help='Include vfeed map')
argParser.add_argument('-c', default=False, action='store_true', help='Include CAPEC information')
argParser.add_argument('-l', default=False, type=int, help='Limit output to n elements (default: unlimited)')
args = argParser.parse_args()

rankinglookup = args.r
@@ -42,6 +43,6 @@ capeclookup = args.c

l = cves.last(rankinglookup=rankinglookup, vfeedlookup=vfeedlookup, capeclookup=capeclookup)

for cveid in dumpallcveid():
for cveid in dumpallcveid(limit=args.l):
    item = l.getcve(cveid=cveid)
    print (json.dumps(item, sort_keys=True, default=json_util.default))
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,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
Ref: https://cve.mitre.org/data/refs/refmap/allrefmaps.zip
[Webserver]
Host: 127.0.0.1
Port: 5000
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ class last:
                        if rank and rank not in ranking:
                            ranking.append(rank)
                e['vulnerable_configuration'] = vulconf
                if self.rankinglookup:
                if self.rankinglookup and len(ranking) > 0:
                    e['ranking'] = ranking
                if self.vfeedlookup:
                    f = self.getvfeed(cveid=cveid)
+5 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ 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",
               'ref': "https://cve.mitre.org/data/refs/refmap/allrefmaps.zip",
               'logging': True,           'logfile': "../log/cve-search.log",
               'maxLogSize': '100MB',     'backlog': 5,
               'Indexdir': './indexdir',
@@ -162,6 +163,10 @@ class Configuration():
    def getvFeedStatus(cls):
        return cls.readSetting("Sources", "vFeedStatus", cls.default['vFeedstatus'])

    @classmethod
    def getRefURL(cls):
        return cls.readSetting("Sources", "Ref", cls.default['ref'])

    @classmethod
    def getCVEDict(cls):
        return cls.readSetting("Sources", "CVE", cls.default['cvedict'])
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ def progressbar(it, prefix="Preparing ", size=50):
    count = len(it)

    def _show(_i):
        if count != 0:
        if count != 0 and sys.stdout.isatty():
            x = int(size * _i / count)
            sys.stdout.write("%s[%s%s] %i/%i\r" % (prefix, "#" * x, " " * (size - x), _i, count))
            sys.stdout.flush()
Loading