ForNeVeR / kdmg

Kotlin library to unpack macOS' DMG files.

Repository from Github https://github.comForNeVeR/kdmgRepository from Github https://github.comForNeVeR/kdmg

kdmg Status Zero

kdmg is a Kotlin library to unpack DMG files (disk images often used for macOS software distribution).

This Repository

This repository includes the library code in the lib module, and a command-line application to perform some basic tasks in the app module.

Kotlin Library

The library will be published to Maven Central, the installation documentation will be available later.

DMG File Manipulation

Current usage can be illustrated by the following snippet:

import kotlin.io.path.Path
import me.fornever.kdmg.Dmg

val path = Path("myFile.dmg")

// Read the DMG file table:
val dmg = Dmg.read(path)

// Enumerate the BLKX table descriptors:
for (entry in dmg.descriptors) {
    println("name: ${entry.name}, table: ${entry.table}")
}

// Find and unpack the Apple_HFS image:
val hfsDescriptor = dmg.descriptors.single { it.name.contains("Apple_HFS") }
val hfsPath = Path("image.hfs")
dmg.unpackBlkx(hfsDescriptor.table, hfsPath)

Diagnostic Application

Use the following shell command to run the application:

$ ./gradlew :app:run --args="enter the real args here"

Where args could be:

  • dmg <path to a .dmg file> - will find a HFS+ image in the file, unpack and save it to the path app/build/image.hfs.

Documentation

Format Specifications

License

The project is distributed under the terms of the Apache 2.0 license.

The license indication in the project's sources is compliant with the REUSE specification v3.3.

About

Kotlin library to unpack macOS' DMG files.

License:Apache License 2.0


Languages

Language:Kotlin 100.0%