View previous topic :: View next topic |
Author |
Message |
Twistedfate Expert Cheater
Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Tue Nov 01, 2016 8:33 am Post subject: How to compare Code and jump to another if the.1st is equal? |
|
|
If we have this
*1st instruction
*another instruction ( this instrction or code not in the 1st instruction Data strcture )
--I want to compare
cmp another instruction , value
je 1st instruction
after jump the injection is done
ie ( I want to compare the another instruction if the value is( equal )then jump to 1st istruction and inject
1st instruction )
Is that possible is there any tutorial ?
I can do 2 injections at one script but How can I compare at one code and jump to another code and they dont share Data structure , ?
|
|
Back to top |
|
 |
ulysse31 Master Cheater
Reputation: 2
Joined: 19 Mar 2015 Posts: 324 Location: Paris
|
Posted: Tue Nov 01, 2016 10:23 am Post subject: |
|
|
You can't compare code. You can compare values.
If you'd really want to compare code, you'd need to compare the few bytes which are executed as code.
I don't see any reason why you'd wanna compare code so i assume that you failed to explain yourself.
This is how you'd compare values
Code: | label(instruction1)
label(instruction2)
instruction1:
mov eax,eax // random instruction
instruction2:
mov ebx,ebx//random instruction
cmp ecx,edx
je instruction1 // jmps to instruction 1 if ecx==edx)
jmp instruction2 // defaults jump instruction 2 if ecx != edx |
|
|
Back to top |
|
 |
Twistedfate Expert Cheater
Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Tue Nov 01, 2016 12:32 pm Post subject: |
|
|
yes I mean value sorry because I didnot use he correct term .
If I jumped directly the scipt will crash the game
thats is my code
look at
Code: | newmem:
cmp eax ,#10
je // where ?? help here * |
Code: | alloc(newmem1,2048)
label(returnhere1)
label(originalcode1)
label(exit1)
newmem1:
mov [esi+edx*4],#1056
and eax,[esi+edx*4]
neg eax
jmp exit
originalcode1:
and eax,[esi+edx*4]
neg eax
exit1:
jmp returnhere1
"mygame.exe"+30C794:
jmp newmem1
returnhere1:
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem:
cmp eax ,#10
je // where ?? help here *
mov [esi+04],eax
mov eax,[edi+08]
originalcode:
mov [esi+04],eax
mov eax,[edi+08]
exit:
jmp returnhere
"mygame.exe"+4E223C:
jmp newmem
nop
returnhere: |
|
|
Back to top |
|
 |
ulysse31 Master Cheater
Reputation: 2
Joined: 19 Mar 2015 Posts: 324 Location: Paris
|
Posted: Tue Nov 01, 2016 1:04 pm Post subject: |
|
|
Only you know where you want the code to go and you havent told me.
Post your code and say where you want the je to go (which in itself is like solving the problem).
Imagine mov eax,[edi+08] is the instruciton you want to jump to, you'd do as such
Code: | alloc(newmem1,2048)
label(returnhere1)
label(originalcode1)
label(exit1)
newmem1:
mov [esi+edx*4],#1056
and eax,[esi+edx*4]
neg eax
jmp exit
originalcode1:
and eax,[esi+edx*4]
neg eax
exit1:
jmp returnhere1
"mygame.exe"+30C794:
jmp newmem1
returnhere1:
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(wantedjump)
label(exit)
newmem:
cmp eax ,#10
je wantedjump // where ?? help here *
mov [esi+04],eax
mov eax,[edi+08]
originalcode:
mov [esi+04],eax
wantedjump:
mov eax,[edi+08] //*want to jump here*
exit:
jmp returnhere
"mygame.exe"+4E223C:
jmp newmem
nop
returnhere: |
=> create a label, place the label, jump to the label
|
|
Back to top |
|
 |
Twistedfate Expert Cheater
Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Tue Nov 01, 2016 2:23 pm Post subject: |
|
|
ty for your explaination but
I want to jump from to ( compare the value in newmem if the value is equal then jump to newmm1 )
you created the label at the same memory ( newmem ) but I want to jump to new mem1 after comparing . is that possible ? where could I place the label
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Tue Nov 01, 2016 2:54 pm Post subject: |
|
|
You can't simply JMP to a whole other function.
Registers are set to specific values and arguments pushed on the stack.
The game would be expecting one thing, but execute another and crash.
If you could set everything as the game expects, you could then CALL the other function.
|
|
Back to top |
|
 |
Twistedfate Expert Cheater
Reputation: 1
Joined: 11 Mar 2016 Posts: 231
|
Posted: Tue Nov 01, 2016 2:59 pm Post subject: |
|
|
Quote: | Zanzer You can't simply JMP to a whole other function.
|
ty thats was the answer on my question .
Quote: | If you could set everything as the game expects, you could then CALL the other function.
|
Is that easy any tutorials please?
|
|
Back to top |
|
 |
|