Jump to content

How to call the function? (iOS jailbreak)


Go to solution Solved by Saitama,

10 posts in this topic

Recommended Posts

Posted

Hi I'm trying to call a function in the game Hide N Seek : Mini Games.

Here is my code, (I just need to call any function):

function dump:

//RVA: 0x11FE288 Offset: 0x11FE288 VA: 0x11FE288
   private void Update() { }


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

uintptr_t getExecAddr(uintptr_t addr)
{
 const struct mach_header* header = _dyld_get_image_header(341); // this is the library index, it's so big because I'm              using a debugger so far.
 if (header == NULL){return 0;}

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

 return exec_addr;
}

void (*Update)();

%ctor { 

 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

  sleep(15); // wait for all libraries to load

  Update = (void(*)())getExecAddr(0x11FE288);

  Update();

 });
 
}

The game crashes when the moment comes to call the function. What am I doing wrong? :(

Posted

Keep It Simple - using this one


u dont need header index etc
u need library name
 

[menu setFrameworkName:"UnityFramework"];


next is

void (*Update)(void *inst) = (void(*)(void *))getRealOffset(0x11FE288);

and call of this is

Update(inst);


Why inst?
Because its not static function - and this function is called from some class
*inst is a class that has this function and the first arg is for call

  • Informative 1
Posted

Thanks for the answer! but i did not understand where to call the function, if this is done in the same place where the pointer is declared, the compiler will gile the error "use of undeclared identifier 'inst'' for Update(inst);

Posted
20 hours ago, nngot44 said:

Thanks for the answer! but i did not understand where to call the function, if this is done in the same place where the pointer is declared, the compiler will gile the error "use of undeclared identifier 'inst'' for Update(inst);

because u dont declare this variable and dont get the pointer of object created by this class

also dont know why u need to call exact this function 
in Unity games this function basically called automatically each frame (if the class inherits MonoBehaviour class)
 

  • Solution
Posted (edited)

the main logic is
var someClass = new SomeClass(); //or other c# initialisation 
someClass.SomeMethod();

SomeMethod() cant be called from no where

Example #1

public class SomeClass : MonoBehaviour 
{
	// Fields
	...

	// Properties
	...

	// Methods
	...
	// RVA: 0x100400 Offset: 0x100400 VA: 0x100400
	public static SomeClass get_Instance() { }

	// RVA: 0x100500 Offset: 0x100500 VA: 0x100500
	public void SomeMethod() // address 0x100500

	// RVA: 0x100600 Offset: 0x100600 VA: 0x100600
	public static void SomeStaticMethod() // address 0x100600
	...
}

 

void* (*SomeClass$$get_Instance)() = (void(*)())getRealOffset(0x100400);
void (*SomeClass$$SomeMethod)(void *SomeClass) = (void(*)(void *))getRealOffset(0x100500);

void* SomeClassInstance = SomeClass$$get_Instance();
SomeClass$$SomeMethod(SomeClassInstance);

 

void (*SomeClass$$SomeStaticMethod)() = (void(*)())getRealOffset(0x100600);

SomeClass$$SomeStaticMethod();

Example #2

public class SomeOtherClass : MonoBehaviour 
{
	// Fields
	...

	// Properties
	...

	// Methods
	...
	// RVA: 0x100300 Offset: 0x100300 VA: 0x100300
	public void InitWithSomeClass(SomeClass someClassInstance) { }
	...
}

 

void* SomeClassInstance = NULL;
void (*SomeOtherClass$$InitWithSomeClass_original)(void *SomeOtherClassInstance, void* someClassInstance);
void _SomeOtherClass$$InitWithSomeClass_hook(void *SomeOtherClassInstance, void* someClassInstance) 
{
	SomeClassInstance = someClassInstance;
	SomeOtherClass$$InitWithSomeClass_original(SomeOtherClassInstance, someClassInstance);
}

HOOK(0x100300, _SomeOtherClass$$InitWithSomeClass_hook, SomeOtherClass$$InitWithSomeClass_original);

 

Updated by Saitama
  • Winner 1
Posted (edited)

Example #3

public class SomeThirdClass : MonoBehaviour 
{
	// Fields
	...
	public SomeClass SomeClassField // 0x100
	...

	// Properties
	...

	// Methods
	...
	// RVA: 0x100200 Offset: 0x100200 VA: 0x100200
	public void Update() { }
	...
}

 

void* SomeClassInstance = NULL;
void (*SomeThirdClass$$Update_original)(void *SomeThirdClassInstance);
void _SomeThirdClass$$Update_hook(void *SomeThirdClassInstance) 
{
	void* someClassInstance = *(void **)((uint64_t)SomeThirdClassInstance + 0x100);
	if(someClassInstance != NULL)
    {
		SomeClassInstance = someClassInstance;
    }
	SomeThirdClass$$Update_hook(SomeThirdClassInstance);
}

HOOK(0x100200, _SomeThirdClass$$Update_hook, SomeThirdClass$$Update_original);

 

 

Updated by Saitama
  • Winner 1
Posted

Thanks for these examples, I'm new and still learning how to make dylib libraries for games. I tried to call the Update function because I thought it would be the easiest to call :)

Posted (edited)

I used your advice and wrote this code (i hope my method returns the correct address) :

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

uintptr_t getExecAddr(uintptr_t addr)
{
    const struct mach_header* header = _dyld_get_image_header(341);
    if (header == NULL){return 0;}

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

    return exec_addr;
}

%ctor 
{

	dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

		sleep(150);

		void* (*VELights$$get_Instance)() = (void* (*)())getExecAddr(0x12FD104);
		void (*VELights$$ResetMainSunLightAngle)(void *VELights) = (void(*)(void *))getExecAddr(0x12FD4B8);

		void* VELightsInstance = VELights$$get_Instance();
		VELights$$ResetMainSunLightAngle(VELightsInstance);
		
	});	

}	

 

