Page 1 of 1

Aobscan and writeBytes

Posted: Sat Aug 03, 2019 3:44 am
by Reclaimer Shawn
So, I wanted to create a script that writes to addresses near an AOBScan signature. Here's my AOBScan Code:

Code: Select all

[ENABLE]
aobscan(EnemyData, 80 00 03 40 00 00 00 01 80 4A BD DC 80 83 36 08 80 4A 86 98 00 00 00 01 80 4A BD DC 80 83 36 18 80 00 C6 28 00 00 00 00 00 00 00 02 80 83 36 38 80 1F C5 4C 00 00 00 00 00 00 00 00 00 00 00 00 80 4A 86 CC)
label(_EnemyData)
registersymbol(_EnemyData)

EnemyData:
_EnemyData:

[DISABLE]
unregistersymbol(_EnemyData)
Let's say I want to write the address that is 0x6C bytes away from this signature. How would I go about doing that? I tried through all of these ways, but they don't work for me:

Code: Select all

writeBytes(_EnemyData+6C,01,01)
writeBytes("_EnemyData+6C",01,01)
writeBytes(EnemyData+6C,01,01)
writeBytes("EnemyData+6C",01,01)
The EnemyData address would need to be stored as a global variable, as this will be subsequently accessed by several different functions.

Re: Aobscan and writeBytes

Posted: Tue Aug 06, 2019 9:50 am
by MartaLabieniec
Your AOB signature is: EnemyData.

So if you want to write the address that is 0x6C bytes away from signature, just write like this:

EnemyData+6C:

And that is all!

Re: Aobscan and writeBytes

Posted: Tue Aug 06, 2019 9:51 am
by MartaLabieniec
And to write bytes in this address, just write like this:

EnemyData+6C:
db 01 01 01

01 01 01 - are an example of bytes.

Re: Aobscan and writeBytes

Posted: Wed Aug 07, 2019 10:06 am
by SunBeam
writeBytes is Lua syntax :) So:

Code: Select all

[ENABLE]
aobscan(EnemyData, 80 00 03 40 00 00 00 01 80 4A BD DC 80 83 36 08 80 4A 86 98 00 00 00 01 80 4A BD DC 80 83 36 18 80 00 C6 28 00 00 00 00 00 00 00 02 80 83 36 38 80 1F C5 4C 00 00 00 00 00 00 00 00 00 00 00 00 80 4A 86 CC)
label(_EnemyData)
registersymbol(_EnemyData)

EnemyData:
_EnemyData:

[DISABLE]
unregistersymbol(_EnemyData)
The above will do the ASM part. I recommend using "aobscanmodule" if you know the AOB is inside a certain game module. Else, if this is what I believe an Unity game (correct?), you can use aobscan. Just note that some of the code may be available only after being JIT-ed.

Now for Lua:

Code: Select all

local t = getAddress( "symbol" ) -- you need first to get the address
writeBytes( t + 0x6C, 1, 1 )
-- or directly
writeBytes( getAddress( "_EnemyData" ) + 0x6C, 1, 1 )
If you wanna do this in ASM, then use what Marta said: _EnemyData+6C: db 01 01.

Cheers,
Sun