Categorygithub.com/approov/fork-go-macho
modulepackage
1.1.193
Repository: https://github.com/approov/fork-go-macho.git
Documentation: pkg.go.dev

# README

go-macho

Go Go Reference License

Package macho implements access to and creation of Mach-O object files.


Why 🤔

This package goes beyond the Go's debug/macho to:

  • Cover ALL load commands and architectures
  • Provide nice summary string output
  • Allow for creating custom MachO files
  • Parse Objective-C runtime information
  • Parse Swift runtime information
  • Parse code signature information
  • Parse fixup chain information

Install

$ go get github.com/blacktop/go-macho

Getting Started

package main

import "github.com/blacktop/go-macho"

func main() {
    m, err := macho.Open("/path/to/macho")
    if err != nil {
        panic(err)
    }
    defer m.Close()

    fmt.Println(m.FileTOC.String())
}

License

MIT Copyright (c) 2020-2024 blacktop

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
NewFatFile creates a new FatFile for accessing all the Mach-O images in a universal binary.
NewFile creates a new File for accessing a Mach-O binary in an underlying reader.
Open opens the named file using os.Open and prepares it for use as a Mach-O binary.
OpenFat opens the named file using os.Open and prepares it for use as a Mach-O universal binary.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
'BC' 0xc0de.
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
ErrNotFat is returned from NewFatFile or OpenFat when the file is not a universal binary but may be a thin binary, based on its magic number.
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
A BuildVersion represents a Mach-O build for platform min OS version.
A CodeSignature represents a Mach-O LC_CODE_SIGNATURE command.
A DataInCode represents a Mach-O LC_DATA_IN_CODE command.
A DyldChainedFixups used with linkedit_data_command.
DyldEnvironment represents a Mach-O LC_DYLD_ENVIRONMENT command.
A DyldExportsTrie used with linkedit_data_command, payload is trie.
A DyldInfo represents a Mach-O LC_DYLD_INFO command.
DyldInfoOnly is compressed dyld information only.
A Dylib represents a Mach-O LC_ID_DYLIB, LC_LOAD_{,WEAK_}DYLIB,LC_REEXPORT_DYLIB load command.
No description provided by the author
A Dylinker represents a Mach-O LC_ID_DYLINKER, LC_LOAD_DYLINKER or LC_DYLD_ENVIRONMENT load command.
DylinkerID represents a Mach-O LC_ID_DYLINKER command.
A Dysymtab represents a Mach-O LC_DYSYMTAB command.
A EncryptionInfo represents a Mach-O 32-bit encrypted segment information.
A EncryptionInfo64 represents a Mach-O 64-bit encrypted segment information.
EntryPoint represents a Mach-O LC_MAIN command.
A FatArch is a Mach-O File inside a FatFile.
A FatArchHeader represents a fat header for a specific image architecture.
A FatFile is a Mach-O universal binary that contains at least one architecture.
No description provided by the author
A File represents an open Mach-O file.
FileConfig is a MachO file config object.
FilesetEntry used with fileset_entry_command.
No description provided by the author
FormatError is returned by some operations if the data does not have the correct format for an object file.
A FunctionStarts represents a Mach-O function starts command.
A FvmFile represents a Mach-O LC_FVMFILE command.
A IDDylib represents a Mach-O LC_ID_DYLIB command.
A Ident represents a Mach-O LC_IDENT command.
A IDFvmlib represents a Mach-O LC_IDFVMLIB command.
A LazyLoadDylib represents a Mach-O LC_LAZY_LOAD_DYLIB command.
A LinkEditData represents a Mach-O linkedit data command.
No description provided by the author
A LinkerOption represents a Mach-O LC_LINKER_OPTION command.
LoadCmdBytes is a command-tagged sequence of bytes.
A LoadDylib represents a Mach-O LC_LOAD_DYLIB command.
A LoadDylinker represents a Mach-O LC_LOAD_DYLINKER command.
A LoadFvmlib represents a Mach-O LC_LOADFVMLIB command.
A Note represents a Mach-O LC_NOTE command.
A PrebindCheckSum is a Mach-O LC_PREBIND_CKSUM command.
PreboundDylib represents a Mach-O LC_PREBOUND_DYLIB command.
A Prepage represents a Mach-O LC_PREPAGE command.
A ReExportDylib represents a Mach-O LC_REEXPORT_DYLIB command.
Regs386 is the Mach-O 386 register structure.
RegsAMD64 is the Mach-O AMD64 register structure.
RegsARM is the Mach-O ARM register structure.
RegsARM64 is the Mach-O ARM 64 register structure.
A Routines is a Mach-O LC_ROUTINES command.
A Routines64 is a Mach-O LC_ROUTINES_64 command.
A Rpath represents a Mach-O LC_RPATH command.
A Segment represents a Mach-O 32-bit or 64-bit load segment command.
A SegmentHeader is the header for a Mach-O 32-bit or 64-bit load segment command.
A SourceVersion represents a Mach-O LC_SOURCE_VERSION command.
A SplitInfo represents a Mach-O LC_SEGMENT_SPLIT_INFO command.
A SubClient is a Mach-O LC_SUB_CLIENT command.
A SubFramework is a Mach-O LC_SUB_FRAMEWORK command.
A SubLibrary is a Mach-O LC_SUB_LIBRARY command.
A SubUmbrella is a Mach-O LC_SUB_UMBRELLA command.
A Symbol is a Mach-O 32-bit or 64-bit symbol table entry.
A SymSeg represents a Mach-O LC_SYMSEG command.
A Symtab represents a Mach-O LC_SYMTAB command.
A Thread represents a Mach-O LC_THREAD command.
A TwolevelHints is a Mach-O LC_TWOLEVEL_HINTS command.
A UnixThread represents a Mach-O LC_UNIXTHREAD command.
A UpwardDylib represents a Mach-O LC_LOAD_UPWARD_DYLIB load command.
UUID represents a Mach-O LC_UUID command.
A VersionMin represents a Mach-O LC_VERSION_MIN_* command.
VersionMiniPhoneOS build for iPhoneOS min OS version.
VersionMinMacOSX build for MacOSX min OS version.
VersionMinTvOS build for AppleTV min OS version.
VersionMinWatchOS build for Watch min OS version.
A WeakDylib represents a Mach-O LC_LOAD_WEAK_DYLIB command.

# Interfaces

A Load represents any Mach-O load command.

# Type aliases

A LoadBytes is the uninterpreted bytes of a Mach-O load command.
No description provided by the author