Solved Hooking functions .so

Status
Not open for further replies.

SecretMyAss

Platinian
Original poster
Skilled
Jul 16, 2018
17
55
13
23
Netherlands
Oi,

Do any one you have a working code for hooking functions?
I tried to get Substrate working, but got errors which I wasn't able to fix.

I need to hook functions in order to unlink the features, but can't seem to find any working template for it...

Any help?
 

AndnixSH

PMT Elite Modder
Staff member
Modding-Team
Jun 27, 2017
4,684
297,060
1,213
Modding World
I fixed some part of jbro project. You can get my forked project here
AndnixSH/Unity-Substrate-Hook-Android

Compile it with NDK 16b using CMD

Code:
(path to NDK)\ndk-build NDK_PROJECT_PATH=(path to project) NDK_APPLICATION_MK=(path to project\jni\Application.mk)
Code:
E:\android-ndk-r16b\ndk-build NDK_PROJECT_PATH=D:\Project\Github\Unity-Substrate-Hook-Android-master NDK_APPLICATION_MK=D:\Project\Github\Unity-Substrate-Hook-Android-master\jni\Application.mk
 
Last edited:

Del777319

Platinian
Jan 13, 2020
8
3
3
21
Moscow
I fixed some part of jbro project. You can get my forked project here
AndnixSH/Unity-Substrate-Hook-Android

Compile it with NDK 16b using CMD

Code:
(path to NDK)\ndk-build NDK_PROJECT_PATH=(path to project) NDK_APPLICATION_MK=(path to project\jni\Application.mk)
Code:
E:\android-ndk-r16b\ndk-build NDK_PROJECT_PATH=D:\Project\Github\Unity-Substrate-Hook-Android-master NDK_APPLICATION_MK=D:\Project\Github\Unity-Substrate-Hook-Android-master\jni\Application.mk
After I built my lib and pointed it to smali, when I start the game, the process immediately dies and the game crashes with an error, the application is stopped, can you help me?
 

Del777319

Platinian
Jan 13, 2020
8
3
3
21
Moscow
AndnixSH
NullCoder

can you make a tut on hooking cause wase not fully described or at least tell me is this hook right ?
public class PlayerInfo : MonoBehaviour // TypeDefIndex: 9245

{

// Fields
private float m_Amount; // 0xA4

private float m_ReadAmount; // 0xA8

protected bool m_UpdateLevel; // 0xAC

protected int m_XpIncrement; // 0xB0

protected int m_XpIncrementCount; // 0xB4

protected float m_XpStart; // 0xB8

protected float m_XpFinal; // 0xBC

protected bool m_LevelTriggered; // 0xC0

protected int m_InfoLevel; // 0xC4

protected int m_PvPTier; // 0xC8

protected int m_TrophyIncrement; // 0xCC

protected int m_TrophyIncrementCount; // 0xD0

protected float m_TrophyStart; // 0xD4

protected float m_TrophyFinal; // 0xD8

protected float m_TrophyAmount; // 0xDC

protected float m_TrophyReadAmount; // 0xE0

protected bool m_UpdateTrophies; // 0xE4

protected Vector2 m_CurrentAnchor; // 0xE8

protected bool m_ChangedColor; // 0xF0

protected float m_TrophyTimer; // 0xF4

protected bool m_Bipped; // 0xF8

private int m_Faction; // 0xFC

private string m_PlayerID; // 0x100
// Methods

public string get_PlayerID(); // RVA: 0x86567C Offset: 0x86567C
public RectTransform GetIconExplosionTarget(); // RVA: 0x865684 Offset: 0x865684
public void ButtonOpenProfileCanvas(); // RVA: 0x865720 Offset: 0x865720
public void SetOtherPlayerInfo(string playerID, string playerName, int playerTier, int playerLevel, Faction playerFaction, string allianceName); // RVA: 0x865884 Offset: 0x865884
public void Init(bool isUserProfile, optional Func`2<ServerInterface.PlayerStatRequestResponse, bool> onRequestStats); // RVA: 0x865ACC Offset: 0x865ACC
public void SetBaseInfo(string name, string alliance, optional Nullable`1<int> xp, optional Nullable`1<int> playerTrophies); // RVA: 0x8667BC Offset: 0x8667BC
public void UpdateName(); // RVA: 0x8672FC Offset: 0x8672FC
public void UpdateInfo(); // RVA: 0x8673BC Offset: 0x8673BC
public void OnFactionChangeClicked(); // RVA: 0x867C34 Offset: 0x867C34
public void ButtonChangeFaction(); // RVA: 0x867DD4 Offset: 0x867DD4
private void CheckFactionBadge(); // RVA: 0x866370 Offset: 0x866370
public void ButtonNameChange(); // RVA: 0x868264 Offset: 0x868264
public void ClickTier(RectTransform trans); // RVA: 0x8683C8 Offset: 0x8683C8
public void StartXPAnim(int incrementCount); // RVA: 0x868814 Offset: 0x868814
public void AnimateXP(); // RVA: 0x868A6C Offset: 0x868A6C
public void StartTrophyAnim(int incrementCount); // RVA: 0x868DAC Offset: 0x868DAC
public void AnimateTrophies(); // RVA: 0x868F38 Offset: 0x868F38
private void InitStats(Func`2<ServerInterface.PlayerStatRequestResponse, bool> onRequestStats); // RVA: 0x8660D8 Offset: 0x8660D8
public void AddUserStat(PlayerStat.PlayerStats stat, int value); // RVA: 0x8690C0 Offset: 0x8690C0
public void InitUnits(string[] cardIDs); // RVA: 0x8695B0 Offset: 0x8695B0
public void OnClose(); // RVA: 0x86A4E8 Offset: 0x86A4E8
public void CheckLevel(); // RVA: 0x866D20 Offset: 0x866D20
public void CreateStatObject(PlayerStat.PlayerStats stat, string statVal, int statIndex); // RVA: 0x8692B0 Offset: 0x8692B0
public void .ctor(); // RVA: 0x86A7FC Offset: 0x86A7FC
=======================my hook =======================
void(*PlayerInfo)(void *PlayerInfo);
void_PlayerInfo(void *PlayerInfo){
if(player != NULL){
*(int *)((uint64_t)player + 0xB0) = 999;
*(float *)((uint64_t)player + 0xDC) = 100.0f;
*(float *)((uint64_t)player + 0x5C) = 0.0f;
}
PlayerInfo(PlayerInfo);
}
MSHookFunction((void*)getAbsoluteAddress("libil2cpp.so", 0x00000), (void*)&_PlayerInfo, (void**)&PlayerInfo);
 
  • Like
Reactions: dominca

DaRealPanDa

Co-Administrator
Staff member
Supporting-Team
Global Moderator
Social Media
Mar 12, 2018
6,665
15,471
2,120
27
Skyrim
If you are testing on Android 10, make sure libs are in arm64.
Your Android Version has nothing to do with that.
The libs are based on your CPU Arch. ARM Chips, x86 chips etc
When you have a android 10 device, which doesn't support arm64, then you will be fucked lol
the only arch which works on every device including emulators is armv7.
 
Status
Not open for further replies.