Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions GrokAssembly/GrokAssembly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<AssemblyDescription>Inspects a .NET Assembly to determine Company, Product, and Version information</AssemblyDescription>
<Description>Inspects a .NET Assembly to determine Company, Product, and Version information</Description>
<AssemblyCompany>OWASP Foundation</AssemblyCompany>
<AssemblyCopyright>Copyright © 2018, OWASP Foundation. All Rights Reserved</AssemblyCopyright>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<version>2.0.0.0</version>
<AssemblyCopyright>Copyright © 2019, OWASP Foundation. All Rights Reserved</AssemblyCopyright>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<version>3.0.0.0</version>
<PackageId>GrokAssembly</PackageId>
<PackageVersion>2.0.0.0</PackageVersion>
<PackageVersion>3.0.0.0</PackageVersion>
<Authors>OWASP Contributors</Authors>
<LicenseUrl>https://www.apache.org/licenses/LICENSE-2.0</LicenseUrl>
</PropertyGroup>
Expand Down
23 changes: 23 additions & 0 deletions GrokAssembly/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> nspaces = new HashSet<string>();
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)
{
Expand Down
35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <assembly>
```bash
$ dotnet GrokAssembly.dll <assembly>
```

or

### Example Output
```bash
$ mono GrokAssembly.exe <assembly>
$ dotnet GrokAssembly.dll GrokAssembly.dll
```
```xml
<?xml version="1.0" encoding="utf-8"?>
<assembly>
<CompanyName>OWASP Contributors</CompanyName>
<ProductName>GrokAssembly</ProductName>
<ProductVersion>3.0.0.0</ProductVersion>
<Comments>Inspects a .NET Assembly to determine Company, Product, and Version information</Comments>
<FileDescription>GrokAssembly</FileDescription>
<FileName>/Users/jeremy/Projects/GrokAssembly/GrokAssembly/bin/Release/netcoreapp2.0/GrokAssembly.dll</FileName>
<FileVersion>3.0.0.0</FileVersion>
<InternalName>GrokAssembly.exe</InternalName>
<OriginalFilename>GrokAssembly.exe</OriginalFilename>
<fullname>GrokAssembly, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null</fullname>
<namespaces>
<namespace>GrokAssembly</namespace>
</namespaces>
</assembly>
```

[dependencycheck]: https://github.com/jeremylong/DependencyCheck