diff --git a/bin/cve_refs.py b/bin/cve_refs.py index 93cfe506b1a2282120538f3f9c230a1cb2ad00c4..779416879adeea4244c7bf3dcbd93fcc7e49dfea 100755 --- a/bin/cve_refs.py +++ b/bin/cve_refs.py @@ -19,7 +19,6 @@ sys.path.append(os.path.join(runPath, "..")) from lib.Config import Configuration try: - r = Configuration.getRedisRefConnection() except: sys.exit(1) diff --git a/bin/search.py b/bin/search.py index b0ecb01cc0fee06536494367da71fc8e616b3c04..044331f98f569d5cdd3c1d96afedc739b70dbeb1 100755 --- a/bin/search.py +++ b/bin/search.py @@ -504,7 +504,6 @@ if vSearch: # Search text in summary if summary_text: - for cveid in getCVEIDs(limit=nlimit): item = cves.getcve(cveid=cveid) if "cvss" in item: @@ -521,7 +520,6 @@ if summary_text: else: print(json.dumps(item, sort_keys=True, default=json_util.default)) else: - date_n_days_ago = datetime.now() - timedelta(days=last_ndays) # print(item['Published']) # print(type (item['Published'])) diff --git a/lib/ApiRequests.py b/lib/ApiRequests.py index a33511d146aac678ccbddd5349c6c34a7de35d76..6d3f9fd94e66eac9a0190032b3fbc5621885e35b 100644 --- a/lib/ApiRequests.py +++ b/lib/ApiRequests.py @@ -79,7 +79,6 @@ class JSONApiRequest(ApiRequest): ) return reason, 400 else: - results = database_connection.query_docs(**self.body) self.logger.debug( diff --git a/lib/CVEs.py b/lib/CVEs.py index c47c1b5e81b9842d09e4d95deba9f762f921b42e..43b881d20cff6569d18b22a42466a09cefdc57e4 100644 --- a/lib/CVEs.py +++ b/lib/CVEs.py @@ -38,7 +38,6 @@ class CveHandler(object): via4lookup=False, subscorelookup=False, ): - self.collectionname = collection self.rankinglookup = rankinglookup self.namelookup = namelookup @@ -104,7 +103,6 @@ class CveHandler(object): return e def getranking(self, cpeid=None, loosy=True): - if cpeid is None: return False diff --git a/lib/DatabaseLayer.py b/lib/DatabaseLayer.py index 3c136908cef32322dc1bffb031bdcef3ddd4694f..826b05c21a3d7aa6cbacf14359c503895fa9de78 100644 --- a/lib/DatabaseLayer.py +++ b/lib/DatabaseLayer.py @@ -38,6 +38,7 @@ mongo_version = db.command("buildinfo")["versionArray"] # to be removed in future with the conditional statements # and use allow_disk_use by default + # Functions def sanitize(x): if type(x) == pymongo.cursor.Cursor: diff --git a/lib/DatabasePlugins/config.py b/lib/DatabasePlugins/config.py index fd678205f735a335f42276d215558337c984fecf..938a42a142eac2c0c80a22aed75216ab37560709 100644 --- a/lib/DatabasePlugins/config.py +++ b/lib/DatabasePlugins/config.py @@ -9,7 +9,6 @@ class DatabasePluginNotFound(Exception): class DatabasePluginLoader(object): def __init__(self): - mods = [ {plugin: _local_vars[plugin]} for plugin in _local_vars diff --git a/lib/DatabasePlugins/mongodb.py b/lib/DatabasePlugins/mongodb.py index bc412c449aef8eace9c0aa4bfe51040ca555ba73..fbeadf4baa80bcb3f24b21f76c76f05064848841 100644 --- a/lib/DatabasePlugins/mongodb.py +++ b/lib/DatabasePlugins/mongodb.py @@ -337,7 +337,6 @@ class MongoPlugin(DatabasePluginBase): search_val = request_values["search[value]"] if search_val != "": - try: regex = re.compile(search_val, re.IGNORECASE) diff --git a/lib/DatabaseSchemaChecker.py b/lib/DatabaseSchemaChecker.py index 8e81198996aca5c4e3cad5ec83a2f5930c93009b..d25644dccdfea7fd6c1bba02e71da07b785e41ed 100644 --- a/lib/DatabaseSchemaChecker.py +++ b/lib/DatabaseSchemaChecker.py @@ -21,7 +21,6 @@ class SchemaChecker(object): self.logger = logging.getLogger("SchemaChecker") def validate_schema(self): - if hasattr(self.dbh.connection, "store_schema"): try: if ( @@ -56,7 +55,6 @@ class SchemaChecker(object): def update(self): try: - current_record = list(self.dbh.connection.store_schema.find({})) if len(current_record) != 0: diff --git a/lib/DownloadHandler.py b/lib/DownloadHandler.py index 85e9ecef9c28b52821ea24d0e2e1b3afd2b14623..58ca69875da1e50a7f2b0ac6e13ddc98909ae85a 100644 --- a/lib/DownloadHandler.py +++ b/lib/DownloadHandler.py @@ -167,7 +167,6 @@ class DownloadHandler(ABC): x = 0 while not_Done: - current_q_len = self.queue.qsize() if x % 10 == 0: @@ -179,7 +178,6 @@ class DownloadHandler(ABC): ) if current_q_len != 0: - if current_q_len != q_len: q_len = current_q_len dif = max_len - q_len @@ -292,7 +290,11 @@ class DownloadHandler(ABC): with open(filename, "wb") as f: f.write(gzip.GzipFile(fileobj=buf).read()) - elif content_type == "application/json" or content_type == "application/xml": + elif ( + content_type == "application/json" + or content_type == "application/xml" + or content_type == "text/xml" + ): filename = os.path.join(wd, url.split("/")[-1]) self.logger.debug("Saving file to: {}".format(filename)) diff --git a/lib/JSONFileHandler.py b/lib/JSONFileHandler.py index 38f74a63f6efff63df9c407f7e284f52faf2a71e..1c8b1979d3467da434e0262ad9e5bad7a58d1de7 100644 --- a/lib/JSONFileHandler.py +++ b/lib/JSONFileHandler.py @@ -20,7 +20,6 @@ class JSONFileHandler(DownloadHandler): return "<< JSONFileHandler:{} >>".format(self.feed_type) def file_to_queue(self, file_tuple): - working_dir, filename = file_tuple # adjust the interval counter for debug logging when updating diff --git a/lib/LogHandler.py b/lib/LogHandler.py index 47efc0c7b1a4bee63504671ef5504a17be09ec33..c2aae3c42a1a38b8510ac32a8e6f2a8336d06650 100644 --- a/lib/LogHandler.py +++ b/lib/LogHandler.py @@ -70,7 +70,6 @@ class HelperLogger(logging.Logger): } def __init__(self, name, level=logging.NOTSET): - super().__init__(name, level) def debug(self, msg, *args, **kwargs): diff --git a/lib/Sources_process.py b/lib/Sources_process.py index d383e4ccd21335d76be83c7ae962cbbec7d62a86..432ab6557f7fec9384de34240fc3b122fd951030 100644 --- a/lib/Sources_process.py +++ b/lib/Sources_process.py @@ -655,7 +655,6 @@ class VIADownloads(JSONFileHandler): self.logger = logging.getLogger("VIADownloads") def file_to_queue(self, file_tuple): - working_dir, filename = file_tuple for cve in self.ijson_handler.fetch(filename=filename, prefix=self.prefix): @@ -685,7 +684,6 @@ class VIADownloads(JSONFileHandler): ) def process_item(self, item): - if self.is_update: self.queue.put( DatabaseAction( @@ -737,7 +735,6 @@ class CAPECDownloads(XMLFileHandler): self.parser.setContentHandler(self.ch) def file_to_queue(self, file_tuple): - working_dir, filename = file_tuple self.parser.parse(filename) @@ -790,7 +787,6 @@ class CWEDownloads(XMLFileHandler): self.parser.setContentHandler(self.ch) def file_to_queue(self, file_tuple): - working_dir, filename = file_tuple self.parser.parse(filename) @@ -853,7 +849,6 @@ class CPERedisBrowser(object): start_time = time.time() for e in tqdm(self.cpes, desc="Inserting CPE's in redis"): - value = e["cpe_2_2"] (prefix, cpeversion, cpetype, vendor, product, version) = value.split( ":", 5 @@ -883,7 +878,6 @@ MongoAddIndex = namedtuple("MongoAddIndex", "index name") class DatabaseIndexer(object): def __init__(self): - self.indexes = { "cpe": [ MongoUniqueIndex(index=[("id", ASCENDING)], name="id", unique=True), @@ -934,7 +928,6 @@ class DatabaseIndexer(object): self.logger = logging.getLogger("DatabaseIndexer") def create_indexes(self, collection=None): - if collection is not None: try: for each in self.indexes[collection]: diff --git a/lib/Toolkit.py b/lib/Toolkit.py index fdfefcc37ef1ef09b1fe3ed8129531503f99e0a7..b127b8fdda242cd9a89596799d8de6d09d1ba904 100644 --- a/lib/Toolkit.py +++ b/lib/Toolkit.py @@ -107,7 +107,6 @@ def generate_title(cpe): cpe_split = cpe.split(":") # Do a very basic test to see if the CPE is valid if len(cpe_split) == 13: - # Combine vendor, product and version title = " ".join(cpe_split[3:6]) diff --git a/lib/XMLFileHandler.py b/lib/XMLFileHandler.py index f7f9271db230f285d37f6b39570b193fa00f84b4..14c1c9888ba6c5131c99557774277b1a6e959ca0 100644 --- a/lib/XMLFileHandler.py +++ b/lib/XMLFileHandler.py @@ -14,7 +14,6 @@ class XMLFileHandler(DownloadHandler): return "<< XMLFileHandler:{} >>".format(self.feed_type) def process_item(self, item): - if self.is_update: self.queue.put( DatabaseAction( diff --git a/lib/content_handlers.py b/lib/content_handlers.py index aa7fd5574a2a24e6439dc1b9dd58f55c1b31486f..0fc0457ecbee2d3faecc578cb997925e0a11d769 100644 --- a/lib/content_handlers.py +++ b/lib/content_handlers.py @@ -69,7 +69,6 @@ class CapecHandler(ContentHandler): self.execution_flow = defaultdict(dict) def startElement(self, name, attrs): - if name == "Attack_Pattern_Catalog": self.Attack_Pattern_Catalog_tag = True if name == "Attack_Patterns" and self.Attack_Pattern_Catalog_tag: @@ -222,7 +221,6 @@ class CapecHandler(ContentHandler): ) elif self.taxonomy_name == "WASC": - if "/" in self.entry_name_ch: url = "http://projects.webappsec.org/{}".format( self.entry_name_ch.replace("/", " and ").replace(" ", "-") @@ -379,7 +377,6 @@ class CWEHandler(ContentHandler): self.alternate_terms = False def startElement(self, name, attrs): - if name == "Weakness": self.weakness_tag = True self.statement = "" diff --git a/lib/cpe_conversion.py b/lib/cpe_conversion.py index fb6f98deedeb9bc5d202b67c156a25c03f5a8c57..1437282b59af0dd7c0594861f7d17aea7027e575 100644 --- a/lib/cpe_conversion.py +++ b/lib/cpe_conversion.py @@ -10,6 +10,7 @@ import re + # Convert cpe2.2 url encoded to cpe2.3 char escaped # cpe:2.3:o:cisco:ios:12.2%281%29 to cpe:2.3:o:cisco:ios:12.2\(1\) def unquote(cpe): diff --git a/lib/cpelist.py b/lib/cpelist.py index 4548bc80045f50a326cbf1182d93b71cf5f4fdf6..e9df5af3e583849883e1bdc089152ae08fc788b4 100644 --- a/lib/cpelist.py +++ b/lib/cpelist.py @@ -36,7 +36,6 @@ class CPEList: # insert to database def insert(self, cpe, cpeType, comments=None): try: - if comments is not None: comments = comments else: diff --git a/lib/db_action.py b/lib/db_action.py index d26fc712da6a8f4471133a2806ce554127e87bbb..d6b62e813efca320eadd44294dfba87a566a8516 100644 --- a/lib/db_action.py +++ b/lib/db_action.py @@ -4,11 +4,9 @@ from pymongo import InsertOne, UpdateOne class DatabaseAction(object): - actions = collections.namedtuple("Actions", "InsertOne UpdateOne")(0, 1) def __init__(self, action, collection, doc): - self.action = action self.collection = collection self.doc = doc diff --git a/lib/redis_q.py b/lib/redis_q.py index d6b49de38df882aa615d1ef093d8e3900975329d..263ea18e6ecd4085ceebb59014709faa0bc89195 100644 --- a/lib/redis_q.py +++ b/lib/redis_q.py @@ -33,7 +33,6 @@ class RedisQueue(object): return self._key def get_full_list(self): - entries = self.__db.lrange(self.key, 0, -1) self.__db.delete(self.key) diff --git a/sbin/db_blacklist.py b/sbin/db_blacklist.py index 1f18b2683073136391ba59ed4fc29d6ea6bc0c76..fd88b36021ad7cb4028d3690f673a8ec86763f62 100755 --- a/sbin/db_blacklist.py +++ b/sbin/db_blacklist.py @@ -54,6 +54,7 @@ args = argparser.parse_args() # Variables collection = "blacklist" + # Functions def importBlacklist(importFile): oList = CPEList(collection, args) diff --git a/sbin/db_cpe_browser.py b/sbin/db_cpe_browser.py index b5cd92f546096e8f6f64e128cd7c46449ce11e99..3375f43ac317c692fb023a9208612cb6d23f2de9 100755 --- a/sbin/db_cpe_browser.py +++ b/sbin/db_cpe_browser.py @@ -32,7 +32,6 @@ args = argParser.parse_args() if __name__ == "__main__": - if args.o: cpe = getAlternativeCPEs() crb = CPERedisBrowser(cpes=cpe) diff --git a/sbin/db_mgmt_cpe_dictionary.py b/sbin/db_mgmt_cpe_dictionary.py index 1699bed9be1c37ca65ef902719d69bb1a6b122a3..d3537cb1374088e4164705e6485eb14d8d751913 100755 --- a/sbin/db_mgmt_cpe_dictionary.py +++ b/sbin/db_mgmt_cpe_dictionary.py @@ -48,7 +48,6 @@ if __name__ == "__main__": cpd.logger.debug("{}".format(" ".join(sys.argv))) if args.u: - last_modified = cpd.update() elif args.p: diff --git a/sbin/db_mgmt_json.py b/sbin/db_mgmt_json.py index a2fa15a7b2c6c4dfc8ae32e1e2c5e4047211a175..aba99a87441fc2d64694a7c5315df816c4e20bcc 100755 --- a/sbin/db_mgmt_json.py +++ b/sbin/db_mgmt_json.py @@ -45,7 +45,6 @@ if __name__ == "__main__": cvd.logger.debug("{}".format(" ".join(sys.argv))) if args.u: - last_modified = cvd.update() elif args.p: diff --git a/sbin/db_mgmt_ref.py b/sbin/db_mgmt_ref.py index 2eeef8d45a8b0ce241af199dabd4ca69fa7cf472..30aa4942a71e5769dc8671eb70df8bc65fa5ab80 100755 --- a/sbin/db_mgmt_ref.py +++ b/sbin/db_mgmt_ref.py @@ -21,7 +21,6 @@ from lib.Config import Configuration # To Do: Implement REDIS if __name__ == "__main__": - via = VIADownloads() try: diff --git a/sbin/db_notification.py b/sbin/db_notification.py index 6355c42e5f6e54525564ef94a7a8464655c666b9..12fd3b16d07af910590dfc403e5f1cd2a4695570 100755 --- a/sbin/db_notification.py +++ b/sbin/db_notification.py @@ -49,7 +49,6 @@ args = argParser.parse_args() def checkreq(): - if args.c is None: print("You need at least one cpe or partial cpe entry (-c) \n") argParser.print_help() diff --git a/sbin/db_ranking.py b/sbin/db_ranking.py index cefd322bd18a807d86a8c53c6abbc6ef8fa789a5..1c3476928ae6988c2798a4924bb8956d448fa22d 100755 --- a/sbin/db_ranking.py +++ b/sbin/db_ranking.py @@ -66,7 +66,6 @@ def findranking(cpe=None, loosy=True): def removeranking(cpe=None): - if cpe is None or cpe == "": return False diff --git a/sbin/db_updater.py b/sbin/db_updater.py index 5cbf59192c41ec2f3f7f339bd2f3f2aca1e2b350..638060b3d921beec26df0934221594d60645d730 100755 --- a/sbin/db_updater.py +++ b/sbin/db_updater.py @@ -145,12 +145,10 @@ while loop: logger.info("Starting " + source["name"]) before = nbelement(collection=source["name"]) if args.f and source["name"] == "cpe": - cpd = CPEDownloads() cpd.populate() elif args.f and source["name"] == "cve": - cvd = CVEDownloads() cvd.populate() diff --git a/test/unit/test_cve_doc.py b/test/unit/test_cve_doc.py index 982275258a7faa10e3078490f34649bd90d894ab..78546ddad200d7b69efbcb61aff5c4e6151deb75 100644 --- a/test/unit/test_cve_doc.py +++ b/test/unit/test_cve_doc.py @@ -9,7 +9,6 @@ def runner(): def test_cve_doc(runner): - result = runner.runcommand("bin/cve_doc.py") test_results = result.stdout.replace("\n", "") diff --git a/test/unit/test_db_dump.py b/test/unit/test_db_dump.py index 790910daddf8471f13ca8bd7f33ad9708a184194..8c5fe518b5d3f61c19052e3babc938c0deaf9eeb 100644 --- a/test/unit/test_db_dump.py +++ b/test/unit/test_db_dump.py @@ -9,7 +9,6 @@ def runner(): def test_db_dump(runner): - result = runner.runcommand("bin/db_dump.py -l 1 -r -v -c") assert result.returncode == 0 diff --git a/test/unit/test_dump_last.py b/test/unit/test_dump_last.py index 29868068e696dff6d8e3c6ee45e09a81e41dc0e7..81c97eab41cc36d0b48cecfd4274f9a9a47b66ec 100644 --- a/test/unit/test_dump_last.py +++ b/test/unit/test_dump_last.py @@ -9,7 +9,6 @@ def runner(): def test_dump_last_atom(runner): - result = runner.runcommand("bin/dump_last.py -f atom -l 2") test_results = result.stdout.replace("\n", "") @@ -20,14 +19,12 @@ def test_dump_last_atom(runner): def test_dump_last_rss1(runner): - result = runner.runcommand("bin/dump_last.py -f rss1 -l 2") assert result.returncode == 0 def test_dump_last_rss2(runner): - result = runner.runcommand("bin/dump_last.py -f rss2 -l 2") assert result.returncode == 0 @@ -38,7 +35,6 @@ def test_dump_last_rss2(runner): def test_dump_last_html(runner): - result = runner.runcommand("bin/dump_last.py -f html -l 2") assert result.returncode == 0 @@ -46,7 +42,6 @@ def test_dump_last_html(runner): def test_dump_last_with_capec_and_cveranking(runner): - result = runner.runcommand("bin/dump_last.py -f atom -c -r -l 2") assert result.returncode == 0 diff --git a/test/unit/test_search.py b/test/unit/test_search.py index 81af71a962ace4253c6db239983918efc9448454..291c27fbd14fcdbf5db9917446e0461a83264662 100644 --- a/test/unit/test_search.py +++ b/test/unit/test_search.py @@ -10,7 +10,6 @@ def runner(): def test_search(runner): - result = runner.runcommand("bin/search.py -p cisco:ios:12.4") assert result.returncode == 0 @@ -18,7 +17,6 @@ def test_search(runner): def test_search_lax(runner): - result = runner.runcommand("bin/search.py -p cisco:ios:12.4 --lax") assert result.returncode == 0 @@ -26,7 +24,6 @@ def test_search_lax(runner): def test_search_if_vuln(runner): - result = runner.runcommand("bin/search.py -p cisco:ios:12.4 --only-if-vulnerable") assert result.returncode == 0 @@ -34,7 +31,6 @@ def test_search_if_vuln(runner): def test_search_json(runner): - result = runner.runcommand( "bin/search.py -p cpe:2.3:o:microsoft:windows_7:*:sp1:*:*:*:*:*:* -o json" ) @@ -46,7 +42,6 @@ def test_search_json(runner): def test_search_html(runner): - result = runner.runcommand( "bin/search.py -p cpe:2.3:o:microsoft:windows_7:*:sp1:*:*:*:*:*:* -o html" ) @@ -56,7 +51,6 @@ def test_search_html(runner): def test_search_xml(runner): - result = runner.runcommand( "bin/search.py -p cpe:2.3:o:microsoft:windows_7:*:sp1:*:*:*:*:*:* -o xml" ) @@ -66,7 +60,6 @@ def test_search_xml(runner): def test_search_cveid(runner): - result = runner.runcommand( "bin/search.py -p cpe:2.3:o:microsoft:windows_7:*:sp1:*:*:*:*:*:* -o cveid" ) @@ -76,7 +69,6 @@ def test_search_cveid(runner): def test_search_cveid_desc(runner): - result = runner.runcommand( "bin/search.py -p cpe:2.3:o:microsoft:windows_7:*:sp1:*:*:*:*:*:* -o csv -l" ) @@ -89,7 +81,6 @@ def test_search_cveid_desc(runner): def test_search_nra(runner): - result = runner.runcommand("bin/search.py -p openstack:keystone -n -r -a") assert result.returncode == 0 @@ -97,7 +88,6 @@ def test_search_nra(runner): def test_search_vendor(runner): - result = runner.runcommand( "bin/search.py -p microsoft:windows_7 --strict_vendor_product" ) @@ -107,21 +97,18 @@ def test_search_vendor(runner): def test_search_summary(runner): - result = runner.runcommand("bin/search.py -s flaw -i 1") assert result.returncode == 0 def test_search_ti(runner): - result = runner.runcommand("bin/search.py -p microsoft:windows_7 -t 30 -i 1") assert result.returncode == 0 def test_search_cve(runner): - result = runner.runcommand("bin/search.py -c CVE-2010-3333") assert result.returncode == 0 diff --git a/test/unit/test_search_cpe.py b/test/unit/test_search_cpe.py index 0a7f8dc46c5ab83ccea5a7175bae727bb9f6a08a..2d9995b8aad6f71b708caaf1cf121103e9818510 100644 --- a/test/unit/test_search_cpe.py +++ b/test/unit/test_search_cpe.py @@ -9,7 +9,6 @@ def runner(): def test_search_cpe(runner): - result = runner.runcommand("bin/search_cpe.py -s wordpress") resultlist = result.stdout.split("\n") @@ -29,21 +28,18 @@ def test_search_cpe(runner): def test_search_cpe_json(runner): - result = runner.runcommand("bin/search_cpe.py -s wordpress -o json") assert result.returncode == 0 def test_search_cpe_compact(runner): - result = runner.runcommand("bin/search_cpe.py -s wordpress -o compact") assert result.returncode == 0 def test_search_cpe_csv(runner): - result = runner.runcommand("bin/search_cpe.py -s wordpress -o csv") assert result.returncode == 0 diff --git a/web/admin/views.py b/web/admin/views.py index ec4640ec7ab8bc1010d410f5889a52cbe7a1aa5d..4dd6a5258c4f656b48544af07dc3eff3ae9eee57 100644 --- a/web/admin/views.py +++ b/web/admin/views.py @@ -53,7 +53,6 @@ default_breadcrumb_root(admin, ".Admin") @register_breadcrumb(admin, ".", "Admin") @login_required def admin_home(): - enabled_plugins = [x.identifier for x in list(get_enabled_plugins())] return render_template( @@ -69,7 +68,6 @@ def admin_home(): @admin.route("/change_pass", methods=["GET", "POST"]) @login_required def change_pass(): - post_data = dict(request.json) current_pass = post_data["current_pass"] @@ -226,7 +224,6 @@ def listEdit(): def view_listmanagement(*args, **kwargs): - try: product = request.view_args["product"] except KeyError: @@ -318,7 +315,6 @@ def listManagement(vendor=None, product=None): @admin.route("/listmanagement/add", methods=["GET", "POST"]) @login_required def listManagementAdd(): - # this functionality is broken; needs further investigation.... post_data = dict(request.json) diff --git a/web/auth/views.py b/web/auth/views.py index e62a5bf31957ab9f17545f498bc6dd2f41d0cb33..6ac4ce58ed41c0b1665d63728d02dad2e0bf7ae3 100644 --- a/web/auth/views.py +++ b/web/auth/views.py @@ -56,7 +56,6 @@ def get_session( def get_idp_provider_cfg(): - with get_session() as session: data = session.get( config.getIDPDiscoveryUrl(), verify=config.useSSLVerify() @@ -146,7 +145,6 @@ def oidcLogin(): @auth.route("/login", methods=["GET", "POST"]) def login(): - form = LoginForm() if current_user.is_authenticated: @@ -162,7 +160,6 @@ def login(): return redirect(url_for("admin.admin_home")) if form.validate_on_submit(): - # validate username and password username = request.form.get("username") password = request.form.get("password") diff --git a/web/helpers/server_side_datatables.py b/web/helpers/server_side_datatables.py index adb3dc5e474797e078bc5f0c0da8d20ca13fc8be..e68bc84668484aadf33411fb06b1e7092cfbd1d0 100644 --- a/web/helpers/server_side_datatables.py +++ b/web/helpers/server_side_datatables.py @@ -16,7 +16,6 @@ class ServerSideDataTable(object): """ def __init__(self, request, backend, additional_filters=None): - self.request_values = request.values self.backend = backend @@ -40,7 +39,6 @@ class ServerSideDataTable(object): self._pre_fetch_processing() def output_result(self): - retdata = { "draw": int(self.current_draw), "recordsTotal": int(self.total), diff --git a/web/home/utils.py b/web/home/utils.py index cf82138d552712941d94f6a01b2bcf21990070ed..6134f7567ff0ba3667dcd07abfbc3da0e4add725 100644 --- a/web/home/utils.py +++ b/web/home/utils.py @@ -211,7 +211,6 @@ def filterUpdateField(data): def validateFilter(filter_params): - # CVSS must be a number betreen 0 and 10. try: cvss = float(filter_params["cvss"]) @@ -288,7 +287,6 @@ def adminInfo(output=None): def parse_headers(headers): - ret_dict = {} for key, val in headers.items(): diff --git a/web/home/views.py b/web/home/views.py index 4f6b61ba3282e2eee7d98b5889ddf097f64cccc1..d26c41b1b4dc595e6a0e4ef2b5933296b552ca61 100644 --- a/web/home/views.py +++ b/web/home/views.py @@ -39,7 +39,6 @@ def index(): def view_vendor_name(*args, **kwargs): - try: return [ {"text": "Vendor-List", "url": "{}browse".format(url_for("home.index"))}, @@ -59,7 +58,6 @@ def view_vendor_name(*args, **kwargs): @register_breadcrumb(home, ".browse", "", dynamic_list_constructor=view_vendor_name) def browse_vendor(vendor=None): if vendor is None: - return render_template("browse_vendor.html", **config_args) else: @@ -81,7 +79,6 @@ def browse_vendor(vendor=None): @home.route("/browse/fetch_data", methods=["POST"]) def browse_fetch_data(): - retdata = { "data": [ {"vendors": x} @@ -133,7 +130,6 @@ def cve(cve_id): def view_cwe_id_name(*args, **kwargs): - try: return [ {"text": "CWE-List", "url": "{}cwe".format(url_for("home.index"))}, @@ -164,7 +160,6 @@ def get_cwe(cwe_id=None): def view_capec_id_name(*args, **kwargs): - return [ { "text": "CAPEC-{}".format(request.view_args["capec_id"]), diff --git a/web/index.py b/web/index.py index a59c653759f1d782fed2af111519e605e2286d5e..f9cf15bf196cceb5b1342797daccf36c6355bae3 100644 --- a/web/index.py +++ b/web/index.py @@ -30,7 +30,6 @@ __version__ = _version() def start(): - # get properties flaskHost = config.getFlaskHost() flaskPort = config.getFlaskPort() diff --git a/web/run.py b/web/run.py index 25421fe2a572b43918d0dbafde90b8603450c5e9..4577c93c31257ffb118a326fd558039e18d9a47f 100644 --- a/web/run.py +++ b/web/run.py @@ -38,7 +38,6 @@ REFRESH_EXPIRES = timedelta(days=30) def create_app(version, run_path): - global app, token_blacklist, socketio, oidcClient, config app = Flask(__name__) @@ -76,7 +75,6 @@ def create_app(version, run_path): @jwt.additional_claims_loader def add_claims_to_access_token(identity): - return {"user": identity} @jwt.token_in_blocklist_loader diff --git a/web/wsgi.py b/web/wsgi.py index 39643646274ac39a131898c9da10d2aba6afe34a..7c04f1ae77e49ac4e17e86ef5686462554803847 100644 --- a/web/wsgi.py +++ b/web/wsgi.py @@ -22,5 +22,4 @@ app.wsgi_app = DispatcherMiddleware(Flask("FRAME"), {config.getMountPath(): cvea if __name__ == "__main__": - app.run(host="0.0.0.0")