execbin

package module
v0.0.0-...-197946d Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: MIT Imports: 11 Imported by: 1

README

go-execbin

GoDoc

Analyze the binary outputted by go build to get type information etc.

Status

UNDER DEVELOPMENT

Synopsis

package main

import (
    "github.com/goccy/go-execbin"
)

func main() {
    file, err := execbin.Open("path/to/binary")
    if err != nil {
        panic(err)
    }
    types, err := file.DefinedInterfaceTypes()
    if err != nil {
        panic(err)
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ELFFile

type ELFFile struct {
	File *elf.File
	// contains filtered or unexported fields
}

func NewELFFile

func NewELFFile(f *os.File) (*ELFFile, error)

func (*ELFFile) DefinedInterfaceTypes

func (f *ELFFile) DefinedInterfaceTypes() ([]*InterfaceType, error)

func (*ELFFile) Type

func (f *ELFFile) Type() FileType

type File

type File interface {
	Type() FileType
	DefinedInterfaceTypes() ([]*InterfaceType, error)
}

func Open

func Open(path string) (File, error)

type FileType

type FileType int
const (
	UnknownFormat FileType = iota
	ELF
	MachO
	PE
)

func (FileType) String

func (t FileType) String() string

type InterfaceType

type InterfaceType struct {
	Name        string
	Implemented string
	PkgPath     string
	Methods     []*Method
}

type MachOFile

type MachOFile struct {
	File *macho.File
	// contains filtered or unexported fields
}

func NewMachOFile

func NewMachOFile(f *os.File) (*MachOFile, error)

func (*MachOFile) DefinedInterfaceTypes

func (f *MachOFile) DefinedInterfaceTypes() ([]*InterfaceType, error)

func (*MachOFile) Type

func (f *MachOFile) Type() FileType

type Method

type Method struct {
	Name      string
	Signature string
	In        []*Type
	Out       []*Type
}

type PEFile

type PEFile struct {
	File *pe.File
	// contains filtered or unexported fields
}

func NewPEFile

func NewPEFile(f *os.File) (*PEFile, error)

func (*PEFile) DefinedInterfaceTypes

func (f *PEFile) DefinedInterfaceTypes() ([]*InterfaceType, error)

func (*PEFile) Type

func (f *PEFile) Type() FileType

type Type

type Type struct {
	Name      string
	PkgPath   string
	IsPointer bool
}

Jump to

Keyboard shortcuts

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