Jump to content

11 posts in this topic

Recommended Posts

Updated (edited)

Hello, in this tutorial I will show one of the ways to hook a function. I will be hooking a function from a Unity game.

First you need to find the address at which the beginning of the function is located in real time, this is difficult due to ASLR (address randomization).

First, let's write a method that will return the following address:

// RVA: 0x11FE288 Offset: 0x11FE288 VA: 0x11FE288
    private void Update() { }
  (This is the address and information about the function that is in the compiled game engine)

uint64_t getExecAddr(uint64_t addr, int index)
{
    const struct mach_header* header = _dyld_get_image_header(index);
    if (header == NULL){return 0;}

    uint64_t libLoadAddr = (uint64_t)header;
    uint64_t exec_addr = libLoadAddr + addr;

    return exec_addr;
}

In this example, we are making a method that returns a number of type uint64_t and takes two parameters: the address of the function (for example, the one I gave above) and the library index.

Using the _dyld_get_image_header() method, we get the address from which the library was loaded by its index.

 

How to find the library index? This can be done in two ways: Using the LLDB debugger (image list command) or using another method that we will now write (this method is better than the first one)

uint64_t getLibIndex(const char* que_image)
{
	int i = 0;
	int image_count = _dyld_image_count();

	for(; i < image_count; i++)
	{
		const char* req_image = _dyld_get_image_name(i);

		if(req_image && strcmp(req_image, que_image) == 0)
			{return i;}
	}
	return -1;
}

This method takes a path parameter to the library, we use the _dyld_image_count() method to find out how many libraries are loaded into the game process, then using a loop we compare our path to the library with others, and if the paths match, we return the index.

Okay, there's not much left. Now let's create a pointer to the old function and create a replacement function that will be called instead of the original one:

void (*old_Update)(void *self);

void Update(void *self)
{
 	// "your code here"
  
	old_Update(self);
}

Now let's just make a hook according to a template that can be easily found on the Internet:

%ctor 
{		
	MSHookFunction( (void *)address_to_your_func_with_aslr, (void *)Update, (void **)&old_Update);	
}	

To make it clearer, I will show the full code of my hook:

#include <unistd.h>
#include <dispatch/dispatch.h>
#include <mach-o/dyld.h>
#include <substrate.h>
#include <string.h>

uint64_t getExecAddr(uint64_t addr, int index)
{
    const struct mach_header* header = _dyld_get_image_header(index);
    if (header == NULL){return 0;}

    uint64_t libLoadAddr = (uint64_t)header;
    uint64_t exec_addr = libLoadAddr + addr;

    return exec_addr;
}


uint64_t getLibIndex(const char* que_image)
{
	int i = 0;
	int image_count = _dyld_image_count();

	for(; i < image_count; i++)
	{
		const char* req_image = _dyld_get_image_name(i);

		if(req_image && strcmp(req_image, que_image) == 0)
			{return i;}
	}
	return -1;
}


void (*old_Update)(void *self);

void Update(void *self)
{
	sleep(5);
	old_Update(self);
}


%ctor 
{	
	dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

		sleep(150);

		int index = getLibIndex("/private/var/containers/Bundle/Application/BAE27894-6809-4743-AFFA-C1F6B93195CB/hidenseek.app/Frameworks/UnityFramework.framework/UnityFramework");
		
		uint64_t address = getExecAddr(0x11fe288, index);

		MSHookFunction( (void *)address, (void *)Update, (void **)&old_Update);

	});	

}	

 

This is my test version of the hook, it works great. (dispatch_async I used to wait until all libraries are loaded) In my example, the hook changes the behavior of the program so that when Update() is called, the game slows down for 5 seconds, this is only a beta version and you can add other logic there :)

If you liked the tutorial, please rate it. I will try to answer questions :)

 

 

Updated by nngot44
  • Like 4
  • Thanks 1
  • Informative 1
Posted

Very good tutorial for beginner, easy to read and detailed

Thank you for posting

