Jump to content

3 posts in this topic

Recommended Posts

Posted (edited)

hello!

I am following https://iosgods.com/topic/166258-unity-game-hacking-tutorial-speed-hack-part-3-function-hooking/ and have made some progress in hooking an il2cpp unity game. (jailbreak ipad pro)

Here is the method I'm trying to hook for practice.

[Token(Token = "0x60003DF")]
[Address(RVA = "0x264C3E4", Offset = "0x264C3E4", VA = "0x264C3E4")]
private static byte[] KeySaltShaker(string keySalt)
{
	return null;
}

I'm using the iOS-Mod-Menu-Template-for-Theos and am just trying to print the parameters of the method and not actually alter anything.

My tweak.xm looks like this, with the framework set to "UnityFramework" but I cut all the stuff beyond including setupMenu

#import "Macros.h"

void writeAndAppendString(NSString *str) {

    NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];

    NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"hook.log"];

    NSFileManager *fileManager = [NSFileManager defaultManager];
    if ([fileManager fileExistsAtPath:filePath]) {
        // Add the text at the end of the file.
        NSFileHandle *fileHandler = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
        [fileHandler seekToEndOfFile];
        [fileHandler writeData:data];
        [fileHandler closeFile];
    } else {
        // Create the file and write text to it.
                [data writeToFile:filePath atomically:YES];
    }
}

std::string* (*original_method)(void *self, std::string *keySalt);
std::string* hook_method(void *self, std::string *keySalt) {

    if (self != NULL) {
    
        writeAndAppendString(@"\nEnter\n");
        writeAndAppendString([NSString stringWithUTF8String:keySalt->c_str()]);
    
        std::string *returnValue = original_method(self, keySalt);
    
        writeAndAppendString(@"\nExit\n");
    
        return returnValue;
    }

    return original_method(self, keySalt);
}

/***********************************************************
  INSIDE THE FUNCTION BELOW YOU'LL HAVE TO ADD YOUR SWITCHES!
***********************************************************/
void setup() {
    HOOK(0x264C3E4, hook_method, original_method);

    writeAndAppendString(@"Completed setup\n");
}

The `Enter` and `Exit` print properly and I can see the method is being invoked multiple times without the game crashing but my `keySalt` parameter always prints empty.

The `returnValue` also prints nothing in this case if I try to log it in the same way as `keySalt`

I don't know enough about C / Objective C++ and how it relates to the .Net in dnSpy. I only write Java lol. I'm going crazy trying to figure out string, std::string, NSString, IL2CppString and how they all fit when wanting to hook in this way.

I'm not sure if its hooking the right method, nor reading the parameters properly. Its an appguard protected game. FFBE War of the Visions which has existing hack here too

Can anyone give me some tips on how to print out the parameters of methods like this?? I'm also going to run into some other use cases where the parameters of methods in the il2cpp dump are Unity classes.

Thanks in advance!

EDIT: just realized its static method. will try a few more things as well.

Updated by errantmitosis
Posted
6 hours ago, quatorze said:

I was originally using NSLog but I couldn't find where it was logging to so I decided to just log to a file in the app's tmp directory.

I made some more progress after I found some info on using an implementation of a Unity string I found here, so I will continue researching other data types.

typedef struct _monoString {
    void *klass;
    void *monitor;
    int length;
    char chars[1];

    int getLength() {
        return length;
    }

    char *getChars() {
        return chars;
    }
} monoString;

It brought me to another question. If you have a pointer to something like a string or a byte[], is it possible to know the length? or is that something you have to dig elsewhere in the binary itself.

// Gsc.App.Encryption.EncryptionHelper
// Token: 0x060003DE RID: 990 RVA: 0x000020B2 File Offset: 0x000002B2
[Token(Token = "0x60003DE")]
[Address(RVA = "0x264C49C", Offset = "0x264C49C", VA = "0x264C49C")]
internal static byte[] Encrypt(byte[] input, string keySalt, EncryptionHelper.Options options, [Optional] byte[] IV, [Optional] string requestId, [Optional] byte[] customKey)
{
    return null;
}

if I wanted to log the input or the IV for instance. I tried sizeof but thats just the 8 bytes for the 64 bit pointer it seems.

