Commit 767a45c2 authored by Pieter-Jan's avatar Pieter-Jan
Browse files

Merge pull request #99 from PidgeyL/development

Development
parents d39a023d dc86fe0e
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -185,6 +185,12 @@ class CVEHandler(ContentHandler):
            self.inPUBElem = 0
            self.cves[-1]['Modified'] = self.PUB

def getFile(getfile):
    try:
        return urlopen(Configuration.getCVEDict() + getfile)
    except:
        sys.exit("Cannot open url %s. Bad URL or not connected to the internet?"%(Configuration.getCVEDict() + getfile))

if __name__ == '__main__':
    # connect to the DB.
    db = Configuration.getMongoConnection()
@@ -197,7 +203,7 @@ if __name__ == '__main__':
    if args.u:
        # get the 'modified' file
        getfile = file_prefix + file_mod + file_suffix
        f = urlopen(Configuration.getCVEDict() + getfile)
        f = getFile(getfile)
        i = info.find_one({'db': 'cve'})
        if i is not None:
            if f.headers['last-modified'] == i['last-modified']:
@@ -225,7 +231,7 @@ if __name__ == '__main__':
                collection.insert(item)
        # get the 'recent' file
        getfile = file_prefix + file_rec + file_suffix
        f = urlopen(Configuration.getCVEDict() + getfile)
        f = getFile(getfile)
        parser = make_parser()
        ch = CVEHandler()
        parser.setContentHandler(ch)
@@ -264,7 +270,7 @@ if __name__ == '__main__':
                ch = CVEHandler()
                parser.setContentHandler(ch)
                getfile = file_prefix + str(x) + file_suffix
                f = urlopen(Configuration.getCVEDict() + getfile)
                f = getFile(getfile)
                parser.parse(f)
                if args.v:
                    for item in ch.cves:
+4 −1
Original line number Diff line number Diff line
@@ -167,7 +167,10 @@ parser = make_parser()
ch = CapecHandler()
parser.setContentHandler(ch)
# check modification date
try:
    f = urlopen(capecurl)
except:
    sys.exit("Cannot open url %s. Bad URL or not connected to the internet?"%(capecurl))
i = info.find_one({'db': 'capec'})
if i is not None:
    if f.headers['last-modified'] == i['last-modified']:
+4 −1
Original line number Diff line number Diff line
@@ -81,7 +81,10 @@ parser = make_parser()
ch = CPEHandler()
parser.setContentHandler(ch)
# check modification date
try:
    f = urlopen(cpedict)
except:
    sys.exit("Cannot open url %s. Bad URL or not connected to the internet?"%(cpedict))
i = info.find_one({'db': 'cpe'})
if i is not None:
    if f.headers['last-modified'] == i['last-modified']:
+4 −1
Original line number Diff line number Diff line
@@ -83,7 +83,10 @@ parser = make_parser()
ch = CWEHandler()
parser.setContentHandler(ch)
# check modification date
try:
    f = urlopen(cwedict)
except:
    sys.exit("Cannot open url %s. Bad URL or not connected to the internet?"%(cwedict))
lastmodified = f.headers['last-modified']
i = info.find_one({'db': 'cwe'})
if i is not None:
+4 −1
Original line number Diff line number Diff line
@@ -101,7 +101,10 @@ parser = make_parser()
ch = ExploitHandler()
parser.setContentHandler(ch)
# check modification date
try:
    f = urlopen(d2securl)
except:
    sys.exit("Cannot open url %s. Bad URL or not connected to the internet?"%(d2securl))
i = info.find_one({'db': 'd2sec'})
if i is not None:
    if f.headers['last-modified'] == i['last-modified']:
Loading