Jump to content
Tuts 4 You

(Asm) How to get 2nd string from given string?


busclock

Recommended Posts

Posted

I need to modify some source code. I need to get a 2nd string from given string which contains 2 string. The length of 1st string is always changed time to time. For example:

NuQW4CSS0Qpa8TnZ

or in hex:

01 01 01 01 01 01 01 01 1C 01 01 01 01 01 08 4E 75 51 57 34 43 53 53 01 01 01 01 01 08 30 51 70 61 38 54 6E 5A

the 1st string

NuQW4CSS (4E 75 51 57 34 43 53 53)

it begins with 1 byte in front (08) as the length of the string

the 2nd string

0Qpa8TnZ (30 51 70 61 38 54 6E 5A)

it also begins with 1 byte in front (08) as the length of the string

The problem in the source code i got is, it gets the 2nd string with fixed method, always get it from the 29th byte, which is actually the 2nd string is not always at that position.

getstring.zip

Posted

something like this:

.if dx==BN_CLICKED	.IF ax==IDC_GET
pushad
mov esi, offset packet01
.repeat
lodsb
.until al != 1 && byte ptr [esi+1] != 1
mov edi, offset GetHash01
movzx ecx,al
rep movsb
.repeat
lodsb
.until al != 1
mov edi, offset GetHash02
movzx ecx,al
rep movsb
invoke SetDlgItemText,hwwnd,EDIT_HASHSTRING1,addr GetHash01
invoke SetDlgItemText,hwwnd,EDIT_HASHSTRING1,addr GetHash02
popad .ENDIF
.ENDIF

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...