Skip to content

Instantly share code, notes, and snippets.

@ttimasdf ttimasdf/cve.patch
Last active Dec 18, 2017

What would you like to do?
My cve-search patch
diff --git a/sbin/ b/sbin/
index 4c904cf..37cd9c8 100755
--- a/sbin/
+++ b/sbin/
@@ -31,6 +31,7 @@ from lib.ProgressBar import progressbar
from lib.Toolkit import toStringFormattedCPE
from lib.Config import Configuration
import lib.DatabaseLayer as db
+from time import time
class CPEHandler(ContentHandler):
def __init__(self):
@@ -76,6 +77,7 @@ ch = CPEHandler()
# check modification date
+ print("Start getting feed data...", flush=True)
(f, r) = Configuration.getFeedData('cpe')
sys.exit("Cannot open url %s. Bad URL or not connected to the internet?"%(Configuration.getFeedURL("cpe")))
@@ -86,7 +88,9 @@ if i is not None:
print("Not modified")
# parse xml and store in database
+start = time()
+print("Parse succedded with {:.2f} seconds".format(time() - start))
for x in progressbar(ch.cpe):
x['id']= toStringFormattedCPE(x['name'])
@@ -94,7 +98,10 @@ for x in progressbar(ch.cpe):
x['cpe_2_2'] = x.pop('name')
if not x['references']: x.pop('references')
+ print(len(cpeList), "out of", len(ch.cpe), end='\r')
+print("\nstart db bulk update", flush=True)
db.bulkUpdate("cpe", cpeList)
#update database info after successful program-run
+print("start col update", flush=True)
db.setColUpdate('cpe', last_modified)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.