In the debugger, I always get rather strange errors, for example, from the libobjc.A.dylib'objc_retain library. 

I thought it would be easier for me if it was possible to disable ASLR for this game. Is it possible to do this on iOS 13?

 

Updated by nngot44
Posted

basically start from doing some easier things
for example change values from 
public int get_someGold();
and setter
public void set_someGold(int goldVal);

its will be easier to understand that call some function

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

    • Spin Squad! v1.6.2 [ +2 Cheats ] Battle Coins
      Modded/Hacked App: Lucky Offense By Crater Co., Ltd.
      Bundle ID: com.percent.ios.luckyrolling
      iTunes Store Link: https://apps.apple.com/us/app/lucky-offense/id6511224968?uo=4


      🤩 Hack Features

      - Battle Coins
      - ATK
      - ATK Range
      - ATK Speed

      ATK Linked Enemy
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 89 replies
    • Idle Monkey Bagpack War v1.0.9 [ +3 Jailed ] Battle Coin
      Modded/Hacked App: Idle Monkey: Bagpack War By 永进 何
      Bundle ID: com.letui.backpack.ios
      iTunes Store Link: https://apps.apple.com/us/app/idle-monkey-bagpack-war/id6670150325?uo=4


      🤩 Hack Features

      - ADS
      - Battle Coins
      - HP
        • Like
      • 8 replies
    • Galaxy Pirates - space attack v1.1.1 [ +14 Jailed ] Currency Max
      Modded/Hacked App: Galaxy Pirates - space attack By 军 黄
      Bundle ID: com.allenjoy.galaxypirates
      iTunes Store Link: https://apps.apple.com/us/app/galaxy-pirates-space-attack/id6475720088?uo=4

        

      🤩 Hack Features

      - Gems

      - Coins

      - Energy

      - Mission Rewards

      - Ship Upgrade Cost 0

      - Ship Unlock Cost 0

      - Magnet Range

      - Bullet Max 30

      - Bullet Speed

      - HP [ Linked With Card Just Unlock ]

      - DMG [ Linked With Card Just Unlock ]

      - Coins Bonus [ Linked With Card Just Unlock ]

      - Lucky [ Linked With Card Just Unlock ]

      - Super Time [ Linked With Card Just Unlock ]
        • Like
      • 9 replies
    • Galaxy Pirates - space attack v1.1.1 [ +14 Cheats ] Currency Max
      Modded/Hacked App: Galaxy Pirates - space attack By 军 黄
      Bundle ID: com.allenjoy.galaxypirates
      iTunes Store Link: https://apps.apple.com/us/app/galaxy-pirates-space-attack/id6475720088?uo=4
       

      🤩 Hack Features

      - Gems

      - Coins

      - Energy

      - Mission Rewards

      - Ship Upgrade Cost 0

      - Ship Unlock Cost 0

      - Magnet Range

      - Bullet Max 30

      - Bullet Speed

      - HP [ Linked With Card Just Unlock ]

      - DMG [ Linked With Card Just Unlock ]

      - Coins Bonus [ Linked With Card Just Unlock ]

      - Lucky [ Linked With Card Just Unlock ]

      - Super Time [ Linked With Card Just Unlock ]
        • Winner
        • Like
      • 5 replies
    • Magic Brick Wars v1.4.2 [ +4 Cheats ] Always Win
      Modded/Hacked App: Magic Brick Wars By Halfbrick
      Bundle ID: com.halfbrick.brickwars
      iTunes Store Link: https://apps.apple.com/us/app/magic-brick-wars/id1330800318?uo=4


      🤩 Hack Features

      - Mana Cost 0
      - Units [ Deploy Unlimited ]
      - Enemy No Units
      - Enemy No Blocks
        • Agree
        • Winner
      • 11 replies
    • Magic Brick Wars v1.4.2 [ +4 Jailed ] Always Win
      Modded/Hacked App: Magic Brick Wars By Halfbrick
      Bundle ID: com.halfbrick.brickwars
      iTunes Store Link: https://apps.apple.com/us/app/magic-brick-wars/id1330800318?uo=4


      🤩 Hack Features

      - Mana Cost 0
      - Units [ Deploy Unlimited ]
      - Enemy No Units
      - Enemy No Blocks
        • Like
      • 10 replies
    • Idle Monkey Bagpack War v1.0.9 [ +3 Cheats ] Battle Coin
      Modded/Hacked App: Idle Monkey: Bagpack War By 永进 何
      Bundle ID: com.letui.backpack.ios
      iTunes Store Link: https://apps.apple.com/us/app/idle-monkey-bagpack-war/id6670150325?uo=4
       

      🤩 Hack Features

      - ADS
      - Battle Coins
      - HP
        • Like
      • 3 replies
    • DESERTOPIA v4.20.5 [ +1 Cheats ] Gems Max
      Modded/Hacked App: DESERTOPIA By Gamtropy Co., Ltd.
      Bundle ID: com.gamtropy.desertopia
      iTunes Store Link: https://apps.apple.com/us/app/desertopia/id1265572046?uo=4


      🤩 Hack Features

      - Gems Max [ Earn Some ]
        • Like
      • 3 replies
    • DESERTOPIA v4.20.5 [ +1 Jailed ] Gems Max
      Modded/Hacked App: DESERTOPIA By Gamtropy Co., Ltd.
      Bundle ID: com.gamtropy.desertopia
      iTunes Store Link: https://apps.apple.com/us/app/desertopia/id1265572046?uo=4
       

      🤩 Hack Features

      - Gems Max [ Earn Some ]
        • Like
      • 1 reply
    • [ Arknights China ] 明日方舟 Cheats v2.6.21 +8
      Modded/Hacked App: 明日方舟 By Shanghai Hypergryph Network Technology Co., Ltd.
      Bundle ID: com.hypergryph.arknights
      iTunes Store Link: https://apps.apple.com/cn/app/%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F/id1454663939?uo=4


      Hack Features:
      - God Mode
      - Frozen Enemies
      - One Hit Kill
      - Instant - Win
      - No Deploy Cost
      - Multiply Damage
      - Multiply Defense
      - Multiply Character Speed


      iOS Hack Download Link: https://iosgods.com/topic/149509-arknights-china-%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F-cheats-v1560-8/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 315 replies
    • Meow Tower - Nonogram Puzzle v3.2.401 [ +4 Jailed ] Currency Max
      Modded/Hacked App: Meow Tower - Nonogram Puzzle By HyperBeard Inc.
      Bundle ID: com.grapetree.meowtower
      iTunes Store Link: https://apps.apple.com/us/app/meow-tower-nonogram-puzzle/id1579122980?uo=4
       

      🚀 Hack Features

      - ADS NO
      - Gold CANS
      - Pencil Max 
      - Hints Max 
        • Like
      • 11 replies
    • Meow Tower - Nonogram Puzzle v3.2.401 [ +4 Cheats ] Currency Max
      Modded/Hacked App: Meow Tower - Nonogram Puzzle By HyperBeard Inc.
      Bundle ID: com.grapetree.meowtower
      iTunes Store Link: https://apps.apple.com/us/app/meow-tower-nonogram-puzzle/id1579122980?uo=4


      🚀 Hack Features

      - ADS NO
      - Gold CANS
      - Pencil Max 
      - Hints Max
        • Thanks
        • Like
      • 5 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