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

    • Modded/Hacked App: My Lovely Planet Puzzle Match3 By Imagine
      Bundle ID: com.mylovelyplanet.mylovelyforests
      App Store Link: https://apps.apple.com/us/app/my-lovely-planet-puzzle-match3/id6473546315?uo=4


      🤩 Hack Features

      - Auto Win
      - Coins
      - Life
      • 0 replies
    • Modded/Hacked App: My Lovely Planet Puzzle Match3 By Imagine
      Bundle ID: com.mylovelyplanet.mylovelyforests
      App Store Link: https://apps.apple.com/us/app/my-lovely-planet-puzzle-match3/id6473546315?uo=4


      🤩 Hack Features

      - Auto Win
      - Coins
      - Life
      • 0 replies
    • Dopamine Hit Cheats v3.4.0 +5
      Modded/Hacked App: Dopamine Hit By Mobigames INC.
      Bundle ID: com.mobigames.fakeroem
      App Store Link: https://apps.apple.com/us/app/dopamine-hit/id6736514242?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - God Mode
      - Multiply Attack
      - No Skills Cooldown
      - Freeze Currencies
      - PREMIUM

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/196879-dopamine-hit-cheats-v2120-5/
        • Agree
        • Thanks
        • Winner
        • Like
      • 36 replies
    • Zooba: Zoo Battle Royale Game v5.25.0 Jailed Cheats +2
      Modded/Hacked App: Zooba: Zoo Battle Royale Games By Wildlife Studios Limited
      Bundle ID: com.fungames.battleroyale
      iTunes Store Link: https://apps.apple.com/us/app/zooba-zoo-battle-royale-games/id1459402952?uo=4


      Hack Features:
      - Map Hacks
      - Allow Shoot in Water


      Jailbreak required hack(s): https://iosgods.com/topic/131104-arm64-zooba-zoo-battle-royale-game-cheats-all-versions-2/


      iOS Hack Download Link: https://iosgods.com/topic/131134-arm64-zooba-zoo-battle-royale-game-v320-jailed-cheats-2/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,323 replies
    • BitLife - Life Simulator Cheats v3.20.2 +2
      Modded/Hacked App: BitLife - Life Simulator by Candywriter, LLC
      Bundle ID: com.wtfapps.apollo16
      iTunes Store Link: https://apps.apple.com/us/app/bitlife-life-simulator/id1374403536?uo=4&at=1010lce4


      Hack Features:
      - Infinite Cash
      - Free Bitizen Purchase (Press Cancle) - Work for All Versions


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/84167-arm64-bitlife-life-simulator-v1412-jailed-cheats-2/


      Hack Download Link: https://iosgods.com/topic/84223-arm64-bitlife-life-simulator-cheats-all-versions-2/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 3,712 replies
    • Cafeland - World Kitchen Cheats v2.54.6 +1
      Modded/Hacked App: Cafeland - World Kitchen by Gamegos Internet Teknolojileri Ltd Sti.
      Bundle ID: com.gamegos.mobile.cafeland
      iTunes Store Link: https://apps.apple.com/us/app/cafeland-world-kitchen/id1147665432?uo=4&at=1010lce4



      Hack Features:
      - Freeze Currencies


      iOS Hack Download Link: https://iosgods.com/topic/100701-arm64-cafeland-world-kitchen-cheats-v2023-1/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 426 replies
    • Hardcore Leveling Warrior Cheats v1.5.1 +5
      Modded/Hacked App: Hardcore Leveling Warrior By SuperPlanet corp.
      Bundle ID: com.superplanet.lucid3.global
      iTunes Store Link: https://apps.apple.com/us/app/hardcore-leveling-warrior/id6737226714?uo=4

      Hack Features

      - God Mode 
      - One Hit Kill
      - Multiply Attack
      - Multiply Defense
      - PREMIUM (No Ads, Speed, etc ..)


      For Non-Jailbroken & No Jailbreak required hacks: https://iosgods.com/forum/79-no-jailbreak-section/
       

      iOS Hack Download Link https://iosgods.com/topic/191048-hardcore-leveling-warrior-cheats-v111-5/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 102 replies
    • Cats & Soup Cheats v2.75.1 +2
      Modded/Hacked App: Cats & Soup By HIDEA Co.,Ltd
      Bundle ID: com.hidea.cat
      iTunes Store Link: https://apps.apple.com/us/app/cats-soup/id1581431235?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Infinite Currencies
      - Unlocked All Specials and No Ads

       

      Non-Jailbroken Hack: https://iosgods.com/topic/157486-cats-soup-v2630-jailed-cheats-2/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/157484-cats-soup-cheats-v2640-2/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 314 replies
    • Jetpack Joyride Cheats v1.101.2 +8
      Modded/Hacked App: Jetpack Joyride By Halfbrick
      Bundle ID: com.halfbrick.jetpack
      iTunes Store Link: https://apps.apple.com/us/app/jetpack-joyride/id457446957?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Infinite Coins
      - High Score
      - God Mode
      - Free Shopping
      - Coin Magnet Enabled
      - Increased Magnet Range
      - All Items Owned
      - All Gadgets Unlocked

       

      Non-Jailbroken Hack: https://iosgods.com/topic/119791-jetpack-joyride-v1971-jailed-cheats-8/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/119788-jetpack-joyride-cheats-v1972-8/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 506 replies
    • DEAD TARGET: FPS Zombie Games v6.157.0 [ +10 Cheats ] Currency Max
      Modded/Hacked App: DEAD TARGET: FPS Zombie Games By VNG SINGAPORE PTE LTD
      Bundle ID: com.vng.g6.a.zombie
      iTunes Store Link: https://apps.apple.com/us/app/dead-target-fps-zombie-games/id901793885?uo=4
       

      Hack Features

      - Unlimited Gold
      - Unlimited Cash

      - Unlimited Diamonds
      - Unlimited Grenades
      - Unlimited MedKits
      - Unlimited Ammo
      - One Hit Kill
      - God Mode
      - High Accuracy

      - ADS NO
        • Agree
        • Winner
        • Like
      • 25 replies
    • DEAD TARGET: FPS Zombie Games v6.157.0 [ +10 Jailed ] Currency Max
      Modded/Hacked App: DEAD TARGET: FPS Zombie Games By VNG SINGAPORE PTE LTD
      Bundle ID: com.vng.g6.a.zombie
      iTunes Store Link: https://apps.apple.com/us/app/dead-target-fps-zombie-games/id901793885?uo=4
       

      Hack Features

      - Unlimited Gold
      - Unlimited Cash

      - Unlimited Diamonds
      - Unlimited Grenades
      - Unlimited MedKits
      - Unlimited Ammo
      - One Hit Kill
      - God Mode
      - High Accuracy

      - ADS NO
        • Informative
        • Agree
        • Thanks
        • Winner
        • Like
      • 41 replies
    • Alien Survivor: Survival Arena v1.42.0 [ +7 Cheats ] Currency Max
      Modded/Hacked App: Alien Survivor: Survival Arena By IMPONILOX LIMITED
      Bundle ID: world.playme.x
      iTunes Store Link: https://apps.apple.com/us/app/alien-survivor-survival-arena/id1669761844?uo=4
       

      🚀 Hack Features

      - ADS NO [ Rewards Free ]

      - Gems [ Achievements Rewards Only One Get ]

      - Energy [ Just Buy ]

      - HP [ Just Equip & Unequip ]

      - ATK [ Just Equip & Unequip ]

      - DEF [ Just Equip & Unequip ]

      - Skill CD [ First Get Then Use ]


      🍏 For Non-Jailbroken & No Jailbreak required hacks: https://iosgods.com/forum/79-no-jailbreak-section/
      🤖 Modded Android APK(s): https://iosgods.com/forum/68-android-section/
        • Informative
        • Agree
        • Haha
        • Winner
        • Like
      • 25 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