السلام عليكم
متابعة سلسلة، تحت شعار من الــ Disassembly الى الــ Assembly اقدم لكم محاولة اعادة كتابة التحدي الموجود هنا:
انطلاقا من اوامره الأسمبلي و اعادة بنائها بــ MASM32
المرفقات تحتوي على السورس الكامل
متابعة سلسلة، تحت شعار من الــ Disassembly الى الــ Assembly اقدم لكم محاولة اعادة كتابة التحدي الموجود هنا:
https://www.at4re.net/f/thread-522.html
انطلاقا من اوامره الأسمبلي و اعادة بنائها بــ MASM32
include masm32rt.inc
.data
AboutMsg db "Reversed by scriptkiddie", 00h
GoodBoyMsg db "Great Serial OK. Well done!", 00h
BadBoyMsg db "hey Quit joking man!", 00h
buf01 db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
buf02 db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
buf03 db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
db 00h
hInstance dd 00000000h
buf05 dd 00000000h
buf06 dd 00000000h
buf07 dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h, 00000000h
dd 00000000h
dd 896 dup (?)
.code
start PROC
push 0
call GetModuleHandleA
mov dword ptr [hInstance], eax
push 0
push offset DialogFunc
push 0
push 100
push dword ptr [hInstance]
call DialogBoxParamA
push 0
call ExitProcess
DialogFunc:
enter 0, 0
push ebx
push edi
push esi
cmp dword ptr [ebp+0Ch], 272
jz Snippet003
cmp dword ptr [ebp+0Ch], 273
jz Snippet004
cmp dword ptr [ebp+0Ch], 16
jz Snippet002
cmp dword ptr [ebp+0Ch], 2
jz Snippet002
xor eax, eax
pop esi
pop edi
pop ebx
leave
ret 16
Snippet002:
push 6
push dword ptr [ebp+8h]
call ShowWindow
push 0
call ExitProcess
Snippet003:
push 1000
push dword ptr [hInstance]
call LoadIconA
mov dword ptr [buf05], eax
push eax
push 1
push 128
push dword ptr [ebp+8h]
call SendMessageA
push 10
push dword ptr [ebp+8h]
call GetDlgItem
mov dword ptr [buf06], eax
push 20
push dword ptr [ebp+8h]
call GetDlgItem
mov dword ptr [buf07], eax
pop esi
pop edi
pop ebx
leave
ret 16
Snippet004:
cmp dword ptr [ebp+10h], 50
jnz Snippet005
jmp Snippet002
Snippet005:
cmp dword ptr [ebp+10h], 40
jnz Snippet006
call Snippet008
Snippet006:
cmp dword ptr [ebp+10h], 30
jnz Snippet007
call Snippet014
Snippet007:
xor eax, eax
pop esi
pop edi
pop ebx
leave
ret 16
Snippet008:
push 0
push offset Snippet009
push dword ptr [ebp+8h]
push 400
push dword ptr [hInstance]
call DialogBoxParamA
ret
Snippet009:
enter 0, 0
cmp dword ptr [ebp+0Ch], 272
jz Snippet011
cmp dword ptr [ebp+0Ch], 273
jz Snippet012
cmp dword ptr [ebp+0Ch], 16
jz Snippet010
cmp dword ptr [ebp+0Ch], 2
jz Snippet010
xor eax, eax
leave
ret 16
Snippet010:
push 0
push dword ptr [ebp+8h]
call EndDialog
leave
ret 16
Snippet011:
push dword ptr [buf05]
push 1
push 128
push dword ptr [ebp+8h]
call SendMessageA
push offset AboutMsg
push 402
push dword ptr [ebp+8h]
call SetDlgItemTextA
leave
ret 16
Snippet012:
cmp dword ptr [ebp+10h], 401
jnz Snippet013
jmp Snippet010
Snippet013:
xor eax, eax
leave
ret 16
Snippet014:
push offset buf01
push 41
push 13
push dword ptr [buf06]
call SendMessageA
mov dword ptr [ebp-4h], 0
mov dword ptr [ebp-4h], eax
cmp eax, 0
jnz Snippet015
jmp BadBoyMsgLabel
ret
Snippet015:
cmp eax, 5
jnc Snippet016
jmp BadBoyMsgLabel
ret
Snippet016:
push offset buf02
push 41
push 13
push dword ptr [buf07]
call SendMessageA
cmp eax, 0
jnz Snippet017
jmp BadBoyMsgLabel
ret
Snippet017:
mov ecx, dword ptr [ebp-4h]
call Snippet023
ret
Snippet018:
xor ecx, ecx
Snippet019:
movsx eax, byte ptr [buf02+ecx]
movsx ebx, byte ptr [buf03+ecx]
cmp ecx, 1
jz Snippet022
cmp eax, ebx
jz Snippet020
jmp BadBoyMsgLabel
ret
Snippet020:
cmp eax, 0
jnz Snippet021
jmp GoodBoyMsgLabel
ret
Snippet021:
inc ecx
jmp Snippet019
ret
Snippet022:
inc ebx
inc ecx
cmp eax, ebx
jz Snippet019
jmp BadBoyMsgLabel
ret
Snippet023:
xor ebx, ebx
inc dword ptr [ebp-4h]
Snippet024:
sub byte ptr [buf01+ebx], cl
cmp byte ptr [buf01+ebx], 32
jz Snippet025
inc ebx
dec ecx
jnz Snippet024
jmp Snippet026
Snippet025: add byte ptr [buf01+ebx], cl
inc ebx
dec ecx
jnz Snippet024
Snippet026:
dec ebx
xor ecx, ecx
Snippet027:
movzx eax, byte ptr [buf01+ebx]
cmp eax, 65
jnc Snippet028
add eax, 32
Snippet028:
cmp eax, 90
jbe Snippet029
sub eax, 32
Snippet029:
mov byte ptr [buf03+ecx], al
dec ebx
inc ecx
cmp ecx, 4
jz Snippet030
cmp ecx, dword ptr [ebp-4h]
jnz Snippet027
jmp Snippet031
Snippet030:
mov byte ptr [buf03+ecx], 45
inc ecx
jmp Snippet027
Snippet031:
call Snippet018
ret
BadBoyMsgLabel:
push 16
push offset AboutMsg
push offset BadBoyMsg
push dword ptr [ebp+8h]
call MessageBoxA
ret
GoodBoyMsgLabel:
push 64
push offset AboutMsg
push offset GoodBoyMsg
push dword ptr [ebp+8h]
call MessageBoxA
ret
start ENDP
END
المرفقات تحتوي على السورس الكامل