Ejemplo n.º 1
0
 def api_link(self, key=None, value=None):
     key = self.htmlDecode(key)
     value = self.htmlDecode(value)
     regex = re.compile(re.escape(value), re.I)
     data = {"cves": via4Linked(key, regex)}
     cvssList = [float(x["cvss"]) for x in data["cves"] if x.get("cvss")]
     if cvssList:
         data["stats"] = {
             "maxCVSS": max(cvssList),
             "minCVSS": min(cvssList),
             "count": len(data["cves"]),
         }
     else:
         data["stats"] = {"maxCVSS": 0, "minCVSS": 0, "count": len(data["cves"])}
     return data
Ejemplo n.º 2
0
def link(key=None, value=None):
    regex = re.compile(re.escape(value), re.I)
    cve = via4Linked(key, regex)
    cvssList = [float(x["cvss"]) for x in cve["results"] if x.get("cvss")]
    if cvssList:
        stats = {
            "maxCVSS": max(cvssList),
            "minCVSS": min(cvssList),
            "count": int(cve["total"]),
        }
    else:
        stats = {"maxCVSS": 0, "minCVSS": 0, "count": int(cve["total"])}
    return render_template(
        "linked.html",
        via4map=key.split(".")[0],
        field=".".join(key.split(".")[1:]),
        value=value,
        cve=cve,
        stats=stats,
    )