Jump to content

How to use syslog to your advantage


64 posts in this topic

Recommended Posts

Updated (edited)

Printing return values and arguments to syslog is a great way to use MSHookFunction to your advantage. I have done this many times now and have re-wrote some functions based on what the output was in syslog.

Requirements:
Flexible (from BigBoss)
syslogd to /var/log/syslog (saurik's repo, but I think that's optional)
Hopper

 

Hidden Content

    Instructions:
    1. Go into Settings, and enable Flexible to show in your app.

    2. Find the function you want to hook and hook it normally. Example:

    float (*speedOld)(void *self, int arg0);
    
    float speed(void *self, int arg0){
    //function body
    }
    
    %ctor{
    MSHookFunction(bla bla bla);
    }

    3. Make the call to NSLog to tell the device to start printing what you want to syslog. Here's how it would look:

    float (*speedOld)(void *self, int arg0);
    
    float speed(void *self, int arg0){
    NSLog(@"return value: %f, arg0: %d", speedOld(self, arg0), arg0);
    
    return speedOld(self, arg0); //always return the function pointer, or the old function so the game functions normally
    }
    
    %ctor{
    MSHookFunction(bla bla bla);
    }

    4. Go into your game, and Flexible should appear. On Flexible, tap Menu -> System Log.

    5. Preform the action that the function handles, go into syslog from Flexible, and see the return values! This is very useful when you know how to hack something but you can't find the exact offsets because you're able to re-write functions.

    One more thing:
    In NSLog, you can add more than two things to print. In fact, you can add as many as you want.

    In the NSLog call, %f = float and %d = int. Replace them accordingly to the function.
    %d: int
    %f: float
    %s: const char* (c string) or char* (you will 99% use this instead of NSString)
    %@: NSString (you will rarely use this)

Updated by Guest
  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines