shlifedev / among-us-memory

my among us hacking utility
196 stars 57 forks source link

How to know the structure & field type ? #54

Closed AlexisAG closed 3 years ago

AlexisAG commented 4 years ago

Hello,

In your code you've done that : var data = (T)Marshal.PtrToStructure(gcHandle.AddrOfPinnedObject(), typeof(T)); to get data from a memory adress.

T will be the structure (ex: PlayerInfo, PlayerControl ...), but how do you get theses structures ?

For example, PlayerControl have a public IntPtr FootSteps; how can I interact with this pointer & how can I get the structur assiocated with it.

I've tried this -> var targetPointer = Utils.GetMemberPointer(Instance.FootSteps, typeof(PlayerControl), "FootSteps"); Cheese.mem.WriteMemory(targetPointer.GetAddress(), "float", value.ToString("0.0")); but it doesn't work.

How can i know the type of FootSteps & how do you get all your structure ?? (PlayerInfo, PlayerControl...).

i'm a Junior Software developer (C#), so it's a bit confused to me, I use this project to study memory interaction, thanks a lot for your sources !

KMcNickel commented 3 years ago

If you look at the offset guide, it talks about Cheat Engine. going through the process, you can find the contents of the structs and the type of each field.

This is what the mono window shows for PlayerControl (obfuscated to GLHCHLEDNBA).

2020-11-07 18_10_27-Mono dissector

You can see that the FootSteps is of type UnityEngine.AudioSource and can google that to get more info on that type

AlexisAG commented 3 years ago

Yep, I've downloaded a previous version of among us (without obfuscation) to check the struct and field type. Thx for your reply I close this issue.