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 Diff line number Diff line
@@ -8,6 +8,8 @@ RefDB: 12
Host: localhost
Port: 27017
DB: cvedb
[dbmgt]
Tmpdir: ./tmp/
[FulltextIndex]
Indexdir: ./indexdir/
[Sources]
+6 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ class Configuration():
               '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,
@@ -258,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):
+1 −0
Original line number Diff line number Diff line
@@ -8,5 +8,6 @@ flask-pymongo
tornado
passlib
xlrd
lxml
https://github.com/marianoguerra/feedformatter/archive/master.zip
six>=1.9.0
+1 −1
Original line number Diff line number Diff line
#!/usr/local/bin/python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Import script of cpe (Common Platform Enumeration) definition
+6 −5
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ def minimalist_xldate_as_datetime(xldate, datemode):

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

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

if not os.path.exists('./tmp'):
    os.mkdir('./tmp')
with open('./tmp/BulletinSearch.xls', 'wb') as fp:
if not os.path.exists(tmppath):
    os.mkdir(tmppath)
with open(tmppath+'/BulletinSearch.xls', 'wb') as fp:
    shutil.copyfileobj(f, fp)
     
# 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')
header = [s.replace('\n', ' ') for s in sh.row_values(0)]
bulletin = {}
@@ -92,7 +93,7 @@ for rownum in range(sh.nrows-1):

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



Loading