AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: MemHack (https://forums.alliedmods.net/showthread.php?t=23152)

Blackhawk 02-10-2006 17:12

Thanks, Thanks, Thanks,Thanks, Thanks, Thanks,Thanks, Thanks, Thanks,....... ^^

Twilight Suzuka 02-10-2006 19:52

1 Attachment(s)
Tell me if this one fixes the problem:

Blackhawk 02-10-2006 20:11

Jepp, works correctly. :D

Where was it? Where did you found my cute little bug?

Twilight Suzuka 02-10-2006 22:03

I messed up the writing protocals. My bad ^^

So, wanna make me an example plugin? ^^

Obbin 02-11-2006 08:58

Yay, example plugin!
Now i can use this to mess width startmoney and bombtimer instead of cshack :twisted:

Blackhawk 02-11-2006 18:19

If I'll do an example plugin,it won't be for CS - im a Natural Selection Server admin only ^^

Twilight, another question: Do i need to mess around with the Base Adresses? Or is MEm_DLLBASE the only thing i need to define?

2nd, how is memhack_get_base used?
4rd How memhack_get_realaddr?

And thank you again for your continued support!

Twilight Suzuka 02-11-2006 19:09

MemHack was not originally written to be an AMXx module. It was repurposed for AMXx use.

As such, there are some features you will almost never find a use for.

MEM_DLLBASE allows mod .dll hacking.
MEM_ENGBASE allows HL1 engine hacking.
MEM_NULLBASE allows for total memory hacking.

These two natives are only useful for total memory hacking:
Code:

native memhack_get_base(func_addr,&success);
native memhack_get_realaddr(address,baseaddress,memtype = MEMTYPE_DATA);

memhack_get_base will return the base pointer (the starting address) of a program, based on an address that belongs to that program.

In order to hack the memory of a program, you need its base address. Then you can hack offsets of the base address. This native lets you do that.

memhack_get_realaddr isn't useful at all really; all it does is return the current full address of the memory at this offset. When hacking programs, we use offsets from base; this will return the actual address, instead of the partial offset we give it.

The only true use of this native is that we can get the actual address of the base. The real address of an offset - the offset = the address of the base address.

Using these natives, one could concievably hack any programs in the memory, or even create ones own program, or inject one program into another.

However, no one will ever use these natives, or have a need to, besides debugging ^^

Blackhawk 02-11-2006 23:29

Then we have maybe anoter bug in this module.....

Ok, i'll show what i think:

The Editor shows the base of the MOD dll running at Hex 01050000
The pointer to the value in question is now at Hex 0127B4E8 +134
So the offset should be Hex(127B4E8 +134 -01050000), giving Hex 22B4E8 or decimal 2274844.

Now it apears the the code below actually works, and the code that should work crashes the server.
Code:
new Pointer = memhack_get_pointer(19379432,MEM_DLLBASE,MEMTYPE_DATA)     new Target  = Pointer + 308     server_print("Memhack get float: %.2f",memhack_get_float(Target,MEM_DLLBASE,MEMTYPE_DATA))

On the other hand, this returns 0:

Code:
    server_print("Memory offset: %d",memhack_get_base(19379432))
Where it should return the base of code. But i am very sure it shouldn't be 0.

So it looks like MEM_DLLBASE, MEM_CODEBASE etc are not accounted correctly, because in this line
Code:
new Pointer = memhack_get_pointer(19379432,MEM_DLLBASE,MEMTYPE_DATA)
MEM_DLLBASE is changeable with MEM_ENGBASE without an effect, meaning the base is always returned as 0.......

I hope you get my point.

Twilight Suzuka 02-12-2006 01:32

In order for getbase to work, you need the pointer of a valid function. I don't think you have the pointer of a valid function. ^^

ENG was also added as an afterthought, and never tested extensively, though it did return a different full address, so I assumed it worked.

In addition, all calculations should be done in hex, for standardization.

Blackhawk 02-12-2006 08:42

19379432 is 127B4E8 and that is correct, whatsoever when the dllbase is 01050000, this code example shouldn't work if MEM_DLLBASE would be valid.
127B4E8 is the exact adress WITH DLLBASE.

If i understand it right,
Code:
new Pointer = memhack_get_pointer(19379432,MEM_DLLBASE,MEMTYPE_DATA)
would calculate as follows: Add the offset Parameter 1 to the base address of MEM_DLLBASE and get the pointer adress back. As this sample above already is Base + offset, if MEM_DLLBASE is something other than 0 (as base address), i would never get an correct pointer back.....

But this sample works! :shock:


All times are GMT -4. The time now is 13:15.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.