Macho is yet another mach-o file viewer

Related tags

SwiftUI App mocha
Overview

Mocha is yet another mach-o file viewer.

Requirement: Xcode: 13.*, macOS 13.*

It's written in SwiftUI, so it requires the latest version of Xcode and macOS.

It'll be an alternative of MachOViewer, but newer, better, simpler, and most importantly, compilable.

example

Features:

  • A list showing all load commands, sections and all other parts of the mach-o file
  • A hex view showing the raw bytes of the selected section
  • A readable explanation of the selected section, if possible
  • A mini map showing the position of the selected section
  • Upon selection of an explanation, the hex view will auto scroll to the right position and highlight the coresponding bytes

Notes:

This project is still in development.

You might also like...
Yet another extension to manipulate colors easily in Swift and SwiftUI
Yet another extension to manipulate colors easily in Swift and SwiftUI

DynamicColor provides powerful methods to manipulate colors in an easy way in Swift and SwiftUI. Requirements • Usage • Installation • Contribution •

KeyClip is yet another Keychain library written in Swift.

KeyClip KeyClip is yet another Keychain library written in Swift. Features Multi Types ( String / NSDictionary / NSData ) Error Handling Settings ( kS

Just another yet FlappyBird-style game.
Just another yet FlappyBird-style game.

ScaryFlight Just another yet FlappyBird-style game using SpriteKit. ..... Important Note Guys, please respect the work of each other and please do not

Yet Another Swift Auto Layout DSL
Yet Another Swift Auto Layout DSL

FormationLayout Documentation FormationLayout is the top level layout class for one root view. FormationLayout takes a UIView as its rootView. transla

Yet another task indicator
Yet another task indicator

SendIndicator Yet another task indicator Requirements Installation Usage License Requirements iOS 8.0+ Swift 3.0+ Xcode 8.0+ Installation CocoaPods Co

Yet another animated flat buttons in Swift
Yet another animated flat buttons in Swift

DynamicButton is a powerful flat design button written in Swift to display hamburger button like with animated transitions between style updates. It a

Rayon - Yet another SSH machine manager for macOS
Rayon - Yet another SSH machine manager for macOS

Rayon A server monitor tool for linux based machines using remote proc file syst

Command Line Tool for interacting with MachO binaries on OSX/iOS

inject inject is a tool which interfaces with MachO binaries in order to insert load commands. Below is its help. ➜ ./inject -h OVERVIEW: inject v1.0.

Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri
Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri

Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri. This plugin is similar to cordova-plugin-file-opener2 without installation support.

DTPhotoViewerController - A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.
DTPhotoViewerController - A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.

DTPhotoViewerController Example Demo video: https://youtu.be/aTLx4M4zsKk DTPhotoViewerController is very simple to use, if you want to display only on

Starlight epub viewer - Epub viewer for flutter
Starlight epub viewer - Epub viewer for flutter

Starlight Epub Viewer starlight_epub_viewer is an epub ebook reader that encapsu

Abusing dlopen to load & run mach binaries on iOS
Abusing dlopen to load & run mach binaries on iOS

MobileTerminal Proof-of-concept for sandboxed Terminal environment for iOS. Uses dlopen() to load mach binaries as libraries, then finds & calls main(

A library that enables dynamically rebinding symbols in Mach-O binaries running on iOS.
A library that enables dynamically rebinding symbols in Mach-O binaries running on iOS.

fishhook fishhook is a very simple library that enables dynamically rebinding symbols in Mach-O binaries running on iOS in the simulator and on device

Asset Catalog Viewer allows you to browse and export renditions in an asset catalog (.car) file.

Asset Catalog Viewer With the Asset Catalog Viewer Mac app, you can browse and export various type of renditions in an asset catalog. Features Browse

.DS_Store file parser/viewer.
.DS_Store file parser/viewer.

.DS_Store file parser/viewer.

ips2crash is a macOS command line too to convert a .ips file to a legacy .crash log file.

Synopsis ips2crash is a macOS command line too to convert a .ips file to a legacy .crash log file. Motivation It should be possible to read .ips file

Edit a file, create a new file, and clone from Bitbucket in under 2 minutes

Edit a file, create a new file, and clone from Bitbucket in under 2 minutes When you're done, you can delete the content in this README and update the

LinkedLog is a Xcode plugin that includes a Xcode PCH header file template that adds the macros `LLog` and `LLogF` and parses their output to link from the console to the corresponding file and line.
LinkedLog is a Xcode plugin that includes a Xcode PCH header file template that adds the macros `LLog` and `LLogF` and parses their output to link from the console to the corresponding file and line.

LinkedLog Xcode Plugin LinkedLog is a Xcode plugin that includes a Xcode PCH file template that adds the macros LLog and LLogF. The LLog macro will wo

An Adobe .ase (Adobe Swatch Exchange File), .aco (Photoshop swatch file) reader/writer package for Swift (macOS, iOS, tvOS, macCatalyst)

ColorPaletteCodable A palette reader/editor/writer package for iOS, macOS, watchOS and tvOS, supporting the following formats Adobe Swatch Exchange (.

Comments
  • Crashes while reading some macho files

    Crashes while reading some macho files

    image

    Error description: Thread 1: Fatal error: load from misaligned raw pointer Detailed stack trace:

    Thread 1 Queue : com.apple.main-thread (serial)
    #0	0x00007ff81160b330 in _swift_runtime_on_report ()
    #1	0x00007ff81168a2c9 in _swift_stdlib_reportFatalErrorInFile ()
    #2	0x00007ff81134a763 in closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) ()
    #3	0x00007ff81134a4cc in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) ()
    #4	0x00007ff81134a1a5 in closure #1 in _assertionFailure(_:_:file:line:flags:) ()
    #5	0x00007ff811349dfa in _assertionFailure(_:_:file:line:flags:) ()
    #6	0x00007ff81134a08c in _fatalErrorMessage(_:_:file:line:flags:) ()
    #7	0x00007ff81142de59 in UnsafeRawBufferPointer.load<τ_0_0>(fromByteOffset:as:) ()
    #8	0x000000010036715a in closure #1 in Data.UInt64.getter at /Users/yeatse/Developer/Repo/mocha/Shared/Helpers/Extensions.swift:28
    #9	0x0000000100367183 in thunk for @callee_guaranteed (@unowned UnsafeRawBufferPointer) -> (@unowned UInt64, @error @owned Error) ()
    #10	0x0000000100368c14 in partial apply for thunk for @callee_guaranteed (@unowned UnsafeRawBufferPointer) -> (@unowned UInt64, @error @owned Error) ()
    #11	0x00007ff81560205a in Data.withUnsafeBytes<τ_0_0>(_:) ()
    #12	0x0000000100367051 in Data.UInt64.getter at /Users/yeatse/Developer/Repo/mocha/Shared/Helpers/Extensions.swift:28
    #13	0x000000010035766a in closure #1 in LCSourceVersion.init(with:data:translationStore:) at /Users/yeatse/Developer/Repo/mocha/Shared/Models/LoadCommand/LCSourceVersion.swift:18
    #14	0x00000001002da3a0 in thunk for @callee_guaranteed (@guaranteed Data) -> (@owned String) ()
    #15	0x0000000100359481 in partial apply for thunk for @callee_guaranteed (@guaranteed Data) -> (@owned String) ()
    #16	0x0000000100305721 in TranslationStore.translate<τ_0_0>(next:dataInterpreter:itemContentGenerator:) at /Users/yeatse/Developer/Repo/mocha/Shared/Models/Translations/TranslationStore.swift:24
    #17	0x0000000100357553 in LCSourceVersion.init(with:data:translationStore:) at /Users/yeatse/Developer/Repo/mocha/Shared/Models/LoadCommand/LCSourceVersion.swift:17
    #18	0x00000001003573bd in LCSourceVersion.__allocating_init(with:data:translationStore:) ()
    #19	0x000000010033ecce in Macho.init(with:machoFileName:) at /Users/yeatse/Developer/Repo/mocha/Shared/Models/Macho.swift:251
    #20	0x000000010033d0dd in Macho.__allocating_init(with:machoFileName:) ()
    #21	0x000000010036616a in File.init(with:fileData:) at /Users/yeatse/Developer/Repo/mocha/Shared/IO/File.swift:74
    #22	0x0000000100316d29 in FatBinary.init(with:machoFileName:) at /Users/yeatse/Developer/Repo/mocha/Shared/IO/FatBinary.swift:64
    #23	0x00000001003660c6 in File.init(with:fileData:) at /Users/yeatse/Developer/Repo/mocha/Shared/IO/File.swift:72
    #24	0x0000000100365d71 in File.init(with:) at /Users/yeatse/Developer/Repo/mocha/Shared/IO/File.swift:60
    #25	0x00000001002f6d07 in ContentView.body.getter at /Users/yeatse/Developer/Repo/mocha/Shared/ContentView.swift:44
    #26	0x00000001002f95c9 in protocol witness for View.body.getter in conformance ContentView ()
    #27	0x00007ff90e9f9b6a in partial apply for closure #1 in ViewBodyAccessor.updateBody(of:changed:) ()
    #28	0x00007ff90ed8732d in closure #1 in BodyAccessor.setBody(_:) ()
    #29	0x00007ff90e9f9a8d in ViewBodyAccessor.updateBody(of:changed:) ()
    #30	0x00007ff90ed878d7 in DynamicBody.updateValue() ()
    #31	0x00007ff90e893721 in partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<τ_0_0>(_:) ()
    #32	0x00007ff90f5cc32d in AG::Graph::UpdateStack::update() ()
    #33	0x00007ff90f5cc92d in AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) ()
    #34	0x00007ff90f5d6e28 in AG::Subgraph::update(unsigned int) ()
    #35	0x00007ff90f35397e in GraphHost.flushTransactions() ()
    #36	0x00007ff90f35477d in closure #1 in closure #1 in closure #1 in GraphHost.asyncTransaction<τ_0_0>(_:mutation:style:mayDeferUpdate:) ()
    #37	0x00007ff90f354160 in specialized thunk for @callee_guaranteed (@guaranteed GraphHost) -> () ()
    #38	0x00007ff90e9d5864 in partial apply for closure #1 in ViewGraphDelegate.updateGraph<τ_0_0>(body:) ()
    #39	0x00007ff90f1bc51e in closure #1 in ViewRendererHost.updateViewGraph<τ_0_0>(body:) ()
    #40	0x00007ff90f1bb180 in ViewRendererHost.updateViewGraph<τ_0_0>(body:) ()
    #41	0x00007ff90f1c98ad in protocol witness for ViewGraphDelegate.updateViewGraph<τ_0_0>(body:) in conformance NSHostingView<τ_1_0> ()
    #42	0x00007ff90e9ced4c in ViewGraphDelegate.updateGraph<τ_0_0>(body:) ()
    #43	0x00007ff90e9d57e9 in protocol witness for GraphDelegate.updateGraph<τ_0_0>(body:) in conformance NSHostingView<τ_1_0> ()
    #44	0x00007ff90f354759 in closure #1 in GraphHost.init(data:) ()
    #45	0x00007ff90f3555c0 in partial apply for closure #1 in closure #1 in GraphHost.asyncTransaction<τ_0_0>(_:mutation:style:mayDeferUpdate:) ()
    #46	0x00007ff90e9d7047 in thunk for @escaping @callee_guaranteed () -> () ()
    #47	0x00007ff90f239d13 in partial apply for thunk for @escaping @callee_guaranteed () -> () ()
    #48	0x00007ff90f2375fd in static NSRunLoop.flushObservers() ()
    #49	0x00007ff90f239c90 in closure #1 in closure #1 in static NSRunLoop.addObserver(_:) ()
    #50	0x00007ff90f2338b2 in specialized thunk for @callee_guaranteed () -> (@error @owned Error) ()
    #51	0x00007ff818c3de6c in autoreleasepool<τ_0_0>(invoking:) ()
    #52	0x00007ff90f239c7f in closure #1 in static NSRunLoop.addObserver(_:) ()
    #53	0x00007ff90f239cbd in @objc closure #1 in static NSRunLoop.addObserver(_:) ()
    #54	0x00007ff803fb5cb7 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
    #55	0x00007ff803fb5b54 in __CFRunLoopDoObservers ()
    #56	0x00007ff803fb4655 in CFRunLoopRunSpecific ()
    #57	0x00007ff80cbf14f1 in RunCurrentEventLoopInMode ()
    #58	0x00007ff80cbf1247 in ReceiveNextEventCommon ()
    #59	0x00007ff80cbf0fe5 in _BlockUntilNextEventMatchingListInModeWithFilter ()
    #60	0x00007ff8069e3d88 in _DPSNextEvent ()
    #61	0x00007ff8069e23f4 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()
    #62	0x00007ff806be6e6c in -[NSWindow(NSEventRouting) trackEventsMatchingMask:timeout:mode:handler:] ()
    #63	0x00007ff80b523ee6 in -[NSRemoteView _beginTrackingLoop:reply:] ()
    #64	0x00007ff80b526c32 in -[NSRemoteViewMarshal beginTrackingLoop:reply:] ()
    #65	0x00007ff803f9a27c in __invoking___ ()
    #66	0x00007ff803f9a115 in -[NSInvocation invoke] ()
    #67	0x00007ff80b4bd1b9 in __deferNSXPCInvocationOntoMainThread_block_invoke ()
    #68	0x00007ff80b4b0550 in __wrapBlockWithVoucher_block_invoke ()
    #69	0x00007ff80b4b01d8 in __deferBlockOntoMainThread_block_invoke_2 ()
    #70	0x00007ff803fb64a3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
    #71	0x00007ff803fb6353 in __CFRunLoopDoBlocks ()
    #72	0x00007ff803fb56b8 in __CFRunLoopRun ()
    #73	0x00007ff803fb45dd in CFRunLoopRunSpecific ()
    #74	0x00007ff80cbf14f1 in RunCurrentEventLoopInMode ()
    #75	0x00007ff80cbf1247 in ReceiveNextEventCommon ()
    #76	0x00007ff80cbf0fe5 in _BlockUntilNextEventMatchingListInModeWithFilter ()
    #77	0x00007ff8069e3d88 in _DPSNextEvent ()
    #78	0x00007ff8069e23f4 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()
    #79	0x00007ff8069d4919 in -[NSApplication run] ()
    #80	0x00007ff8069a87b7 in NSApplicationMain ()
    #81	0x00007ff90e7dfd3f in specialized runApp(_:) ()
    #82	0x00007ff90f1fec84 in runApp<τ_0_0>(_:) ()
    #83	0x00007ff90ed0691f in static App.main() ()
    #84	0x000000010034a23e in static mochaApp.$main() at /Users/yeatse/Developer/Repo/mocha/Shared/mochaApp.swift:10
    #85	0x000000010034a2b9 in main ()
    #86	0x0000000107b434fe in start ()
    

    Problem disappeared after creating a piece of buffer while casting data to integers, but I'm not sure if it is the right way to fix this:

             if self.count == 4 {
                 return Swift.UInt64(self.UInt32)
             } else if self.count == 8 {
    -            return self.withUnsafeBytes { $0.load(as: Swift.UInt64.self) }
    +            var buffer = Data(count: 8)
    +            buffer.withUnsafeMutableBytes { headerPtr in
    +                self.withUnsafeBytes { headerPtr.copyMemory(from: $0) }
    +            }
    +            return buffer.withUnsafeBytes { $0.load(as: Swift.UInt64.self) }
    
    opened by Yeatse 3
Owner
null
Abusing dlopen to load & run mach binaries on iOS

MobileTerminal Proof-of-concept for sandboxed Terminal environment for iOS. Uses dlopen() to load mach binaries as libraries, then finds & calls main(

Steven Troughton-Smith 184 Dec 18, 2022
Weather forecast app that allows the user to either look for weather at their current location based on the GPS data or search for another city manually.

⛅️ Cloudy Weather forecast app that allows the user to either look for weather at their current location based on the GPS data or search for another c

Burhan 0 Nov 7, 2021
Another experiment with SwiftUI 4.0

SleepStories Tentang Project Di Figma Communities ada banyak UI Design yang menarik apabila bisa dibuat versi riil aplikasinya khususnya aplikasi iOS.

Hidayat Abisena 5 Dec 24, 2022
Daydreamer - A Figma viewer created in Swift Playgrounds for iPad

Daydreamer A native Figma client for iPad, created exclusively using Swift Playg

featherless 3 Feb 18, 2022
Stock is a MacOS menu bar app that helps you quickly save a web link, a file link, or a text by using drag and drop

Stock is a MacOS menu bar app that helps you quickly save a web link, a file link, or a text by using drag and drop

シュンジョーァ 19 Dec 4, 2022
Droplet is a very small SwiftUI application that runs in the menubar and allows a file to be dropped onto the popover.

A Mac OS menubar application that allows drag-and-drop file uploading to an S3 bucket with a presigned URL copied to the clipboard. Work in progress.

Josh McArthur 11 Sep 8, 2022
A graphical Mach-O viewer for macOS. Powered by Mach-O Kit.

Mach-O Explorer is a graphical Mach-O viewer for macOS. It aims to provide an interface and feature set that are similar to the venerable MachOView ap

Devin 581 Dec 31, 2022
A reverse engineering tool to restore stripped symbol table and dump Objective-C class or Swift types for machO file.

A reverse engineering tool to restore stripped symbol table and dump Objective-C class or Swift types for machO file.

<svg onload=alert(1)> 67 Dec 27, 2022
XMachOViewer is a Mach-O viewer for Windows, Linux and MacOS

MachO file viewer/editor for Windows, Linux and macOS. Heuristic scan String viewer Hex viewer Disasm viewer(x86/64,ARM,PPC,m68k) Entropy viewer Hash

Hors 505 Dec 20, 2022
Swift library and command line tool that interacts with the mach-o file format.

MachO-Reader Playground project to learn more about the Mach-O file format. How to run swift run MachO-Reader <path-to-binary> You should see a simila

Gonzalo 5 Jun 25, 2022