public async Task ExecuteAsync(DependencyManagerTypes dependencyManager, string dependencyName, string dependencyVersion) { _check.AddSource(dependencyManager, new OssIndexVulnerabilitySource("https://ossindex.sonatype.org")); var results = await _check.ExecuteAsync(dependencyName, dependencyVersion); Assert.NotEmpty(results); }
public static async Task Main() { Console.WriteLine("Starting VulnerabilityTracker"); var check = new VulnerabilityCheck(); check.AddSource(DependencyManagerTypes.NuGet, new OssIndexVulnerabilitySource("https://ossindex.sonatype.org")); var vulnerabilities = (await check.ExecuteAsync("Flurl.Http.Xml", "1.5.0")) .ToList(); if (vulnerabilities.Any()) { foreach (var vulnerability in vulnerabilities) { Console.WriteLine($"Vulnerability: {vulnerability.Title}"); } } else { Console.WriteLine("No vulnerabilities found"); } Console.WriteLine("Press Enter to exit"); Console.ReadLine(); }