Documentation
¶
Overview ¶
Package pe contains different facilities for dealing with Portable Executable specifics and digging out valuable insights from it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Enabled bool `json:"pe.enabled" yaml:"pe.enabled"`
ReadResources bool `json:"pe.read-resources" yaml:"pe.read-resources"`
ReadSymbols bool `json:"pe.read-symbols" yaml:"pe.read-symbols"`
ReadSections bool `json:"pe.read-sections" yaml:"pe.read-sections"`
ExcludedImages []string `json:"pe.excluded-images" yaml:"pe.excluded-images"`
}
Config stores the preferences that dictate the behaviour of the PE reader.
func (*Config) InitFromViper ¶
InitFromViper initializes PE config from Viper.
type PE ¶
type PE struct {
// NumberOfSections designates the total number of sections found withing the binary.
NumberOfSections uint16 `json:"nsections"`
// NumberOfSymbols represents the total number of symbols.
NumberOfSymbols uint32 `json:"nsymbols"`
// ImageBase designates the base address of the process' image.
ImageBase string `json:"image_base"`
// Entrypoint is the address of the entry point function.
EntryPoint string `json:"entry_point"`
// LinkTime represents the time that the image was created by the linker.
LinkTime time.Time `json:"link_time"`
// Sections contains all distinct sections and their metadata.
Sections []Sec `json:"sections"`
// Symbols contains the list of imported symbols.
Symbols []string `json:"symbols"`
// Imports contains the imported libraries.
Imports []string `json:"imports"`
// VersionResources holds the version resources
VersionResources map[string]string `json:"resources"`
}
PE contains various headers that identifies the format and characteristics of the executable files.
func NewFromKcap ¶
NewFromKcap restores the PE metadata from the byte stream.
type Reader ¶
type Reader interface {
// Read is the main method that reads the PE metadata for the specified image file.
Read(filename string) (*PE, error)
// FindSectionByRVA gets the section containing the given address.
FindSectionByRVA(rva uint32) (*pe.Section, error)
// FindOffsetByRVA returns the file offset that maps to the given RVA.
FindOffsetByRVA(rva uint32) (int64, error)
}
Reader is the interface for PE (Portable Executable) format metadata parsing. The stdlib debug/pe package underpins the core functionality of the reader, but additionally, it provides numerous methods for reading resources, strings, IAT directories and other information that is not offered by the standard library package.