def delete(self): """ Remove Deletes a CPE from the blacklist. """ if not request.is_json: wl.abort(400, "Missing JSON in request") if isinstance(request.json, list): ret_val = defaultdict(str) for each in request.json: cpe = each.get("cpe", None) if not cpe: wl.abort(400, "Missing cpe parameter in request body") ret_val[cpe] = removeBlacklist(cpe) ret_val = json.dumps(dict(ret_val)) else: cpe = request.json.get("cpe", None) if not cpe: wl.abort(400, "Missing cpe parameter in request body") ret_val = removeBlacklist(cpe) return {"message": ret_val}
def listRemove(self): cpe = request.args.get('cpe', type=str) cpe = urllib.parse.quote_plus(cpe).lower() user = current_user.get_id() cpe = cpe.replace("%3a", ":") cpe = cpe.replace("%2f", "/") lst = request.args.get('list', type=str) if cpe and lst: result = wl.removeWhitelist( cpe, user) if lst.lower() == "whitelist" else bl.removeBlacklist( cpe, user) status = "removed_from_list" if ( result > 0) else "already_removed_from_list" else: status = "invalid_cpe" returnList = db.getWhitelist(user=current_user.get_id( )) if lst == "Whitelist" else db.getBlacklist( user=current_user.get_id()) pprint("Returned list {0}".format(returnList)) return jsonify({ "status": status, "rules": returnList, "listType": lst.title() })
def listRemove(self): cpe = request.args.get('cpe', type=str) cpe = urllib.parse.quote_plus(cpe).lower() cpe = cpe.replace("%3a", ":") cpe = cpe.replace("%2f", "/") lst = request.args.get('list', type=str) if cpe and lst: result=wl.removeWhitelist(cpe) if lst.lower()=="whitelist" else bl.removeBlacklist(cpe) status = "removed_from_list" if (result > 0) else "already_removed_from_list" else: status = "invalid_cpe" returnList = db.getWhitelist() if lst=="whitelist" else db.getBlacklist() return jsonify({"status":status, "rules":returnList, "listType":lst.title()})
def listRemove(): cpe = request.args.get("cpe", type=str) cpe = urllib.parse.quote_plus(cpe).lower() cpe = cpe.replace("%3a", ":") cpe = cpe.replace("%2f", "/") cpe = cpe.replace("%2a", "*") lst = request.args.get("list", type=str) if cpe and lst: result = ( removeWhitelist(cpe) if lst.lower() == "whitelist" else removeBlacklist(cpe) ) status = "removed_from_list" if (result > 0) else "already_removed_from_list" else: status = "invalid_cpe" returnList = getWhitelist() if lst.lower() == "whitelist" else getBlacklist() return jsonify({"status": status, "rules": returnList, "listType": lst.title()})
def api_admin_remove_blacklist(self): return bl.removeBlacklist(request.form['cpe'])
def api_admin_remove_blacklist(self): return bl.removeBlacklist(request.form['cpe'])