示例#1
0
 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()));
     });
 }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }