Skip to content

Quickstart Guide

Kritanta edited this page Aug 13, 2021 · 1 revision

Loading a mach-o file:

from ktool.macho import MachOFile
from ktool.dyld import Dyld
from ktool.objc import ObjCLibrary

with open(scriptdir + '/bins/Search', 'rb') as fd:
    macho_file = MachOFile(fd)
    # If the file is thin, the first slice will be the only slice
    first_slice = macho_file.slices[0]
    
    # Dyld is a static class that emulates the functionality of dyld by loading in a slice and processing its load commands/symbols
    dyld_library = Dyld.load(first_slice)

    # Load in objc Data if needed.
    objc_library = ObjCLibrary(dyld_library)
Clone this wiki locally