imjustmaxie wrote: ↑Fri Oct 06, 2023 4:20 am
SilverRabbit90 wrote: ↑Thu Oct 05, 2023 10:49 pm
In this script when I restart the game there are values in "Code" that change every time the game is restarted.
I tried removing the two lines of code, which change at every restart, but the game crashes.
jmp 2B9032EB0A7
mov rax,00007FF6D4192C64
By manually changing those two lines of code the script works perfectly (that means searching for the value all over again or using AOB scan). Is there a way to make those values change automatically? or is there a way to ignore those two lines of code without crashing the game?
Thx
The reason being it crashing because the memory location is not the same on every load.
The best possible way to solve it is to store a backup of the current AoB, use reassemble() on those two lines and restore the whole thing on disable.
Code: Select all
// readmem() : reads the memory location with exact bytes
// reassemble() : reads the memory location while adjusting the correct RIP
[ENABLE]
aobscanregion(StorageItemQuantityListA,10000000000,40000000000,48 83 EC 40 48 89 CB 48 8B 2B 48 8B B3 F0 00 00 00 8B 83 10 04 00 00 85 C0 74 1F 83 E8 01 89 83 10 04 00 00 48 B8 00 00 ?? ?? ?? 0? 00 00 8B 44 28 10 48 89 03 48 89 F0 EB 12 48 B8 ?4 ?? ?? ?? F? 7F 00 00 FF D0 85 C0 75 DA 31 C0 48 83 C4 40 5E 5D 5B C3 00 53 55 56 57 41 54 41 55 41 56 41 57 48 83 EC 68) // should be unique
//48 83 EC 40 48 89 CB 48 8B 2B 48 8B B3 F0 00 00 00 8B 83 10 04 00 00 85 C0 74 1F 83 E8 01 89 83 10 04 00 00 48 B8 00 00 89 9A 99 02 00 00 8B 44 28 10 48 89 03 48 89 F0 EB 12 48 B8 24 32 35 0B F7 7F 00 00 FF D0 85 C0 75 DA 31 C0 48 83 C4 40 5E
//48 83 EC 40 48 89 CB 48 8B 2B 48 8B B3 F0 00 00 00 8B 83 10 04 00 00 85 C0 74 1F 83 E8 01 89 83 10 04 00 00 48 B8 00 00 4B D7 C3 01 00 00 8B 44 28 10 48 89 03 48 89 F0 EB 12 48 B8 64 34 16 D4 F6 7F 00 00 FF D0 85 C0 75 DA 31 C0 48 83 C4 40 5E 5D 5B C3 00 53 55 56 57 41 54 41 55 41 56 41 57 48 83 EC 68
alloc(newmem,$1000)
label(code)
label(return)
registersymbol(StorageItemQuantityListA)
registersymbol(bkpStorageItemQuantityListA)
registersymbol(seeCurStorItQuanV1)
newmem:
push rbx
lea rbx,[rax+rbp+10]
mov [seeCurStorItQuanV1],rbx
pop rbx
code: // Indented the label because 'code' is inside 'newmem'
readmem(StorageItemQuantityListA,10)
{mov eax,[rax+rbp+10]
mov [rbx],rax
mov rax,rsi}
reassemble(StorageItemQuantityListA+A)
//jmp 2B9032EB0A7
reassemble(StorageItemQuantityListA+C)
//mov rax,00007FF6D4192C64
jmp return
align 10,CC // alignment
bkpStorageItemQuantityListA:
readmem(StorageItemQuantityListA,20)
align 10,CC // alignment
seeCurStorItQuanV1:
dq 0
StorageItemQuantityListA+2E:
jmp far newmem
nop 8
return:
[DISABLE]
StorageItemQuantityListA+2E:
readmem(bkpStorageItemQuantityListA,20)
//db 8B 44 28 10 48 89 03 48 89 F0 EB 12 48 B8
unregistersymbol(*)
dealloc(*)
I finally took a while to solve xD
I tried this method on another game (in the "code:" Change offset to each update) and works perfectly.
My try:
Code: Select all
[ENABLE]
aobscanmodule(MoneyZa,MT2.exe,0F B6 81 ?? 00 00 00 84 C0 75 0D 48 8B 81 ?? 00 00 00 39 50 ?? 0F 9D C0 C3 90 66 0F 1F 44 00 00 48 8B 81 ?? 00 00 00 8B 40 ?? C3 90 0F 1F 40 00) // should be unique
alloc(newmem,$1000,MoneyZa)
alloc(bkpMoneyZa,20)
registersymbol(MoneyZa)
registersymbol(bkpMoneyZa)
label(seeMoney)
registersymbol(seeMoney)
label(code)
label(return)
newmem:
mov [seeMoney],rax
code:
readmem(MoneyZa+27,10)
// mov eax,[rax+14]
// ret
//nop
reassemble(MoneyZa+A)
jmp return
align 10,CC // alignment
bkpMoneyZa:
readmem(MoneyZa+27,20)
align 10,CC // alignment
seeMoney:
dq 0
MoneyZa+27:
jmp newmem
return:
registersymbol(MoneyZa)
[DISABLE]
MoneyZa+27:
readmem(bkpMoneyZa,20)
//db 8B 44 28 10 48 89 03 48 89 F0 EB 12 48 B8
unregistersymbol(*)
dealloc(*)
{
// ORIGINAL CODE - INJECTION POINT: MT2.exe+33E57
MT2.exe+33E30: 0F B6 81 D0 00 00 00 - movzx eax,byte ptr [rcx+000000D0]
MT2.exe+33E37: 84 C0 - test al,al
MT2.exe+33E39: 75 0D - jne MT2.exe+33E48
MT2.exe+33E3B: 48 8B 81 E0 00 00 00 - mov rax,[rcx+000000E0]
MT2.exe+33E42: 39 50 14 - cmp [rax+14],edx
MT2.exe+33E45: 0F 9D C0 - setge al
MT2.exe+33E48: C3 - ret
MT2.exe+33E49: 90 - nop
MT2.exe+33E4A: 66 0F 1F 44 00 00 - nop word ptr [rax+rax+00]
MT2.exe+33E50: 48 8B 81 E0 00 00 00 - mov rax,[rcx+000000E0]
// ---------- INJECTING HERE ----------
MT2.exe+33E57: 8B 40 14 - mov eax,[rax+14]
// ---------- DONE INJECTING ----------
MT2.exe+33E5A: C3 - ret
MT2.exe+33E5B: 90 - nop
MT2.exe+33E5C: 0F 1F 40 00 - nop dword ptr [rax+00]
MT2.exe+33E60: 41 BA 01 00 00 00 - mov r10d,00000001
MT2.exe+33E66: 66 41 0F 6E C2 - movd xmm0,r10d
MT2.exe+33E6B: 48 8B 81 E0 00 00 00 - mov rax,[rcx+000000E0]
MT2.exe+33E72: 44 8B 48 14 - mov r9d,[rax+14]
MT2.exe+33E76: 01 50 1C - add [rax+1C],edx
MT2.exe+33E79: 4D 63 C0 - movsxd r8,r8d
MT2.exe+33E7C: 41 01 D1 - add r9d,edx
}
[/super]
But:
Before Game Update:
Code: Select all
[ENABLE]
aobscanmodule(BeforeUpdate_MoneyTest,MT2.exe,8B 40 1C C3 90) // should be unique
alloc(newmem,$1000,BeforeUpdate_MoneyTest)
label(code)
label(return)
newmem:
code:
mov eax,[rax+1C]
ret
nop
jmp return
BeforeUpdate_MoneyTest:
jmp newmem
return:
registersymbol(BeforeUpdate_MoneyTest)
[DISABLE]
BeforeUpdate_MoneyTest:
db 8B 40 1C C3 90
unregistersymbol(BeforeUpdate_MoneyTest)
dealloc(newmem)
{
// ORIGINAL CODE - INJECTION POINT: MT2.exe+2D527
MT2.exe+2D500: 0F B6 81 D8 00 00 00 - movzx eax,byte ptr [rcx+000000D8]
MT2.exe+2D507: 84 C0 - test al,al
MT2.exe+2D509: 75 0D - jne MT2.exe+2D518
MT2.exe+2D50B: 48 8B 81 E8 00 00 00 - mov rax,[rcx+000000E8]
MT2.exe+2D512: 39 50 1C - cmp [rax+1C],edx
MT2.exe+2D515: 0F 9D C0 - setge al
MT2.exe+2D518: C3 - ret
MT2.exe+2D519: 90 - nop
MT2.exe+2D51A: 66 0F 1F 44 00 00 - nop word ptr [rax+rax+00]
MT2.exe+2D520: 48 8B 81 E8 00 00 00 - mov rax,[rcx+000000E8]
// ---------- INJECTING HERE ----------
MT2.exe+2D527: 8B 40 1C - mov eax,[rax+1C]
// ---------- DONE INJECTING ----------
MT2.exe+2D52A: C3 - ret
MT2.exe+2D52B: 90 - nop
MT2.exe+2D52C: 0F 1F 40 00 - nop dword ptr [rax+00]
MT2.exe+2D530: 48 8B 81 E8 00 00 00 - mov rax,[rcx+000000E8]
MT2.exe+2D537: 44 8B 48 1C - mov r9d,[rax+1C]
MT2.exe+2D53B: 01 50 24 - add [rax+24],edx
MT2.exe+2D53E: 4D 63 C0 - movsxd r8,r8d
MT2.exe+2D541: 41 01 D1 - add r9d,edx
MT2.exe+2D544: 49 C1 E0 05 - shl r8,05
MT2.exe+2D548: 44 89 48 1C - mov [rax+1C],r9d
After Game Update:
Code: Select all
[ENABLE]
aobscanmodule(AfterUpdate_MoneyTest,MT2.exe,8B 40 14 C3 90) // should be unique
alloc(newmem,$1000,AfterUpdate_MoneyTest)
label(code)
label(return)
newmem:
code:
mov eax,[rax+14]
ret
nop
jmp return
AfterUpdate_MoneyTest:
jmp newmem
return:
registersymbol(AfterUpdate_MoneyTest)
[DISABLE]
AfterUpdate_MoneyTest:
db 8B 40 14 C3 90
unregistersymbol(AfterUpdate_MoneyTest)
dealloc(newmem)
{
// ORIGINAL CODE - INJECTION POINT: MT2.exe+33E57
MT2.exe+33E30: 0F B6 81 D0 00 00 00 - movzx eax,byte ptr [rcx+000000D0]
MT2.exe+33E37: 84 C0 - test al,al
MT2.exe+33E39: 75 0D - jne MT2.exe+33E48
MT2.exe+33E3B: 48 8B 81 E0 00 00 00 - mov rax,[rcx+000000E0]
MT2.exe+33E42: 39 50 14 - cmp [rax+14],edx
MT2.exe+33E45: 0F 9D C0 - setge al
MT2.exe+33E48: C3 - ret
MT2.exe+33E49: 90 - nop
MT2.exe+33E4A: 66 0F 1F 44 00 00 - nop word ptr [rax+rax+00]
MT2.exe+33E50: 48 8B 81 E0 00 00 00 - mov rax,[rcx+000000E0]
// ---------- INJECTING HERE ----------
MT2.exe+33E57: 8B 40 14 - mov eax,[rax+14]
// ---------- DONE INJECTING ----------
MT2.exe+33E5A: C3 - ret
MT2.exe+33E5B: 90 - nop
MT2.exe+33E5C: 0F 1F 40 00 - nop dword ptr [rax+00]
MT2.exe+33E60: 41 BA 01 00 00 00 - mov r10d,00000001
MT2.exe+33E66: 66 41 0F 6E C2 - movd xmm0,r10d
MT2.exe+33E6B: 48 8B 81 E0 00 00 00 - mov rax,[rcx+000000E0]
MT2.exe+33E72: 44 8B 48 14 - mov r9d,[rax+14]
MT2.exe+33E76: 01 50 1C - add [rax+1C],edx
MT2.exe+33E79: 4D 63 C0 - movsxd r8,r8d
MT2.exe+33E7C: 41 01 D1 - add r9d,edx
}
But now I have another problem, as you can see in mov eax,[rax+14] offset changes after update.
For example, if I wanted to make 10000 money I can give a value to mov eax,[rax+??] even in a future update
Something like:
Code: Select all
newmem:
mov eax,[rax+??],(int)10000
code:
readmem(Money,10)
// mov eax,[rax+14]
// ret
//nop
reassemble(Money+A)
jmp return
align 10,CC // alignment
bkpMoney:
readmem(Money,20)
align 10,CC // alignment
Or to each update I have to change the offset manually?