Commit 04ff3d5a authored by Alexandre Dulaunoy's avatar Alexandre Dulaunoy
Browse files

Merge pull request #81 from adulau/master

Various updates and fixes
parents 2af0603c 43b2e42c
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -8,6 +8,8 @@ RefDB: 12
Host: localhost
Host: localhost
Port: 27017
Port: 27017
DB: cvedb
DB: cvedb
[dbmgt]
Tmpdir: ./tmp/
[FulltextIndex]
[FulltextIndex]
Indexdir: ./indexdir/
Indexdir: ./indexdir/
[Sources]
[Sources]
+6 −0
Original line number Original line Diff line number Diff line
@@ -50,6 +50,7 @@ class Configuration():
               'logging': True,           'logfile': "../log/cve-search.log",
               'logging': True,           'logfile': "../log/cve-search.log",
               'maxLogSize': '100MB',     'backlog': 5,
               'maxLogSize': '100MB',     'backlog': 5,
               'Indexdir': './indexdir',
               'Indexdir': './indexdir',
               'Tmpdir': './tmp',
               'includeCapec': True,      'includeD2Sec': True,
               'includeCapec': True,      'includeD2Sec': True,
               'includeVFeed': True,      'includeVendor': True,
               'includeVFeed': True,      'includeVendor': True,
               'includeCWE': True,
               'includeCWE': True,
@@ -258,6 +259,11 @@ class Configuration():
    def getBacklog(cls):
    def getBacklog(cls):
        return cls.readSetting("Logging", "Backlog", cls.default['backlog'])
        return cls.readSetting("Logging", "Backlog", cls.default['backlog'])


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

    # Indexing
    # Indexing
    @classmethod
    @classmethod
    def getIndexdir(cls):
    def getIndexdir(cls):
+1 −0
Original line number Original line Diff line number Diff line
@@ -8,5 +8,6 @@ flask-pymongo
tornado
tornado
passlib
passlib
xlrd
xlrd
lxml
https://github.com/marianoguerra/feedformatter/archive/master.zip
https://github.com/marianoguerra/feedformatter/archive/master.zip
six>=1.9.0
six>=1.9.0
+1 −1
Original line number Original line Diff line number Diff line
#!/usr/local/bin/python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
# Import script of cpe (Common Platform Enumeration) definition
# Import script of cpe (Common Platform Enumeration) definition
+6 −5
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ def minimalist_xldate_as_datetime(xldate, datemode):


# dictionary
# dictionary
msbulletinurl = Configuration.getMSBULLETINDict()
msbulletinurl = Configuration.getMSBULLETINDict()
tmppath = Configuration.getTmpdir()


# connect to db
# connect to db
db = Configuration.getMongoConnection()
db = Configuration.getMongoConnection()
@@ -39,13 +40,13 @@ if i is not None:
        print("Not modified")
        print("Not modified")
        sys.exit(0)
        sys.exit(0)


if not os.path.exists('./tmp'):
if not os.path.exists(tmppath):
    os.mkdir('./tmp')
    os.mkdir(tmppath)
with open('./tmp/BulletinSearch.xls', 'wb') as fp:
with open(tmppath+'/BulletinSearch.xls', 'wb') as fp:
    shutil.copyfileobj(f, fp)
    shutil.copyfileobj(f, fp)
     
     
# parse xlsx and store in database
# parse xlsx and store in database
wb = xlrd.open_workbook('./tmp/BulletinSearch.xls')
wb = xlrd.open_workbook(tmppath+'/BulletinSearch.xls')
sh = wb.sheet_by_name('Bulletin Search')
sh = wb.sheet_by_name('Bulletin Search')
header = [s.replace('\n', ' ') for s in sh.row_values(0)]
header = [s.replace('\n', ' ') for s in sh.row_values(0)]
bulletin = {}
bulletin = {}
@@ -92,7 +93,7 @@ for rownum in range(sh.nrows-1):


#update database info after successful program-run
#update database info after successful program-run
info.update({'db': 'ms'}, {"$set": {'last-modified': f.headers['last-modified']}}, upsert=True)
info.update({'db': 'ms'}, {"$set": {'last-modified': f.headers['last-modified']}}, upsert=True)
shutil.rmtree('./tmp')
# shutil.rmtree('./tmp')






Loading