Skip to content

Go binary analysis to find source packages #2

@pombredanne

Description

@pombredanne

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:

Beyond this for Go strings, see mandiant/flare-floss#845 by @Arker123 and mandiant/flare-floss#807

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions