loader

package
v0.0.0-...-fed3a35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNKNOWN = iota
	EXEC
	DYN
)
View Source
const NoOSHint = ""

NoOSHint indicates that there is no os hint

Variables

View Source
var UnknownMagic = errors.New("Could not identify file magic.")

Functions

func MatchCgc

func MatchCgc(r io.ReaderAt) bool

func MatchElf

func MatchElf(r io.ReaderAt) bool

MatchElf returns true if the file has a elf magic header

func MatchMachO

func MatchMachO(r io.ReaderAt) bool

Types

type CgcLoader

type CgcLoader struct {
	Loader
}

func (*CgcLoader) OS

func (c *CgcLoader) OS() string

type ComLoader

type ComLoader struct {
	LoaderBase
	Size int
	// contains filtered or unexported fields
}

func (*ComLoader) OS

func (c *ComLoader) OS() string

func (*ComLoader) Segments

func (r *ComLoader) Segments() ([]SegmentData, error)

type ElfLoader

type ElfLoader struct {
	LoaderBase
	// contains filtered or unexported fields
}

func (*ElfLoader) DWARF

func (e *ElfLoader) DWARF() (*dwarf.Data, error)

func (*ElfLoader) DataSegment

func (e *ElfLoader) DataSegment() (start, end uint64)

func (*ElfLoader) Header

func (e *ElfLoader) Header() (uint64, []byte, int)

func (*ElfLoader) Interp

func (e *ElfLoader) Interp() string

func (*ElfLoader) Segments

func (e *ElfLoader) Segments() ([]SegmentData, error)

func (*ElfLoader) Symbols

func (e *ElfLoader) Symbols() ([]Symbol, error)

func (*ElfLoader) Type

func (e *ElfLoader) Type() int

type FakeCgcReader

type FakeCgcReader struct {
	io.ReaderAt
	// contains filtered or unexported fields
}

func (*FakeCgcReader) ReadAt

func (f *FakeCgcReader) ReadAt(p []byte, off int64) (int, error)

type Loader

type Loader interface {
	Arch() string
	Bits() int
	ByteOrder() binary.ByteOrder
	OS() string
	Entry() uint64
	Type() int
	Interp() string
	Header() (uint64, []byte, int)
	Symbols() ([]Symbol, error)
	Segments() ([]SegmentData, error)
	DataSegment() (uint64, uint64)
	DWARF() (*dwarf.Data, error)
}

func Load

func Load(r io.ReaderAt) (Loader, error)

func LoadArch

func LoadArch(r io.ReaderAt, arch string, osHint string) (Loader, error)

func LoadFile

func LoadFile(path string) (Loader, error)

func LoadFileArch

func LoadFileArch(path string, arch, osHint string) (Loader, error)

func LoaderFor

func LoaderFor(r io.ReaderAt) (Loader, error)

LoaderFor returns a loader for the file.

func NewCgcLoader

func NewCgcLoader(r io.ReaderAt, arch string) (Loader, error)

func NewComLoader

func NewComLoader(filename string) (Loader, error)

func NewElfLoader

func NewElfLoader(r io.ReaderAt, arch string, osHint string) (Loader, error)

func NewMachOLoader

func NewMachOLoader(r io.ReaderAt, archHint string) (Loader, error)

func NewNullLoader

func NewNullLoader(arch, os string, byteOrder binary.ByteOrder, entry uint64) Loader

type LoaderBase

type LoaderBase struct {
	// contains filtered or unexported fields
}

func (*LoaderBase) Arch

func (l *LoaderBase) Arch() string

func (*LoaderBase) Bits

func (l *LoaderBase) Bits() int

func (*LoaderBase) ByteOrder

func (l *LoaderBase) ByteOrder() binary.ByteOrder

func (*LoaderBase) DWARF

func (l *LoaderBase) DWARF() (*dwarf.Data, error)

func (*LoaderBase) DataSegment

func (l *LoaderBase) DataSegment() (uint64, uint64)

func (*LoaderBase) Entry

func (l *LoaderBase) Entry() uint64

func (*LoaderBase) Header

func (l *LoaderBase) Header() (uint64, []byte, int)

func (*LoaderBase) Interp

func (l *LoaderBase) Interp() string

func (*LoaderBase) OS

func (l *LoaderBase) OS() string

func (*LoaderBase) Segments

func (l *LoaderBase) Segments() ([]SegmentData, error)

func (*LoaderBase) Symbols

func (l *LoaderBase) Symbols() ([]Symbol, error)

func (*LoaderBase) Type

func (l *LoaderBase) Type() int

type MachOLoader

type MachOLoader struct {
	LoaderBase
	// contains filtered or unexported fields
}

func (*MachOLoader) DWARF

func (m *MachOLoader) DWARF() (*dwarf.Data, error)

func (*MachOLoader) DataSegment

func (m *MachOLoader) DataSegment() (start, end uint64)

func (*MachOLoader) Header

func (m *MachOLoader) Header() (uint64, []byte, int)

func (*MachOLoader) Interp

func (m *MachOLoader) Interp() string

func (*MachOLoader) Segments

func (m *MachOLoader) Segments() ([]SegmentData, error)

func (*MachOLoader) Symbols

func (m *MachOLoader) Symbols() ([]Symbol, error)

func (*MachOLoader) Type

func (m *MachOLoader) Type() int

type NullLoader

type NullLoader struct {
	LoaderBase
}

type Segment

type Segment struct {
	Start, End uint64
	Prot       int
}

func (*Segment) Merge

func (s *Segment) Merge(o *Segment)

func (*Segment) Overlaps

func (s *Segment) Overlaps(o *Segment) bool

type SegmentData

type SegmentData struct {
	Off        uint64
	Addr, Size uint64
	Prot       int
	DataFunc   func() ([]byte, error)
}

func (*SegmentData) ContainsPhys

func (s *SegmentData) ContainsPhys(addr uint64) bool

func (*SegmentData) ContainsVirt

func (s *SegmentData) ContainsVirt(addr uint64) bool

func (*SegmentData) Data

func (s *SegmentData) Data() ([]byte, error)

type Symbol

type Symbol struct {
	Name       string
	Start, End uint64
	Dynamic    bool
}

func (Symbol) Contains

func (s Symbol) Contains(addr uint64) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL