dmg

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

README

Documentation

Index

Constants

View Source
const (
	NONE_TYPE  udifChecksumType = 0
	CRC32_TYPE udifChecksumType = 2
)
View Source
const (
	Flattened       udifResourceFileFlag = 0x00000001
	InternetEnabled udifResourceFileFlag = 0x00000004
)
View Source
const (
	ZERO_FILL       udifBlockChunkType = 0x00000000
	UNCOMPRESSED    udifBlockChunkType = 0x00000001
	IGNORED         udifBlockChunkType = 0x00000002 // Sparse (used for Apple_Free)
	COMPRESS_ADC    udifBlockChunkType = 0x80000004
	COMPRESS_ZLIB   udifBlockChunkType = 0x80000005
	COMPRESSS_BZ2   udifBlockChunkType = 0x80000006
	COMPRESSS_LZFSE udifBlockChunkType = 0x80000007
	COMPRESSS_LZMA  udifBlockChunkType = 0x80000008
	COMMENT         udifBlockChunkType = 0x7ffffffe
	LAST_BLOCK      udifBlockChunkType = 0xffffffff
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.0.6

type Config struct {
	DisableCache bool
}

Config is the DMG config

type DMG

type DMG struct {
	Footer UDIFResourceFile
	Plist  resourceFork
	Nsiz   nsiz
	Blocks []UDIFBlockData
	// contains filtered or unexported fields
}

DMG apple disk image object

func NewDMG

func NewDMG(r *os.File) (*DMG, error)

NewDMG creates a new DMG for accessing a dmg in an underlying reader. The dmg is expected to start at position 0 in the ReaderAt.

func Open

func Open(name string, c *Config) (*DMG, error)

Open opens the named file using os.Open and prepares it for use as a dmg.

func (*DMG) Close

func (d *DMG) Close() error

Close closes the DMG. If the DMG was created using NewFile directly instead of Open, Close has no effect.

func (*DMG) GetBlock

func (d *DMG) GetBlock(name string) (*UDIFBlockData, error)

GetBlock returns the size of the DMG data

func (*DMG) GetSize

func (d *DMG) GetSize() uint64

GetSize returns the size of the DMG data

func (*DMG) Load

func (d *DMG) Load() error

Load parses and verifies the GPT

func (*DMG) ReadAt

func (d *DMG) ReadAt(buf []byte, off int64) (n int, err error)

ReadAt impliments the io.ReadAt interface requirement of the Device interface

func (*DMG) ReadFile added in v1.0.6

func (d *DMG) ReadFile(w *bufio.Writer, off, length int64) (err error)

ReadFile extracts a file from the DMG

type UDIFBlockData

type UDIFBlockData struct {
	Name string

	Chunks []udifBlockChunk
	// contains filtered or unexported fields
}

UDIFBlockData object

func (*UDIFBlockData) DecompressChunks

func (b *UDIFBlockData) DecompressChunks(w *bufio.Writer) error

DecompressChunks decompresses the chunks for a given block and writes them to supplied bufio.Writer

type UDIFChecksum

type UDIFChecksum struct {
	Type udifChecksumType
	Size uint32
	Data [32]uint32
}

UDIFChecksum object

type UDIFResourceFile

type UDIFResourceFile struct {
	Signature             udifSignature // magic 'koly'
	Version               uint32        // 4 (as of 2013)
	HeaderSize            uint32        // sizeof(this) =  512 (as of 2013)
	Flags                 udifResourceFileFlag
	RunningDataForkOffset uint64
	DataForkOffset        uint64 // usually 0, beginning of file
	DataForkLength        uint64
	RsrcForkOffset        uint64 // resource fork offset and length
	RsrcForkLength        uint64
	SegmentNumber         uint32 // Usually 1, can be 0
	SegmentCount          uint32 // Usually 1, can be 0
	SegmentID             types.UUID

	DataChecksum UDIFChecksum

	PlistOffset uint64 // Offset and length of the blkx plist.
	PlistLength uint64

	Reserved1 [64]byte

	CodeSignatureOffset uint64
	CodeSignatureLength uint64

	Reserved2 [40]byte

	MasterChecksum UDIFChecksum

	ImageVariant uint32 // Unknown, commonly 1
	SectorCount  uint64

	Reserved3 uint32
	Reserved4 uint32
	Reserved5 uint32
}

UDIFResourceFile - Universal Disk Image Format (UDIF)

Jump to

Keyboard shortcuts

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