-
-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I would like to analyze a Go binary and find which source packages were used to build it and more. The goal there is to recognize a binary as from Go, extract things out of it, map these things back to sources and open source source repos, and eventually inject that in the flow to create an SBOM in ScanCode/ScanCode.io
Go binaries can be either ELFs, PE or Mach-O. The initial focus should be on ELFs
To get the details of what's in a binary there are a couple avenues:
- matching to purlDB : not yet for this library for now
- collect the standard binary symbols and debug symbols (such as ELFs, PE or Mach-O): not yet for this library for now as this may be handled elsewhere
- collect Go-specific strings and symbols such as the pclntab: the focus of this issue
The initial1st step is to determine the list of all third-party Go modules included in a binary. I would like to use a CLI tool with a CLI UI similar to that of ScanCode Toolkit, python-inspector and nuget-inspector that would:
- accept a Go binary as an input argument
- dump results of found Go packages in a JSON output format modelled after the ScanCode toolkit format for the packages section
Some candidate libraries include:
- https://github.com/goretk/gore and related libraries. AGPL-licensed
- https://github.com/mandiant/GoReSym (Mandiant is now part of Google). MIT-licensed
Beyond this for Go strings, see mandiant/flare-floss#845 by @Arker123 and mandiant/flare-floss#807