def getcapec(self, cweid=None): if cweid is None or not self.capeclookup: return False e = getCAPECFor(cweid) capec = [] for f in e: capec.append(f) return capec
def relatedCWE(self, cweid): cwes = {x["id"]: x["name"] for x in self.api_cwe()} return render_template( "cwe.html", cwes=cwes, cwe=cweid, capec=getCAPECFor(cweid), minimal=self.minimal, )
def get_cwe(cwe_id=None): data = getCWEs() if cwe_id is None: cwes = [x for x in data if x["weaknessabs"].lower() == "class"] return render_template("cwe.html", cwes=cwes, capec=None) else: cwes = {x["id"]: x["name"] for x in data} return render_template( "cwe.html", cwes=cwes, cwe=cwe_id, capec=getCAPECFor(cwe_id), minimal=True )
def get(self, cwe_id): """ CAPEC's from CWE ID Outputs a list of CAPEC related to a CWE. CAPEC (Common Attack Pattern Enumeration and Classification) are a list of attack types commonly used by attackers. """ capecs = getCAPECFor(cwe_id) if len(capecs) == 0: api.abort(404, "The requested CAPEC is not found") else: return capecs
def api_capec(self, cweid): return getCAPECFor(cweid)
def api_cwe(self, cwe_id=None): return getCAPECFor(str(cwe_id)) if cwe_id else getCWEs()