All Projects → rodionovd → Rd_route

rodionovd / Rd_route

Licence: mit
Function hooking for macOS

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to Rd route

Wbblades
基于mach-o解析技术的包大小占比分析、无用类检测、无符号表时的日志符号化 (Based on mach-o technology, a simple and efficient code size detection, useless class detection and unsigned crash log detection )
Stars: ✭ 243 (+76.09%)
Mutual labels:  mach-o
Macho Explorer
A graphical Mach-O viewer for macOS. Powered by Mach-O Kit.
Stars: ✭ 406 (+194.2%)
Mutual labels:  mach-o
Tbd
A command-line tool to create Text-Based Application Programming Interface (TAPI) files from existing binaries
Stars: ✭ 82 (-40.58%)
Mutual labels:  mach-o
SnakeKit
A C++ library for parsing ObjC Metadata of Mach-O files.
Stars: ✭ 26 (-81.16%)
Mutual labels:  mach-o
Osx Abi Macho File Format Reference
Mirror of OS X ABI Mach-O File Format Reference
Stars: ✭ 379 (+174.64%)
Mutual labels:  mach-o
Hookcase
Tool for reverse engineering macOS/OS X
Stars: ✭ 452 (+227.54%)
Mutual labels:  mach-o
Cave miner
Search for code cave in all binaries
Stars: ✭ 218 (+57.97%)
Mutual labels:  mach-o
Bingrep
like ~~grep~~ UBER, but for binaries
Stars: ✭ 1,395 (+910.87%)
Mutual labels:  mach-o
Cydia
🔥🔥🔥我的微信公众号: Cydia 🔥🔥🔥=> Cydia插件 Logos语言 开发Tweak.xm Cydia Substrate 注入dylib iOS逆向工程开发 越狱Jailbreak deb插件 - fishhook / Frida / iOSOpenDev / Cycript / MachOView / IDA / Hopper Disassembler / MonkeyDev / Class-dump / Theos / Reveal / Dumpdecryptd / FLEX / 汇编Assembly / CaptainHook / lldb/LLVM/XNU/Darwin/iOS Reverse
Stars: ✭ 407 (+194.93%)
Mutual labels:  mach-o
Macho Browser
Mac browser for Mach-O binaries (macOS, iOS, watchOS, and tvOS)
Stars: ✭ 77 (-44.2%)
Mutual labels:  mach-o
machomachomangler
Tools for mangling Mach-O and PE binaries
Stars: ✭ 39 (-71.74%)
Mutual labels:  mach-o
symbol-collector
Clients and Server to collect system symbols.
Stars: ✭ 20 (-85.51%)
Mutual labels:  mach-o
Fcd
An optimizing decompiler
Stars: ✭ 622 (+350.72%)
Mutual labels:  mach-o
Unity.Blog.Override App Delegate
A maintainable way to extend / override app delegate in Unity iOS / OSX standalone player. (Much) more at http://eppz.eu/blog/override-app-delegate-unity-ios-osx-1/
Stars: ✭ 28 (-79.71%)
Mutual labels:  mach-o
Segment dumper
Simple example of a Mach-O parser
Stars: ✭ 85 (-38.41%)
Mutual labels:  mach-o
Hellosilicon
An attempt with ARM64 assembly on Apple Silicon Macs
Stars: ✭ 220 (+59.42%)
Mutual labels:  mach-o
Macho Kit
A C/Objective-C library for parsing Mach-O files.
Stars: ✭ 416 (+201.45%)
Mutual labels:  mach-o
Filebytes
Library to read and edit files in the following formats: Executable and Linking Format (ELF), Portable Executable (PE), MachO and OAT (Android Runtime)
Stars: ✭ 105 (-23.91%)
Mutual labels:  mach-o
Macholibre
Mach-O & Universal Binary Parser
Stars: ✭ 102 (-26.09%)
Mutual labels:  mach-o
Machdump
A very basic C Mach-O Header Dump tool written for practicing purposes. Works With x86 and x86_64 binaries
Stars: ✭ 25 (-81.88%)
Mutual labels:  mach-o

rd_route

Build Status
Replace (aka «hook» or «override» or «route») implementation of any C function in runtime. Works on OS X with Mach–O binaries.

Do not use this code. It can destroy everthing. But if you do, I wish you a luck.

NOTE: rd_route won't work on iOS. You should take a look at libevil instead.
Aaand it won't work for you too if you're targeting ARM64. Unfortunately I don't have a modern iOS device and thus unable to look into it, but maybe you do?

Usage

#include <assert.h>
#include "rd_route.h"


static char* my_strerror(int err)
{
  return "It's OK";
}

int main (void)
{

    void *(*original)(int) = NULL;
    int err = 2;

    printf("Error(%d): %s", err, strerror(err));
    // >> No such file or directory

    rd_route(strerror, my_strerror, (void **)&original);
    
    // See if the patch works
    assert(0 == strcmp("It's OK", strerror(err)));
    // See if an original implementation is still available
    assert(0 == strcmp("No such file or directory", original(err)));

    return 0;
}

Integration

Using git submodules

$ cd /your/project/path
$ git submodule add https://github.com/rodionovd/rd_route

Not using git submodules

Just copy rd_route.h and rd_route.c files into your project's directory.


But wait, we already have mach_override for this stuff

I've created this library because mach_override requires an external disassembler in order to work properly. For those of us who don't want another few thousands of lines of foreign code in their projects, the only option is to hard-code every function prologue they know in order to patch it correctly — which isn't a great alternative to have, to be honest.

Credits

  • The source code is based on Landon Fuller's (@landonf) gorgeous libevil library.

  • I'm also glade we have Jonathan 'Wolf' Rentzsch out there with his classy mach_override 👍


If you found any bug(s) or something, please open an issue or a pull request — I'd appreciate your help! (^,,^)


Dmitry Rodionov, 2014-2015
[email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].