Posted
3 hours ago, nngot44 said:
/private/var/containers/Bundle/Application/BAE27894-6809-4743-AFFA-C1F6B93195CB/

Have to be careful here if you plan on releasing this tweak. :) This location is dynamic and changes per device & iOS version.

  • Informative 1
Posted

Really nice. Have you try this on Dopamine jailbreak? I got some issue while hooking on Dopamine.

 

Posted
1 minute ago, 34306 said:

Really nice. Have you try this on Dopamine jailbreak? I got some issue while hooking on Dopamine.

 

What kind of issues? I've seen similar reports after converting rootful to rootless with iGameGod.

Posted
Just now, Rook said:

What kind of issues? I've seen similar reports after converting rootful to rootless with iGameGod.

I have no idea, maybe it's Dopamine issue. Opa said on 1.1 he fixed PPLRW but when i tried to hooking (Unity game). It still crash. I have no idea what's going on..
xVY8cNF.jpg

Posted
Just now, 34306 said:

I have no idea, maybe it's Dopamine issue. Opa said on 1.1 he fixed PPLRW but when i tried to hooking (Unity game). It still crash. I have no idea what's going on..
xVY8cNF.jpg

Shouldn't this be an ElleKit related issue rather than Dopamine?

I tried hooks on palera1n rootless and they seem to work fine.

Posted
Just now, Rook said:

Shouldn't this be an ElleKit related issue rather than Dopamine?

I tried hooks on palera1n rootless and they seem to work fine.

Let me update Ellekit. They already have Substitute, Substrate, Libhooker. And Ellekit such a weird thing...

