I like to use
[Link] for checking ASM I don't know, or forgot. The
[Link] has a far amount of the ASM commands, and will likely have a more CE style usage.
For adding the address just click the pointer check box, that will give you an offset option. I probably just clicked it and forgot to mention it, not sure really. You can also just use a bracket notation for the address and it will work like a pointer (e.g.
[ptrChakra]+18
).
If you put the stored values at the start of the allocated memory ("newmem"). You need to put a label below it and jump to that. Else you'll be executing what ever bytes the stored value holds. I just like to put it at the start for some reason, but most people just stick it at the end of the allocated memory.
With
movss [rax+18],xmm0
, MOVSS is just writing a single (32 bits) float value from the XMM0 registry to the address at EAX+0x18.
Here is the script with the stored value a the start of "newmem":
Code: Select all
{ Game : NSUNS4.exe
Version:
Date : 2021-05-07
Author : thebl
This script does blah blah blah
}
define(address,"NSUNS4.exe"+74B610)
define(bytes,F3 0F 11 40 18)
[ENABLE]
assert(address,bytes)
alloc(newmem,$1000,"NSUNS4.exe"+74B610)
label(n_code)
label(o_code)
label(return)
label(ptrChakra)
registerSymbol(ptrChakra)
newmem:
ptrChakra:
dd 0
n_code:
mov [ptrChakra],rax
o_code:
movss [rax+18],xmm0
jmp return
address:
jmp n_code
return:
[DISABLE]
address:
db bytes
// movss [rax+18],xmm0
unregisterSymbol(ptrChakra)
dealloc(newmem)
{
// ORIGINAL CODE - INJECTION POINT: NSUNS4.exe+74B610
NSUNS4.exe+74B5ED: 0F 28 F2 - movaps xmm6,xmm2
NSUNS4.exe+74B5F0: E8 27 FD FF FF - call NSUNS4.exe+74B31C
NSUNS4.exe+74B5F5: 48 85 C0 - test rax,rax
NSUNS4.exe+74B5F8: 74 22 - je NSUNS4.exe+74B61C
NSUNS4.exe+74B5FA: F3 0F 10 48 1C - movss xmm1,[rax+1C]
NSUNS4.exe+74B5FF: F3 0F 10 40 18 - movss xmm0,[rax+18]
NSUNS4.exe+74B604: 0F 2F C1 - comiss xmm0,xmm1
NSUNS4.exe+74B607: 73 13 - jae NSUNS4.exe+74B61C
NSUNS4.exe+74B609: F3 0F 58 C6 - addss xmm0,xmm6
NSUNS4.exe+74B60D: 0F 2F C1 - comiss xmm0,xmm1
// ---------- INJECTING HERE ----------
NSUNS4.exe+74B610: F3 0F 11 40 18 - movss [rax+18],xmm0
// ---------- DONE INJECTING ----------
NSUNS4.exe+74B615: 76 05 - jna NSUNS4.exe+74B61C
NSUNS4.exe+74B617: F3 0F 11 48 18 - movss [rax+18],xmm1
NSUNS4.exe+74B61C: 0F 28 74 24 20 - movaps xmm6,[rsp+20]
NSUNS4.exe+74B621: 48 83 C4 38 - add rsp,38
NSUNS4.exe+74B625: C3 - ret
NSUNS4.exe+74B626: CC - int 3
NSUNS4.exe+74B627: CC - int 3
NSUNS4.exe+74B628: 48 83 EC 38 - sub rsp,38
NSUNS4.exe+74B62C: 0F 29 74 24 20 - movaps [rsp+20],xmm6
NSUNS4.exe+74B631: 0F 28 F2 - movaps xmm6,xmm2
}
Here is the script with the stored value a the end of "newmem":
Code: Select all
{ Game : NSUNS4.exe
Version:
Date : 2021-05-07
Author : thebl
This script does blah blah blah
}
define(address,"NSUNS4.exe"+74B610)
define(bytes,F3 0F 11 40 18)
[ENABLE]
assert(address,bytes)
alloc(newmem,$1000,"NSUNS4.exe"+74B610)
label(code)
label(return)
label(ptrChakra)
registerSymbol(ptrChakra)
newmem:
mov [ptrChakra],rax
code:
movss [rax+18],xmm0
jmp return
ptrChakra:
dd 0
address:
jmp newmem
return:
[DISABLE]
address:
db bytes
// movss [rax+18],xmm0
unregisterSymbol(ptrChakra)
dealloc(newmem)
{
// ORIGINAL CODE - INJECTION POINT: NSUNS4.exe+74B610
NSUNS4.exe+74B5ED: 0F 28 F2 - movaps xmm6,xmm2
NSUNS4.exe+74B5F0: E8 27 FD FF FF - call NSUNS4.exe+74B31C
NSUNS4.exe+74B5F5: 48 85 C0 - test rax,rax
NSUNS4.exe+74B5F8: 74 22 - je NSUNS4.exe+74B61C
NSUNS4.exe+74B5FA: F3 0F 10 48 1C - movss xmm1,[rax+1C]
NSUNS4.exe+74B5FF: F3 0F 10 40 18 - movss xmm0,[rax+18]
NSUNS4.exe+74B604: 0F 2F C1 - comiss xmm0,xmm1
NSUNS4.exe+74B607: 73 13 - jae NSUNS4.exe+74B61C
NSUNS4.exe+74B609: F3 0F 58 C6 - addss xmm0,xmm6
NSUNS4.exe+74B60D: 0F 2F C1 - comiss xmm0,xmm1
// ---------- INJECTING HERE ----------
NSUNS4.exe+74B610: F3 0F 11 40 18 - movss [rax+18],xmm0
// ---------- DONE INJECTING ----------
NSUNS4.exe+74B615: 76 05 - jna NSUNS4.exe+74B61C
NSUNS4.exe+74B617: F3 0F 11 48 18 - movss [rax+18],xmm1
NSUNS4.exe+74B61C: 0F 28 74 24 20 - movaps xmm6,[rsp+20]
NSUNS4.exe+74B621: 48 83 C4 38 - add rsp,38
NSUNS4.exe+74B625: C3 - ret
NSUNS4.exe+74B626: CC - int 3
NSUNS4.exe+74B627: CC - int 3
NSUNS4.exe+74B628: 48 83 EC 38 - sub rsp,38
NSUNS4.exe+74B62C: 0F 29 74 24 20 - movaps [rsp+20],xmm6
NSUNS4.exe+74B631: 0F 28 F2 - movaps xmm6,xmm2
}