Documentation
¶
Index ¶
Constants ¶
View Source
const (
MaxGadgetLen = 20 // max count bytes in gadget
)
Variables ¶
View Source
var ( ErrUnknownArch = errors.New("unknown arch") ErrUnknownOS = errors.New("unknown os") ErrUnknownBinary = errors.New("binary type is unknown") ErrStringNotFound = errors.New("string not found") ErrGadgetNotFound = errors.New("gadget not found") ErrSymbolNotFound = errors.New("symbol not found") )
View Source
var ( ArchAmd64 = Arch{Name: "amd64", Bitness: 64} ArchI386 = Arch{Name: "i386", Bitness: 32} ArchArm64 = Arch{Name: "arm64", Bitness: 64} ArchArm32 = Arch{Name: "arm", Bitness: 32} ArchUnknown = Arch{Name: "unknown"} )
View Source
var (
ErrNasmNotFoundInPATH = fmt.Errorf("nasm not found in PATH")
)
View Source
var ErrNoDynamicSection = errors.New("no .dynamic section")
Functions ¶
This section is empty.
Types ¶
type Binary ¶
type Binary interface {
// Info returns binary info like arch, os, compiler, security mitigations, etc
Info() *BinaryInfo
// GetSymbolAddr returns the address of the symbol with the given name.
// If the symbol is not found, an error is returned.
GetSymbolAddr(symbolName string) (Addr, error)
// GetStringAddr returns the address of the given string in the binary's .data or .rodata
// sections. If the string is not found, an error of type ErrStringNotFound
// is returned.
GetStringAddr(s string) (Addr, error)
GetGadgetAddr(instructions []string) ([]Addr, error)
}
func AnalyzeBinary ¶
AnalyzeBinary analyzes the given binary and returns information about it.
The path must be a valid ELF, PE or Mach-O file. If the file is not recognized, an error of type ErrUnknownBinary is returned.
The returned ELF contains information about the binary's architecture, operating system, compiler, linking, and security.
The returned error is nil if the analysis is successful, or an error describing the problem if the analysis fails.
type BinaryInfo ¶ added in v0.0.6
type BinaryInfo struct {
Arch Arch
OS OS
Compiler string
Linking string
Security *SecurityInfo
StaticLinking bool
ByteOrder binary.ByteOrder
}
func (*BinaryInfo) String ¶ added in v0.0.6
func (bi *BinaryInfo) String() string
Click to show internal directories.
Click to hide internal directories.