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.

.text:0054134F push ebp ; File<br />

.text:00541350 call _fseek<br />

.text:00541355 push ebp ; File<br />

.text:00541356 call _ftell ; get file size<br />

.text:0054135B push 0 ; Origin<br />

.text:0054135D push 0 ; Offset<br />

.text:0054135F push ebp ; File<br />

.text:00541360 mov [esp+2Ch+Str], eax<br />

.text:00541364 call _fseek ; rewind <strong>to</strong> start<br />

.text:00541369 mov esi, [esp+2Ch+Str]<br />

.text:0054136D and esi, 0FFFFFFC0h ; reset all lowest 6 bits<br />

.text:00541370 add esi, 40h ; align size <strong>to</strong> 64-byte border<br />

.text:00541373 push esi ; Size<br />

.text:00541374 call _malloc<br />

.text:00541379 mov ecx, esi<br />

.text:0054137B mov ebx, eax ; allocated buffer pointer -> <strong>to</strong><br />

EBX<br />

.text:0054137D mov edx, ecx<br />

.text:0054137F xor eax, eax<br />

.text:00541381 mov edi, ebx<br />

.text:00541383 push ebp ; File<br />

.text:00541384 shr ecx, 2<br />

.text:00541387 rep s<strong>to</strong>sd<br />

.text:00541389 mov ecx, edx<br />

.text:0054138B push 1 ; Count<br />

.text:0054138D and ecx, 3<br />

.text:00541390 rep s<strong>to</strong>sb ; memset (buffer, 0, aligned_size)<br />

.text:00541392 mov eax, [esp+38h+Str]<br />

.text:00541396 push eax ; ElementSize<br />

.text:00541397 push ebx ; DstBuf<br />

.text:00541398 call _fread ; read file<br />

.text:0054139D push ebp ; File<br />

.text:0054139E call _fclose<br />

.text:005413A3 mov ecx, [esp+44h+password]<br />

.text:005413A7 push ecx ; password<br />

.text:005413A8 push esi ; aligned size<br />

.text:005413A9 push ebx ; buffer<br />

.text:005413AA call crypt ; do crypt<br />

.text:005413AF mov edx, [esp+50h+Filename]<br />

.text:005413B3 add esp, 40h<br />

.text:005413B6 push offset aWb ; "wb"<br />

.text:005413BB push edx ; Filename<br />

.text:005413BC call _fopen<br />

.text:005413C1 mov edi, eax<br />

.text:005413C3 push edi ; File<br />

.text:005413C4 push 1 ; Count<br />

.text:005413C6 push 3 ; Size<br />

.text:005413C8 push offset aQr9 ; "QR9"<br />

.text:005413CD call _fwrite ; write file signature<br />

.text:005413D2 push edi ; File<br />

.text:005413D3 push 1 ; Count<br />

.text:005413D5 lea eax, [esp+30h+Str]<br />

.text:005413D9 push 4 ; Size<br />

.text:005413DB push eax ; Str<br />

158

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

Saved successfully!

Ooh no, something went wrong!