Sorry for the noob questions!

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
  • Our picks

    • Crunchyroll: Gift v1.0.2 +5 Jailed Cheats [ Unlocked ]
      Modded/Hacked App: Crunchyroll: Gift By Crunchyroll, LLC
      Bundle ID: com.crunchyroll.gv.gift
      App Store Link: https://apps.apple.com/us/app/crunchyroll-gift/id6747459734?uo=4

       
       

      🤩 Hack Features

      - God Mode
      - Unlock All Tools -> Head into Settings in-game and toggle the License button.*
      - Unlock All Passengers -> Head into Settings in-game and toggle the License button.*
      - Unlock All Memories -> Head into Settings in-game and toggle the License button.*
      -- Full Game Unlocked

      * - Only use 1 feature at a time.
      • 0 replies
    • Crunchyroll: Gift v1.0.2 +5 Cheats [ Unlocked ]
      Modded/Hacked App: Crunchyroll: Gift By Crunchyroll, LLC
      Bundle ID: com.crunchyroll.gv.gift
      App Store Link: https://apps.apple.com/us/app/crunchyroll-gift/id6747459734?uo=4

       
       

      🤩 Hack Features

      - God Mode
      - Unlock All Tools -> Head into Settings in-game and toggle the License button.*
      - Unlock All Passengers -> Head into Settings in-game and toggle the License button.*
      - Unlock All Memories -> Head into Settings in-game and toggle the License button.*
      -- Full Game Unlocked

      * - Only use 1 feature at a time.
      • 0 replies
    • Kingdom Rush Battles: TD Game v1.1.0 +4 Jailed Cheats [ No Tower Cost ]
      Modded/Hacked App: Kingdom Rush Battles: TD Game By Ironhide S.A.
      Bundle ID: com.ironhidegames.kingdomrush.mp
      App Store Link: https://apps.apple.com/ph/app/kingdom-rush-battles-td-game/id6746510979?uo=4

       
       

      🤩 Hack Features

      - Dumb Enemy -> Disables your enemy from buying towers.
      - No Tower Build Cost -> Use with Dumb Enemy.
      - No Tower Upgrade Cost -> Use with Dumb Enemy.
      - No Tower Skill Upgrade Cost -> Use with Dumb Enemy.
        • Informative
        • Winner
        • Like
      • 20 replies
    • Kingdom Rush Battles: TD Game v1.1.0 +4 Cheats [ No Tower Cost ]
      Modded/Hacked App: Kingdom Rush Battles: TD Game By Ironhide S.A.
      Bundle ID: com.ironhidegames.kingdomrush.mp
      App Store Link: https://apps.apple.com/ph/app/kingdom-rush-battles-td-game/id6746510979?uo=4

       


      🤩 Hack Features

      - Dumb Enemy -> Disables your enemy from buying towers.
      - No Tower Build Cost -> Use with Dumb Enemy.
      - No Tower Upgrade Cost -> Use with Dumb Enemy.
      - No Tower Skill Upgrade Cost -> Use with Dumb Enemy.
        • Agree
        • Haha
        • Winner
        • Like
      • 12 replies
    • World Conqueror 4 v3.0.1 +5 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: World Conqueror 4 By 悦 张
      Bundle ID: com.zhangyue.wc4
      iTunes Store Link: https://apps.apple.com/us/app/world-conqueror-4/id1258468290?uo=4


      Hack Features:
      - Unlimited Gold -> Earn or spend some.
      - Unlimited Medals -> Earn or spend some.
      - Unlimited Energy -> Earn or spend some.
      - Unlimited Industry Points -> Earn or spend some.
      - Unlimited Technology Points -> Earn or spend some.


      Jailbreak required hack(s): [Mod Menu Hack] World Conqueror 4 v2.5.0 +5 Cheats [ Unlimited Currencies ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 81 replies
    • World Conqueror 4 v3.0.1 +5 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: World Conqueror 4 By 悦 张
      Bundle ID: com.zhangyue.wc4
      iTunes Store Link: https://apps.apple.com/us/app/world-conqueror-4/id1258468290?uo=4


      Hack Features:
      - Unlimited Gold -> Earn or spend some.
      - Unlimited Medals -> Earn or spend some.
      - Unlimited Energy -> Earn or spend some.
      - Unlimited Industry Points -> Earn or spend some.
      - Unlimited Technology Points -> Earn or spend some.


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] World Conqueror 4 v2.5.0 +5 Jailed Cheats [ Unlimited Currencies ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 61 replies
    • Monster Hunter Puzzles v2.21.01 +7 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Monster Hunter Puzzles By CAPCOM Co., Ltd
      Bundle ID: jp.co.capcom.mhpuzzle
      iTunes Store Link: https://apps.apple.com/us/app/monster-hunter-puzzles/id1591864714?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Unlimited Acorns -> Earn or spend some.
      - Unlimited Gems -> Earn or spend some.
      - Unlimited Tickets -> Earn or spend some.
      - Unlimited Lives -> Will not decrease.
      - Unlimited Boosters -> Will not decrease.
      - Unlimited Moves -> Will not decrease.
      - Auto Win


      Jailbreak required hack(s): [Mod Menu Hack] Monster Hunter Puzzles v2.01.02 +7 Cheats [ Unlimited Currencies ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 63 replies
    • Disney Emoji Blitz Game v73.1.0 +1++ Jailed Cheat [ Unlimited Currencies ]
      Modded/Hacked App: Disney Emoji Blitz Game By Jam City, Inc.
      Bundle ID: com.disney.emojimatch
      iTunes Store Link: https://apps.apple.com/us/app/disney-emoji-blitz-game/id1017551780
       

      Hack Features:
      - Unlimited Currencies -> Earn some.


      Jailbreak required hack(s): https://iosgods.com/topic/168886-disney-emoji-blitz-game-all-versions-1-cheats-unlimited-currencies/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 217 replies
    • Disney Emoji Blitz Game v73.1.0 +1++ Cheat [ Unlimited Currencies ]
      Modded/Hacked App: Disney Emoji Blitz Game By Jam City, Inc.
      Bundle ID: com.disney.emojimatch
      iTunes Store Link: https://apps.apple.com/us/app/disney-emoji-blitz-game/id1017551780
       

      Hack Features:
      - Unlimited Currencies -> Earn some.


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/168888-disney-emoji-blitz-game-v5320-1-jailed-cheat-unlimited-currencies/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 68 replies
    • Monster Hunter Puzzles v2.21.01 +7 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Monster Hunter Puzzles By CAPCOM Co., Ltd
      Bundle ID: jp.co.capcom.mhpuzzle
      iTunes Store Link: https://apps.apple.com/us/app/monster-hunter-puzzles/id1591864714?uo=4


      Hack Features:
      - Unlimited Acorns -> Earn or spend some.
      - Unlimited Gems -> Earn or spend some.
      - Unlimited Tickets -> Earn or spend some.
      - Unlimited Lives -> Will not decrease.
      - Unlimited Boosters -> Will not decrease.
      - Unlimited Moves -> Will not decrease.
      - Auto Win


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Monster Hunter Puzzles v2.01.02 +5 Jailed Cheats [ Unlimited Currencies ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
        • Haha
        • Thanks
        • Winner
        • Like
      • 39 replies
    • Good Pizza, Great Pizza v5.38.0 +8 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Good Pizza, Great Pizza By TAPBLAZE, LLC
      Bundle ID: com.tapblaze.pizzabusiness
      iTunes Store Link: https://apps.apple.com/us/app/good-pizza-great-pizza/id911121200?uo=4


      Hack Features:
      - Unlimited Cash
      - Unlimited Diamonds
      - Unlimited Ad Tickets

      VIP
      -̶ ̶U̶n̶l̶i̶m̶i̶t̶e̶d̶ ̶P̶i̶z̶z̶a̶ ̶P̶a̶s̶s̶ ̶T̶o̶k̶e̶n̶s̶
      ̶-̶ ̶C̶h̶e̶f̶ ̶P̶a̶s̶s̶ ̶U̶n̶l̶o̶c̶k̶e̶d̶
      ̶-̶ ̶M̶a̶x̶ ̶P̶i̶z̶z̶a̶ ̶P̶a̶s̶s̶ ̶L̶e̶v̶e̶l̶
       ̶-̶ ̶S̶t̶a̶r̶t̶e̶r̶ ̶B̶u̶n̶d̶l̶e̶ ̶U̶n̶l̶o̶c̶k̶e̶d̶
      - Unlimited Paint Tickets
      - Unlimited Event Currency
      - Max Event Level
      - Unlimited Event Score
      - All Achievements Completed
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 427 replies
    • Good Pizza, Great Pizza v5.38.0 +8 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Good Pizza, Great Pizza By TAPBLAZE, LLC
      Bundle ID: com.tapblaze.pizzabusiness
      iTunes Store Link: https://apps.apple.com/us/app/good-pizza-great-pizza/id911121200?uo=4


      Hack Features:
      - - Unlimited Cash
      - Unlimited Diamonds
      - Unlimited Ad Tickets

      VIP
      -̶ ̶U̶n̶l̶i̶m̶i̶t̶e̶d̶ ̶P̶i̶z̶z̶a̶ ̶P̶a̶s̶s̶ ̶T̶o̶k̶e̶n̶s̶
      ̶-̶ ̶C̶h̶e̶f̶ ̶P̶a̶s̶s̶ ̶U̶n̶l̶o̶c̶k̶e̶d̶
      ̶-̶ ̶M̶a̶x̶ ̶P̶i̶z̶z̶a̶ ̶P̶a̶s̶s̶ ̶L̶e̶v̶e̶l̶
       ̶-̶ ̶S̶t̶a̶r̶t̶e̶r̶ ̶B̶u̶n̶d̶l̶e̶ ̶U̶n̶l̶o̶c̶k̶e̶d̶
      - Unlimited Paint Tickets
      - Unlimited Event Currency
      - Max Event Level
      - Unlimited Event Score
      - All Achievements Completed
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 214 replies
×
  • 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