Example #1
0
 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
Example #2
0
 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,
     )
Example #3
0
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
        )
Example #4
0
    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
Example #5
0
 def api_capec(self, cweid):
     return getCAPECFor(cweid)
Example #6
0
 def api_cwe(self, cwe_id=None):
     return getCAPECFor(str(cwe_id)) if cwe_id else getCWEs()