I need your help :/
I have a register that points to one memory address, like this:
MOV ESI,DWORD PTR SS:[00123456]
And, this address(00123456), contains a RANDOM string, like: “Hello, this is a string”.
I need to get the length/size of the string and compare, if the string length are most than 10, the string need to be cleaned.
Can anyone help me?
NOTE: I’m writing this asm code direct in executable using OllyDbg, so, procedures in MASM, TASM, NASM, etc, will not work.
you can use
REPNE SCAS, this is what intrinsicstrlenuses. else you can use a simple function like this (assumes the input is inEAX):But it would be wise to check if the binary you are modifying doesn’t already have a
strlenfunction.When thats done, you can do the size checks and possible zero’ing, so you’d probably end with something looking like:
(depending where you hook you may also need to preserve the
EFLAGSas well)