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

    • Puzzle & Dragons (English) v22.3.0 Jailed Cheats +2
      Modded/Hacked App: Puzzle & Dragons (English) By GungHo Online Entertainment, INC.
      Bundle ID: jp.gungho.padEN
      iTunes Store Link: https://apps.apple.com/us/app/puzzle-dragons-english/id563474464?uo=4


      Hack Features:
      - God Mode
      - One Hit Kill


      Jailbreak required hack(s): https://iosgods.com/topic/133984-puzzle-dragons-japan-english-cheats-all-versions-3/


      iOS Hack Download Link: https://iosgods.com/topic/135066-puzzle-dragons-english-v1931-jailed-cheats-2/
      • 316 replies
    • [ Puzzle & Dragons KR ] 퍼즐앤드래곤 v22.3.0 Jailed Cheats +2
      Modded/Hacked App: 퍼즐앤드래곤 By GungHo Online Entertainment, INC.
      Bundle ID: jp.gungho.padKO
      iTunes Store Link: https://apps.apple.com/kr/app/%ED%8D%BC%EC%A6%90%EC%95%A4%EB%93%9C%EB%9E%98%EA%B3%A4/id588637521?uo=4


      Hack Features:
      - God Mode
      - One Hit Kill


      Jailbreak required hack(s): https://iosgods.com/topic/133984-puzzle-dragons-japan-english-cheats-all-versions-3/


      iOS Hack Download Link: https://iosgods.com/topic/146388-puzzle-dragons-korea-%ED%8D%BC%EC%A6%90%EC%95%A4%EB%93%9C%EB%9E%98%EA%B3%A4-v1920-jailed-cheats-2/
      • 23 replies
    • Skullgirls Fighting RPG V7.3.3 [ +6 Jailed ] Auto Win
      Modded/Hacked App: Skullgirls: Fighting RPG By Autumn Games, LLC
      Bundle ID: com.autumn.skullgirls
      iTunes Store Link: https://apps.apple.com/us/app/skullgirls-fighting-rpg/id1280762571?uo=4


      Hack Features:

      - Auto win

      - Damage [ One HiT WiN ]

      - Energy Max

      - Skill

      - Enemy Disable

      - Goals Claimed [ Free Pass Only ]
      • 38 replies
    • Skullgirls Fighting RPG V7.3.3 [ +6 Cheats ] Auto Win
      Modded/Hacked App: Skullgirls: Fighting RPG By Autumn Games, LLC
      Bundle ID: com.autumn.skullgirls
      iTunes Store Link: https://apps.apple.com/us/app/skullgirls-fighting-rpg/id1280762571?uo=4


      Hack Features:
      - Auto win

      - Damage [ One HiT WiN ]

      - Energy Max

      - Skill

      - Enemy Disable

      - Goals Claimed [ Free Pass Only ]
        • Haha
      • 127 replies
    • Fortress Saga: AFK RPG Cheats v1.8.09 +5
      Modded/Hacked App: Fortress Saga: AFK RPG By cookapps
      Bundle ID: com.cookapps.bm.fortresssaga
      iTunes Store Link: https://apps.apple.com/us/app/fortress-saga-afk-rpg/id6446308106?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

      - Damage Multiplier
      - Defense Multiplier
      - Freeze Currencies
      - PREMIUM
      - No Ads

       

      Non-Jailbroken Hack: https://iosgods.com/topic/184193-fortress-saga-afk-rpg-v1800-jailed-cheats-3/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/178933-fortress-saga-afk-rpg-cheats-v1801-5/
        • Thanks
      • 364 replies
    • Prison Empire Tycoon-Idle Game Cheats v3.9.2 +2
      Modded/Hacked App: Prison Empire Tycoon-Idle Game by Digital Things Sociedad Limitada
      Bundle ID: com.codigames.idle.prison.empire.manager.tycoon
      iTunes Store Link: https://apps.apple.com/us/app/prison-empire-tycoon-idle-game/id1508490923?uo=4&at=1010lce4


      Hack Features:
      - Infinite Cash
      - No Ads


      Non-Jailbroken & No Jailbreak required hack(s):  https://iosgods.com/topic/128324-arm64-prison-empire-tycoon%EF%BC%8Didle-game-v102-jailed-cheats-2/

       
      iOS Hack Download Link: https://iosgods.com/topic/128322-arm64-prison-empire-tycoon%EF%BC%8Didle-game-cheats-all-versions-2/
        • Like
      • 1,161 replies
    • Left to Survive: Zombie Games Cheats v7.6.0 +10 Hacks
      Modded/Hacked App: Left to Survive: Zombie TPS By MY COM
      Bundle ID: com.glu.zbs
      iTunes Store Link: https://apps.apple.com/us/app/left-to-survive-zombie-tps/id1090501422

      Hack Features:
      - No Bullet Disperse 
      - Unlimited Ammo
      - No Recoil
      - Increased Fire-rate 

      - One Hit Campaign 
      - Grenades and Med-kits Dont Subtract
      - God Mode
      - God Mode PVP

      - Unlock Chapters early 
      - Weapons Unlocked Ready to buy 


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      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
        • Thanks
        • Winner
        • Like
      • 1,592 replies
    • [ Seven Deadly Sins KR ] 일곱 개의 대죄: GRAND CROSS Cheats v8.6.72 +5
      Modded/Hacked App: 일곱 개의 대죄: GRAND CROSS By Netmarble Corporation
      Bundle ID: com.netmarble.nanakr
      iTunes Store Link: https://apps.apple.com/kr/app/%EC%9D%BC%EA%B3%B1-%EA%B0%9C%EC%9D%98-%EB%8C%80%EC%A3%84-grand-cross/id1449552940?uo=4


      Hack Features:
      - God Mode
      - One Hit Kill
      - Multiply Attack
      - Multiply Defense
      - Make Enemies God Mode for some quests


      iOS Hack Download Link: https://iosgods.com/topic/154899-seven-deadly-sins-kr-%EC%9D%BC%EA%B3%B1-%EA%B0%9C%EC%9D%98-%EB%8C%80%EC%A3%84-grand-cross-cheats-v750-5/
        • Like
      • 177 replies
    • Zooba: Zoo Battle Royale Game v5.19.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/
        • Haha
      • 1,301 replies
    • The Seven Deadly Sins Cheats v2.81.0 +5
      Modded/Hacked App: The Seven Deadly Sins by Netmarble Corporation
      Bundle ID: com.netmarble.nanagb
      iTunes Store Link: https://apps.apple.com/us/app/the-seven-deadly-sins/id1475440231?uo=4&at=1010lce4


      Hack Features:
      - God Mode
      - OHK
      - Infinite MP


      iOS Hack Download Link: https://iosgods.com/topic/131686-arm64-the-seven-deadly-sins-cheats-v117-3/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Like
      • 2,051 replies
    • Zombastic: Time to Survive v1.12.4 [ +1+++ Jailed ] Currency Max
      Modded/Hacked App: Zombastic: Time to Survive By Playmotional Limited
      Bundle ID: com.playmotional.survival
      iTunes Store Link: https://apps.apple.com/us/app/zombastic-time-to-survive/id6475173073?uo=4


      Hack Features:
      - Currency & Resources Unlimited [ Disable When Playing ] 





      Jailbreak required hack(s): https://iosgods.com/forum/5-game-cheats-hack-requests/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 53 replies
    • Zombastic: Time to Survive v1.12.4 [ +1+++ Cheats ] Currency Max
      Modded/Hacked App: Zombastic: Time to Survive By Playmotional Limited
      Bundle ID: com.playmotional.survival
      iTunes Store Link: https://apps.apple.com/us/app/zombastic-time-to-survive/id6475173073?uo=4


      Hack Features:
      - Currency & Resources Unlimited [ Disable When Playing ] 





      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 50 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