23.03.2013 Views

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

loc_80483F2:<br />

pop ebp<br />

retn<br />

_f endp<br />

4.1.2 Task 1.2<br />

cmp dl, 19h<br />

ja short loc_80483F2<br />

sub eax, 20h<br />

This is also standard C library function. Source code is taken from OpenWatcom and modified slightly.<br />

Compiled in MSVC 2010 with /Ox optimization flag.<br />

This function also use these standard C functions: isspace() and isdigit().<br />

EXTRN _isdigit:PROC<br />

EXTRN _isspace:PROC<br />

EXTRN ___ptr_check:PROC<br />

; Function compile flags: /Ogtpy<br />

_TEXT SEGMENT<br />

_p$ = 8 ; size = 4<br />

_f PROC<br />

push ebx<br />

push esi<br />

mov esi, DWORD PTR _p$[esp+4]<br />

push edi<br />

push 0<br />

push esi<br />

call ___ptr_check<br />

mov eax, DWORD PTR [esi]<br />

push eax<br />

call _isspace<br />

add esp, 12 ; 0000000cH<br />

test eax, eax<br />

je SHORT $LN6@f<br />

npad 2<br />

$LL7@f:<br />

mov ecx, DWORD PTR [esi+4]<br />

add esi, 4<br />

push ecx<br />

call _isspace<br />

add esp, 4<br />

test eax, eax<br />

jne SHORT $LL7@f<br />

$LN6@f:<br />

mov bl, BYTE PTR [esi]<br />

cmp bl, 43 ; 0000002bH<br />

je SHORT $LN4@f<br />

cmp bl, 45 ; 0000002dH<br />

jne SHORT $LN5@f<br />

$LN4@f:<br />

add esi, 4<br />

$LN5@f:<br />

mov edx, DWORD PTR [esi]<br />

125

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!