def capec(capec_id): data = getCWEs() cwes = {x["id"]: x["name"] for x in data} req_capec = getCAPEC(capec_id) rel_capecs = defaultdict(dict) if len(req_capec["related_capecs"]) != 0: for each in req_capec["related_capecs"]: rel_capecs[each] = getCAPEC(each)["summary"] return render_template("capec.html", cwes=cwes, capecs=dict(rel_capecs), capec=req_capec)
def capec(self, capecid): cwes = {x["id"]: x["name"] for x in self.api_cwe()} req_capec = getCAPEC(capecid) rel_capecs = defaultdict(dict) if len(req_capec["related_capecs"]) != 0: for each in req_capec["related_capecs"]: rel_capecs[each] = getCAPEC(each)["summary"] return render_template("capec.html", cwes=cwes, capecs=dict(rel_capecs), capec=req_capec, minimal=self.minimal)
def capec(capec_id): data = getCWEs() cwes = {x["id"]: x["name"] for x in data} req_capec = getCAPEC(capec_id) if req_capec is None: return render_template( "error.html", status={"except": "capec-not-found", "info": {"capec": capec_id}}, ) rel_capecs = defaultdict(dict) if len(req_capec["related_capecs"]) != 0: for each in req_capec["related_capecs"]: rel_capecs[each] = getCAPEC(each)["summary"] return render_template( "capec.html", cwes=cwes, capecs=dict(rel_capecs), capec=req_capec )
def get(self, capec_id): """ CAPEC from CAPEC ID Outputs a CAPEC specified by it's id. CAPEC (Common Attack Pattern Enumeration and Classification) are a list of attack types commonly used by attackers. """ capec = getCAPEC(capec_id) if capec is None: api.abort(404, "The requested CAPEC is not found") else: return capec
def api_capec_by_id(self, capecid): return getCAPEC(capecid)
def capec(self, capecid): cwes = {x["id"]: x["name"] for x in self.api_cwe()} return render_template("capec.html", cwes=cwes, capec=getCAPEC(capecid), minimal=self.minimal)
def api_capec(self, cweid): return getCAPEC(cweid)