Report back to you later!

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

    • Miner Fighters ! v2.5.7 [ +12 Jailed ] Currency Max
      Modded/Hacked App: Miner Fighters ! By UNICO STUDIO LLC
      Bundle ID: com.unicostudio.minerfighters
      App Store Link: https://apps.apple.com/us/app/miner-fighters/id6752961543?uo=4

      🤩 Hack Features

      - Auto ADS OFF
      - Unlimited Red Gems
      - Unlimited Green Gems
      - Hero Cost Up / Earn Green Gems
      - Gold / No Need IN Battle For Trop
      - Trop Unlocked / IN Battle Only 
      - Trower HP
      - HP
      - ATK
      - DEF
      - Luck
      - Miner Gold
        • Like
      • 4 replies
    • Miner Fighters ! v2.5.7 [ +12 Cheats ] Currency Max
      Modded/Hacked App: Miner Fighters ! By UNICO STUDIO LLC
      Bundle ID: com.unicostudio.minerfighters
      App Store Link: https://apps.apple.com/us/app/miner-fighters/id6752961543?uo=4

      🤩 Hack Features

      - Auto ADS OFF
      - Unlimited Red Gems
      - Unlimited Green Gems
      - Hero Cost Up / Earn Green Gems
      - Gold / No Need IN Battle For Trop
      - Trop Unlocked / IN Battle Only 
      - Trower HP
      - HP
      - ATK
      - DEF
      - Luck
      - Miner Gold
        • Like
      • 3 replies
    • Land Builder v1.27.4 [ +3 Cheats ] Currency Max
      Modded/Hacked App: Land Builder By SayGames LTD
      Bundle ID: com.game.perfectlands
      App Store Link: https://apps.apple.com/us/app/land-builder/id6443774303?uo=4 

      🤩 Hack Features

      - Gems
      - Gold
      - Skip
        • Like
      • 4 replies
    • Land Builder v1.27.4  [ +3 Jailed ] Currency Max
      Modded/Hacked App: Land Builder By SayGames LTD
      Bundle ID: com.game.perfectlands
      App Store Link: https://apps.apple.com/us/app/land-builder/id6443774303?uo=4
       

      🤩 Hack Features

      - Gems
      - Gold
      - Skip
        • Like
      • 10 replies
    • Fairy vs Devil v1.0.2 [ +2 Cheats ] Currency Max
      Modded/Hacked App: Fairy vs Devil By NADDIC GAMES Co Ltd.
      Bundle ID: com.maf.FairyGuardians
      App Store Link: https://apps.apple.com/us/app/fairy-vs-devil/id6753863880?uo=4

      🤩 Hack Features

      - Unlimited Currency / Before The Battle OFF
      - Unlimited Resources / Before The Battle OFF
        • Agree
        • Like
      • 2 replies
    • Fairy vs Devil v1.0.2 [ +2 Jailed ] Currency Max
      Modded/Hacked App: Fairy vs Devil By NADDIC GAMES Co Ltd.
      Bundle ID: com.maf.FairyGuardians
      App Store Link: https://apps.apple.com/us/app/fairy-vs-devil/id6753863880?uo=4

      🤩 Hack Features

      - Unlimited Currency / Before The Battle OFF
      - Unlimited Resources / Before The Battle OFF
        • Like
      • 1 reply
    • Cat Crunch - Match 3 Games v2.61 [ +3 Cheats ] Currency Max
      Modded/Hacked App: Cat Crunch - Match 3 Games By Y factory
      Bundle ID: com.yfactorysoft.CatCrunch
      App Store Link: https://apps.apple.com/us/app/cat-crunch-match-3-games/id6471232053?uo=4

      🤩 Hack Features

      - Unlimited Coins
      - Unlimited Stars
      - Unlimited Booster.
        • Like
      • 4 replies
    • Cat Crunch - Match 3 Games v2.61 [ +3 Jailed ] Currency Max
      Modded/Hacked App: Cat Crunch - Match 3 Games By Y factory
      Bundle ID: com.yfactorysoft.CatCrunch
      App Store Link: https://apps.apple.com/us/app/cat-crunch-match-3-games/id6471232053?uo=4

      🤩 Hack Features

      - Unlimited Coins
      - Unlimited Stars
      - Unlimited Booster
        • Like
      • 1 reply
    • Postknight 2 +4 Jailed Cheats
      Modded/Hacked App: Postknight 2 By Kurechii Sdn Bhd
      Bundle ID: com.kurechii.postknight2
      iTunes Store Link: https://apps.apple.com/us/app/postknight-2/id1497250814?uo=4


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


      Hack Features:
      - Damage Multiplier
      - Never Die
      - Debug Menu → Settings > Click Privacy Policy [ Not All Options Work ]
      - Game Speed Multiplier


      Jailbreak required hack(s): 


      iOS Hack Download Link:

      Hidden Content
      React or reply to this topic to see the <a href='https://iosgods.com/topic/3762-info-how-to-unlockview-the-hidden-content-on-iosgods/?do=findComment&comment=78119'>hidden content & download link</a>.








      PC Installation Instructions:
      STEP 1: If necessary, uninstall the app if you have it installed on your iDevice. Some hacked IPAs will install as a duplicate app. Make sure to back it up so you don't lose your progress.
      STEP 2: Download the pre-hacked .IPA file from the link above to your computer. To download from the iOSGods App, see this tutorial topic.
      STEP 3: Download Sideloadly and install it on your PC.
      STEP 4: Open/Run Sideloadly on your computer, connect your iOS Device, and wait until your device name shows up.
      STEP 5: Once your iDevice appears, drag the modded .IPA file you downloaded and drop it inside the Sideloadly application.
      STEP 6: You will now have to enter your iTunes/Apple ID email login & then your password. Go ahead and enter the required information.
      STEP 7: Wait for Sideloadly to finish sideloading/installing the hacked IPA.
      STEP 8: Once the installation is complete and you see the app on your Home Screen, you will need to go to Settings -> General -> Profiles/VPN & Device Management. Once there, tap on the email you entered from step 6, and then tap on 'Trust [email protected]'.
      STEP 9: Now go to your Home Screen and open the newly installed app and everything should work fine. You may need to follow further per app instructions inside the hack's popup in-game.

      NOTE: For free Apple Developer accounts, you will need to repeat this process every 7 days. Using a disposable Apple ID for this process is suggested but not required. Jailbroken iDevices can also use Sideloadly to install the IPA with AppSync. Filza & IPA Installer (or alternatives) from Cydia also work. If you have any questions or problems, read our Sideloadly FAQ section of the topic and if you don't find a solution, post your issue down below and we'll do our best to help! If the hack does work for you, post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - Zahir


      Cheat Video/Screenshots:

      N/A
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 133 replies
    • Darkest Hero! v0.0.86 [ +4 Cheats ] Currency Max
      Modded/Hacked App: Darkest Hero! By MINIDRAGON LTD
      Bundle ID: com.minidragon.randomdungeon
      App Store Link: https://apps.apple.com/us/app/darkest-hero/id6746927122?uo=4

      🤩 Hack Features

      - Unlimited Gems / Earn
      - Unlimited Red Crystal / Earn
      - Unlimited Gold / Earn
      - Unlimited Keys / Earn
        • Informative
        • Haha
        • Thanks
        • Winner
        • Like
      • 17 replies
    • Darkest Hero! v0.0.86 [ +4 Jailed ] Currency Max
      Modded/Hacked App: Darkest Hero! By MINIDRAGON LTD
      Bundle ID: com.minidragon.randomdungeon
      App Store Link: https://apps.apple.com/us/app/darkest-hero/id6746927122?uo=4

      🤩 Hack Features

      - Unlimited Gems / Earn
      - Unlimited Red Crystal / Earn
      - Unlimited Gold / Earn
      - Unlimited Keys / Earn
        • Informative
        • Winner
        • Like
      • 13 replies
    • SLIME - ISEKAI Memories v3.0.35 +5 Jailed Cheats
      Modded/Hacked App: SLIME - ISEKAI Memories By BANDAI NAMCO Entertainment Inc.
      Bundle ID: jp.co.bandainamcoent.BNEI0402
      iTunes Store Link: https://apps.apple.com/us/app/slime-isekai-memories/id1577316192?uo=4


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


      Hack Features:
      - Damage Multiplier
      - Defense Multiplier
      - Always Our Turn
      - Instant Win
      - Unlimited Skills


      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/


      iOS Hack Download Link:

      Hidden Content

      Download via the iOSGods App








      PC Installation Instructions:
      STEP 1: If necessary, uninstall the app if you have it installed on your iDevice. Some hacked IPAs will install as a duplicate app. Make sure to back it up so you don't lose your progress.
      STEP 2: Download the pre-hacked .IPA file from the link above to your computer. To download from the iOSGods App, see this tutorial topic.
      STEP 3: Download Sideloadly and install it on your PC.
      STEP 4: Open/Run Sideloadly on your computer, connect your iOS Device, and wait until your device name shows up.
      STEP 5: Once your iDevice appears, drag the modded .IPA file you downloaded and drop it inside the Sideloadly application.
      STEP 6: You will now have to enter your iTunes/Apple ID email login & then your password. Go ahead and enter the required information.
      STEP 7: Wait for Sideloadly to finish sideloading/installing the hacked IPA.
      STEP 8: Once the installation is complete and you see the app on your Home Screen, you will need to go to Settings -> General -> Profiles/VPN & Device Management. Once there, tap on the email you entered from step 6, and then tap on 'Trust [email protected]'.
      STEP 9: Now go to your Home Screen and open the newly installed app and everything should work fine. You may need to follow further per app instructions inside the hack's popup in-game.

      NOTE: For free Apple Developer accounts, you will need to repeat this process every 7 days. Using a disposable Apple ID for this process is suggested but not required. Jailbroken iDevices can also use Sideloadly to install the IPA with AppSync. Filza & IPA Installer (or alternatives) from Cydia also work. If you have any questions or problems, read our Sideloadly FAQ section of the topic and if you don't find a solution, post your issue down below and we'll do our best to help! If the hack does work for you, post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - Zahir


      Cheat Video/Screenshots:

      N/A
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 392 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