if args.v: log("==========================") log(time.strftime("%a %d %B %Y %H:%M", time.gmtime())) log("==========================") if not args.l: loop = False newelement = 0 for source in sources: if not Configuration.includesFeed(source['name']): continue if args.f and source['name'] is not "redis-cache-cpe": log("Dropping collection: " + source['name']) dropcollection(collection=source['name']) log(source['name'] + " dropped") if source['name'] is "cpeother": if "cpeother" not in db.getTableNames(): continue if source['name'] is not "redis-cache-cpe": log('Starting ' + source['name']) before = nbelement(collection=source['name']) if args.f and source['name'] is "cves": updater = "{} {}".format( sys.executable, os.path.join(runPath, "db_mgmt.py -p")) subprocess.Popen((shlex.split(updater))).wait() else: subprocess.Popen((shlex.split(source['updater']))).wait() after = nbelement(collection=source['name']) message = source['name'] + " has " + str( after) + " elements (" + str(after - before) + " update)" newelement = str(after - before) log(message)
logging("Dropping metadata") dropcollection("info") while (loop): if not args.l: loop = False newelement = 0 for source in sources: if not Configuration.includesFeed(source['name']): continue if args.f and source['name'] is not "redis-cache-cpe": logging("Dropping collection: " + source['name']) dropcollection(collection=source['name']) logging( source['name'] + " dropped") if source['name'] is "cpeother": if "cpeother" not in dbLayer.getTableNames(): continue if source['name'] is not "redis-cache-cpe": message = 'Starting ' + source['name'] logging(message) before = nbelement(collection=source['name']) if args.f and source['name'] is "cves": updater = "python3 " + os.path.join(runPath, "db_mgmt.py -p") subprocess.Popen((shlex.split(updater))).wait() else: subprocess.Popen((shlex.split(source['updater']))).wait() after = nbelement(collection=source['name']) message = source['name'] + " has " + str(after) + " elements (" + str(after - before) + " update)" newelement = str(after - before) logging(message) elif (args.c is True and source['name'] is "redis-cache-cpe"):
if args.v: log("==========================") log(time.strftime("%a %d %B %Y %H:%M", time.gmtime())) log("==========================") if not args.l: loop = False newelement = 0 for source in sources: if not Configuration.includesFeed(source['name']) and source['name'] is not "redis-cache-cpe": continue if args.f and source['name'] is not "redis-cache-cpe": log("Dropping collection: " + source['name']) dropcollection(collection=source['name']) log( source['name'] + " dropped") if source['name'] is "cpeother": if "cpeother" not in db.getTableNames(): continue if source['name'] is not "redis-cache-cpe": log('Starting ' + source['name']) before = nbelement(collection=source['name']) if args.f and source['name'] is "cves": updater = "{} {} {}".format(sys.executable, os.path.join(runPath, "db_mgmt.py"), "-p") subprocess.Popen((shlex.split(updater))).wait() else: subprocess.Popen((shlex.split(source['updater']))).wait() after = nbelement(collection=source['name']) message = source['name'] + " has " + str(after) + " elements (" + str(after - before) + " update)" newelement = str(after - before) log(message) elif (args.c is True and source['name'] is "redis-cache-cpe"): log('Starting ' + source['name'])