diff --git a/GrokAssembly/GrokAssembly.csproj b/GrokAssembly/GrokAssembly.csproj index 5b1980e..2250761 100644 --- a/GrokAssembly/GrokAssembly.csproj +++ b/GrokAssembly/GrokAssembly.csproj @@ -10,11 +10,11 @@ Inspects a .NET Assembly to determine Company, Product, and Version information Inspects a .NET Assembly to determine Company, Product, and Version information OWASP Foundation - Copyright © 2018, OWASP Foundation. All Rights Reserved - 2.0.0.0 - 2.0.0.0 + Copyright © 2019, OWASP Foundation. All Rights Reserved + 3.0.0.0 + 3.0.0.0 GrokAssembly - 2.0.0.0 + 3.0.0.0 OWASP Contributors https://www.apache.org/licenses/LICENSE-2.0 diff --git a/GrokAssembly/Program.cs b/GrokAssembly/Program.cs index 3b0a006..c44bea8 100644 --- a/GrokAssembly/Program.cs +++ b/GrokAssembly/Program.cs @@ -77,6 +77,29 @@ public static int Main(string[] args) AssemblyName assemblyName = AssemblyName.GetAssemblyName(Path.GetFullPath(args[0])); writeNode(writer, "fullname", assemblyName.FullName); + writer.WriteStartElement("namespaces"); + try + { + Assembly assembly = Assembly.LoadFrom(Path.GetFullPath(args[0])); + HashSet nspaces = new HashSet(); + foreach (Type t in assembly.GetTypes()) + { + string ns = t.GetTypeInfo().Namespace; + if (!nspaces.Contains(ns)) + { + writeNode(writer, "namespace", ns); + nspaces.Add(ns); + } + } + writer.WriteEndElement(); + } + catch (Exception ex) + { + writer.WriteEndElement(); + writeNode(writer, "warning", ex.Message); + } + + } catch (BadImageFormatException) { diff --git a/README.md b/README.md index ccaaa3e..fb17944 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,39 @@ GrokAssembly ============ -GrokAssembly is a simple .NET/mono project used for getting name and version -information out of an assembly. It is primarily used for the -[OWASP Dependency Check][dependencycheck] project to identify company, product, -and version information. +GrokAssembly is a simple .NET core project used for extracting extended properties +information, such as company, product name, and version, from an assembly. The tool +is primarily used within the [OWASP Dependency Check][dependencycheck] project to +identify Common Platform Identifiers (CPE) and report on known vulnerabilities. Usage: ------ -```cmd -$ GrokAssembly +```bash +$ dotnet GrokAssembly.dll ``` -or - +### Example Output ```bash -$ mono GrokAssembly.exe +$ dotnet GrokAssembly.dll GrokAssembly.dll +``` +```xml + + + OWASP Contributors + GrokAssembly + 3.0.0.0 + Inspects a .NET Assembly to determine Company, Product, and Version information + GrokAssembly + /Users/jeremy/Projects/GrokAssembly/GrokAssembly/bin/Release/netcoreapp2.0/GrokAssembly.dll + 3.0.0.0 + GrokAssembly.exe + GrokAssembly.exe + GrokAssembly, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null + + GrokAssembly + + ``` [dependencycheck]: https://github.com/jeremylong/DependencyCheck