def listManagement(self, vendor=None, product=None): try: if product is None: # no product selected yet, so same function as /browse can be used if vendor: vendor = urllib.parse.quote_plus(vendor).lower() browseList = query.getBrowseList(vendor) vendor = browseList["vendor"] product = browseList["product"] version = None else: # product selected, product versions required version = query.getVersionsOfProduct( urllib.parse.quote_plus(product).lower()) return render_template('listmanagement.html', vendor=vendor, product=product, version=version) except redisExceptions.ConnectionError: return render_template('error.html', status={ 'except': 'redis-connection', 'info': { 'host': Configuration.getRedisHost(), 'port': Configuration.getRedisPort() } })
def listManagement(self, vendor=None, product=None): try: if product is None: # no product selected yet, so same function as /browse can be used if vendor: vendor = urllib.parse.quote_plus(vendor).lower() browseList = getBrowseList(vendor) vendor = browseList["vendor"] product = browseList["product"] version = None else: # product selected, product versions required version = getVersionsOfProduct( urllib.parse.quote_plus(product).lower()) return render_template("listmanagement.html", vendor=vendor, product=product, version=version) except redisExceptions.ConnectionError: return render_template( "error.html", status={ "except": "redis-connection", "info": { "host": Configuration.getRedisHost(), "port": Configuration.getRedisPort(), }, }, )
def browse(vendor=None): try: if vendor is not None: vendor = urllib.parse.quote_plus(vendor).lower() browseList = getBrowseList(vendor) vendor = browseList["vendor"] product = browseList["product"] return render_template("browse.html", product=product, vendor=vendor) except redisExceptions.ConnectionError: return render_template( "error.html", status={ "except": "redis-connection", "info": {"host": Configuration.getRedisHost(), "port": Configuration.getRedisPort()}, }, )
def browse(vendor=None): try: if vendor is not None: vendor = urllib.parse.quote_plus(vendor).lower() browseList = getBrowseList(vendor) vendor = browseList["vendor"] product = browseList["product"] return render_template('browse.html', product=product, vendor=vendor) except redisExceptions.ConnectionError: return render_template('error.html', status={ 'except': 'redis-connection', 'info': { 'host': Configuration.getRedisHost(), 'port': Configuration.getRedisPort() } })
def listManagement(vendor=None, product=None): try: if product is None: # no product selected yet, so same function as /browse can be used if vendor: vendor = urllib.parse.quote_plus(vendor).lower() browseList = getBrowseList(vendor) vendor = browseList["vendor"] product = browseList["product"] version = None else: # product selected, product versions required version = getVersionsOfProduct(urllib.parse.quote_plus(product).lower()) status = ["default", "none"] return render_template("listmanagement.html", status=status, vendor=vendor, product=product, version=version) except redisExceptions.ConnectionError: return render_template( "error.html", status={ "except": "redis-connection", "info": {"host": Configuration.getRedisHost(), "port": Configuration.getRedisPort()}, }, )
def browse(vendor=None): try: if vendor is not None: vendor = urllib.parse.quote_plus(vendor).lower() browseList = getBrowseList(vendor) vendor = browseList["vendor"] product = browseList["product"] return render_template('browse.html', product=product, vendor=vendor) except redisExceptions.ConnectionError: return render_template('error.html', status={'except':'redis-connection', 'info':{'host':Configuration.getRedisHost(),'port':Configuration.getRedisPort()}})
import shutil verbose = False from lib.Config import Configuration import lib.DatabaseLayer as db try: r = Configuration.getRedisRefConnection() except: sys.exit(1) try: r.info() except: sys.exit("Redis server not running on %s:%s"%(Configuration.getRedisHost(),Configuration.getRedisPort())) RefUrl = Configuration.getRefURL() tmppath = Configuration.getTmpdir() argparser = argparse.ArgumentParser(description='Populate/update the NIST ref database') argparser.add_argument('-v', action='store_true', help='verbose output', default=False) args = argparser.parse_args() if args.v: verbose = True # check modification date try: u = Configuration.getFile(RefUrl)
verbose = False from lib.Config import Configuration import lib.DatabaseLayer as db try: r = Configuration.getRedisRefConnection() except: sys.exit(1) try: r.info() except: sys.exit("Redis server not running on %s:%s" % (Configuration.getRedisHost(), Configuration.getRedisPort())) tmppath = Configuration.getTmpdir() argparser = argparse.ArgumentParser( description='Populate/update the NIST ref database') argparser.add_argument('-v', action='store_true', help='verbose output', default=False) args = argparser.parse_args() if args.v: verbose = True # check modification date
def listManagement(vendor=None, product=None): try: if product is None: # no product selected yet, so same function as /browse can be used if vendor: vendor = urllib.parse.quote_plus(vendor).lower() browseList = getBrowseList(vendor) vendor = browseList["vendor"] product = browseList["product"] version = None else: # product selected, product versions required version = getVersionsOfProduct(urllib.parse.quote_plus(product).lower()) return render_template('listmanagement.html', vendor=vendor, product=product, version=version) except redisExceptions.ConnectionError: return render_template('error.html', status={'except':'redis-connection', 'info':{'host':Configuration.getRedisHost(),'port':Configuration.getRedisPort()}})
r = Configuration.getRedisVendorConnection() except: sys.exit(1) for e in cpe.find({}): try: if args.o is not True: prefix = 'cpe_2_2' value = e[prefix] else: value = e['id'] if args.o is not True: if e[prefix].count(':') > 4: value = ":".join(value.split(':')[:5]) (prefix, cpetype, vendor, product, version) = pad(value.split(':'),5) else: (prefix, cpeversion, cpetype, vendor, product, version, *remaining) = pad(value.split(':'),6) except Exception as ex: print(ex) pass try: if args.v: print(value + " added") r.sadd("prefix:" + prefix, cpetype) r.sadd("t:" + cpetype, vendor) r.sadd("v:" + vendor, product) if version: r.sadd("p:" + product, version) except redisExceptions.ConnectionError: sys.exit("Redis server not running on %s:%s"%(Configuration.getRedisHost(),Configuration.getRedisPort()))