예제 #1
0
        public Vulnerability ToVulnerability()
        {
            var vector = CvssVector?.Split('/').FirstOrDefault(x => x.Split(':')[0] == "AV") ?? "";

            if (!string.IsNullOrWhiteSpace(vector))
            {
                vector = vector.Substring(3);
            }

            var vectorType = vector switch
            {
                "L" => Vulnerability.AccessVectorType.LOCAL,
                "A" => Vulnerability.AccessVectorType.ADJACENT_NETWORK,
                "N" => Vulnerability.AccessVectorType.NETWORK,
                "P" => Vulnerability.AccessVectorType.PHYSICAL,
                _ => Vulnerability.AccessVectorType.UNSPECIFIED
            };

            return(new Vulnerability(
                       Cve ?? $"OSS Index ID: {Id}",
                       CvssScore,
                       Cwe,
                       Description,
                       new[] { Reference },
                       vectorType,
                       ""
                       ));
        }
    }
        public Vulnerability ToVulnerability()
        {
            var vector = CvssVector.Split('/').FirstOrDefault(x => x.Split(':')[0] == "AV");

            if (!string.IsNullOrWhiteSpace(vector))
            {
                vector = vector.Substring(3);
            }

            var vectorType = vector switch
            {
                "L" => Vulnerability.AccessVectorType.LOCAL,
                "A" => Vulnerability.AccessVectorType.ADJACENT_NETWORK,
                "N" => Vulnerability.AccessVectorType.NETWORK,
                "P" => Vulnerability.AccessVectorType.PHYSICAL,
                _ => Vulnerability.AccessVectorType.UNSPECIFIED
            };

            return(new Vulnerability
            {
                Cve = Cve,
                Description = Description,
                Cwe = Cwe,
                Vendor = "",
                CvssScore = CvssScore,
                Vector = vectorType,
                References = new[] { Reference }
            });
        }
    }