-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show binary exports, entrypoint, and imports #2626
Conversation
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
func findMachoFeatures(data *file.Executable, reader unionreader.UnionReader) error { | ||
// TODO: support security features | ||
|
||
// TODO: support multi-architecture binaries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this what the UnionReader
is for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no a union reader only makes the reader easier to use for seeking and such:
type UnionReader interface {
io.Reader
io.ReaderAt
io.Seeker
io.Closer
}
Where as we could be individually unwrapping the multiple binaries from "universal" or multi-architecture binaries: https://github.com/anchore/go-macholibre/blob/5df1434a0b50a4fe3e1dae035d10d4c977369e43/universal_binary.go#L143 .
I've descoped this from this particular PR.
Signed-off-by: Alex Goodman <[email protected]>
show binary exports, entrypoint, and imports for macho, elf, and pe formats Signed-off-by: Alex Goodman <[email protected]> Signed-off-by: Brian Ebarb <[email protected]>
Partially implements #661
This PR adds the following indications to the
file.Executable
object:hasEntrypoint
denotes if the binary is self-executablehasExports
denotes that the binary can be used as a libraryimportsLibraries
denotes which dynamic libraries a binary needsWhy not just indicate
isLibrary
? Mainly because some executable formats can support a binary being both a library and a self-executing application simultaneously:(anything that isn't U is an export)
Why not make relationships between binary files instead of declaring the imports as attributes on the file object? There is some discussion about this, but this PR only goes so far; no new relationships are being added in this PR, but it is important to be able to know:
This functionality has been implemented for ELF, Mach-o, and PE binary formats.