static void FindDotNetVulnerabilities(List <string> pathList, bool isRecursive) { pathList.SelectMany(x => AnalyzeDotNetAssemblies(DotNetAssemblyLocater.FindFiles(x, ".csproj", isRecursive))) .OrderBy(x => x.GetMessage()) .ToList() .ForEach(issue => { ConsoleOutput.ErrorMessage(string.Format("{0} {1})", issue.GetMessage(), issue.Location.GetMappedLineSpan())); }); }
private static List <String> ScanNuget(string targetPath, bool isRecursive) { var pathList = new List <String>(); var searchString = ".nupkg"; ConsoleOutput.Message($"Searching {targetPath} for files ending with '{searchString}'"); DotNetAssemblyLocater.FindFiles(targetPath, searchString, isRecursive) .ForEach(x => FileUtilities.ExtractNugetAssemblies(x) .ForEach(dll => pathList.Add(DecompileTarget(dll)) )); return(pathList); }
static IEnumerable <string> FindDotNetAssemblies(string rootPath, bool recursiveSearch) { //TODO: Save details to disk + add stop and restore during process ConsoleOutput.HeaderMessage("Scanning for .Net assemblies"); if (recursiveSearch) { ConsoleOutput.Message("This will take some time if a high root folder has been selected"); } var allAssemblies = DotNetAssemblyLocater.FindFiles(rootPath, ".exe;.dll", recursiveSearch).Where(x => DotNetAssemblyLocater.IsDotNetAssembly(x)); ConsoleOutput.Message($"Found {allAssemblies.Count()} .Net assemblies"); return(allAssemblies); }
private static int ProcessDecompile(DecompileOptions option) { if (!string.IsNullOrEmpty(option.Path)) { var outputDirectory = DecompileTarget(option.Path); if (option.ScanOutput) { var pathList = DotNetAssemblyLocater.FindFiles(outputDirectory, ".csproj"); FindDotNetVulnerabilities(pathList, false); } return(0); } return(1); }