GithubHelp home page GithubHelp logo

Comments (8)

DeVaukz avatar DeVaukz commented on August 17, 2024

Hey @andermoran

I'll work on flushing out the Installation instructions. The major step that's currently missing is that you must add the MachOKit framework target as a Target Dependency of your application (Select your application target and look under the Build Phases tab). This will tell Xcode to build the MachOKit framework for whatever platform+arch your application is building for.

from macho-kit.

DeVaukz avatar DeVaukz commented on August 17, 2024

Installation instructions expanded in 9c1251a.

from macho-kit.

andermoran avatar andermoran commented on August 17, 2024

Still having issues with it. What's the fastest way to contact you? I need to get this working ASAP as I'm trying to use it for a school project!

from macho-kit.

DeVaukz avatar DeVaukz commented on August 17, 2024

Hey @andermoran

What's the latest issue? There is not a lot of information in your original post, but it looks like you built the MachOKit framework and then added that to your project, instead of adding the MachOKit Xcode project.

I was able to create a new macOS application Xcode project, drop in MachOKit.xcodeproj, add MachOKit framework as an embedded binary, and start using MachOKit from the new project without any problems. I'm also working on another project - Mach-O Explorer - that uses Mach-O Kit, if you want to see a working example of this setup.

Xcode subprojects are well understood and are used in many projects. Try searching for "Xcode subproject" in your favorite search engine.

Lastly, double check that you included the --recursive option when cloning Mach-O Kit, as shown in the ReadMe. This is very important.

from macho-kit.

andermoran avatar andermoran commented on August 17, 2024

It works but maybe also include that they need to import MachOKit in their file! Also does this work on iOS binaries that are decrypted?

from macho-kit.

andermoran avatar andermoran commented on August 17, 2024

Can you put an example of you using your kit in Objective-C?

from macho-kit.

DeVaukz avatar DeVaukz commented on August 17, 2024

Mach-O Kit should parse unencrypted binaries from all Apple platforms (macOS, iOS, tvOS, watchOS, and their respective simulators) but almost all testing thus far has been with macOS binaries.

from macho-kit.

DeVaukz avatar DeVaukz commented on August 17, 2024

Here is the Objective-C Metadata example from the ReadMe, in Objective-C

    MKMemoryMap *memoryMap = [MKMemoryMap memoryMapWithContentsOfFile:[NSURL fileURLWithPath:@"/Applications/Calculator.app/Contents/MacOS/Calculator"] error:nil];
    
    // Instantiate an instance of MKMachOImage to begin parsing the Calculator binary
    MKMachOImage *macho;
    {
        MKFatBinary *fat = [[MKFatBinary alloc] initWithMemoryMap:memoryMap error:nil];
        if (fat) {
            // It's a FAT binary, find the x86_64 slice
            for (MKFatArch *slice in fat.architectures) {
                if (slice.cputype == CPU_TYPE_X86_64) {
                    // Instantiate an instance of MKMachOImage to parse the slice
                    macho = [[MKMachOImage alloc] initWithName:"calculator" flags:0 atAddress:slice.offset inMapping:memoryMap error:nil];
                    break;
                }
            }
        } else {
            // Not a FAT binary
            macho = [[MKMachOImage alloc] initWithName:"calculator" flags:0 atAddress:0 inMapping:memoryMap error:nil];
        }
        NSAssert(macho != nil, @"Failed to initialize MKMachOImage");
    }
    
    // Find the MKObjCClassListSection
    for (MKSection *section in macho.sections.allValues) {
        // Mach-O Kit instantiates a specialized subclass of MKSection when it encounters a section containing Objective-C class list metadata
        if ([section isKindOfClass:MKObjCClassListSection.class]) {
            MKObjCClassListSection *classListSection = (MKObjCClassListSection*)section;
            // Print all the class names
            for (MKPointerNode *clsPointer in classListSection.elements) {
                // The __objc_(n)classlist sections are just a list of pointers to class structures in the data section
                MKObjCClass *cls = clsPointer.pointee.value;
                // The pointer to the class name is stored in the class data
                MKObjCClassData *clsData = cls.classData.pointee.value;
                // Finally, the name is a pointer to a string in the strings section
                MKCString *clsName = clsData.name.pointee.value;
                
                NSLog(@"%@", clsName);
            }
        }
    }

from macho-kit.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.