def onCVEAction(self, cve, action, **args): if action == "filter": try: filters = {x.split("=")[0]: x.split("=")[1] for x in args["fields"]['filter'][0].split("&")} filters = {x: urllib.parse.unquote(y) for x,y in filters.items()} fields = json.loads(args["fields"]["fields"][0]) limit = 0 skip = 0 cves = self.filter_logic(filters, limit, skip, args["plugin_manager"], **args) return {'status': 'plugin_action_complete', 'data': self.generateCSV(cves, fields)} except Exception as e: traceback.print_exc() return False elif action == "textsearch": try: text = args["fields"]["text"][0] fields = json.loads(args["fields"]["fields"][0]) dbResults = db.getSearchResults(text) plugResults = args["plugin_manager"].getSearchResults(text, **args) result = mergeSearchResults(dbResults, plugResults) cves=result['data'] fields["reason"] = True return {'status': 'plugin_action_complete', 'data': self.generateCSV(cves, fields)} except Exception as e: traceback.print_exc() return False
def searchText(): search = request.form.get('search') dbResults = db.getSearchResults(search) plugResults = plugManager.getSearchResults(search, **pluginArgs()) result = mergeSearchResults(dbResults, plugResults) cve = result['data'] errors = result['errors'] if 'errors' in result else [] return render_template('search.html', cve=cve, errors=errors)
def searchText(): search = request.form.get('search') dbResults = db.getSearchResults(search) plugResults = plugManager.getSearchResults(search) result = mergeSearchResults(dbResults, plugResults) cve=result['data'] errors=result['errors'] if 'errors' in result else [] return render_template('search.html', cve=cve, errors=errors)