Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .586
- .model flat, stdcall
- option casemap: none
- ASSUME FS:NOTHING
- include C:\masm32\include\windows.inc
- include C:\masm32\include\kernel32.inc
- includelib C:\masm32\lib\kernel32.lib
- include C:\masm32\include\msvcrt.inc
- includelib C:\masm32\lib\msvcrt.lib
- include C:\masm32\include\user32.inc
- includelib C:\masm32\lib\user32.lib
- include C:\masm32\include\ntdll.inc
- includelib C:\masm32\lib\ntdll.lib
- .data
- data1 dd 2, 5, 6, 3, 7, 1, 2, 8
- size_array dd 32
- MsgBoxCaption DB "Statut du programme",0
- MsgBoxText1 DB "Tout va bien ! ",0
- .code
- function_data:
- mov eax, 1
- cmp eax, 3
- je bug_data
- jne end_functiondata
- bug_data:
- _titi db 0fh
- end_functiondata:
- xor eax,eax
- xor ebx,ebx
- xor ecx,ecx
- xor edx,edx
- jmp end_functiondata
- ret
- function_original:
- call function_data
- ;Début sabotage 2
- ;push NULL
- ;push NULL
- ;push 17
- ;push -2
- ;call NtSetInformationThread
- ;Fin sabotage 2
- push esi
- push edi
- ;Debut detection 2
- ;cld
- ;mov edi, start_protected
- ;mov ecx, _end_function - start_protected ;taille en octet
- ;mov al, 0cch
- ;repne scasb
- ;start_protected:
- ;jz _end_function
- ;Fin détection 2
- mov edi,dword ptr [esp+10h] ; taille en octet du tableau de donnée
- xor eax,eax
- xor esi,esi
- ; Début d'un test
- push 3
- pop esi
- cmp edi,esi
- jbe _end_function
- xor esi,esi
- ; Fin d'un test
- ;cmp edi,3 ; edi doit être supérieur à 3 donc au moins 4 octets pour travailler (une donnée est sur 32 bits)
- ;jbe _end_function
- mov edx,dword ptr [esp+0Ch] ; @ du tableau de données
- add edi,0FFFFFFFCh
- push ebx
- mov ebx,dword ptr [esp+18h] ; masque du XOR
- shr edi,2
- push ebp
- add edi,1
- ;Début Sabotage/Obfuscation 1
- mov eax, 2
- cmp eax, 3
- je bug
- jne _loop
- bug:
- _toto db 0fh
- ;Fin Sabotage/Obfuscation 1
- _loop:
- mov ecx,dword ptr [edx] ; ecx = donnée du tableau
- mov ebp,ecx
- xor ebp,esi ; xor avec la valeur précédante du tableau
- xor ebp,ebx ; xor avec le masque
- mov dword ptr [edx],ebp ; stockage du résultat
- xor eax,ecx
- add edx,4
- sub edi,1
- mov esi,ecx ; esi prend la valeur précédente du tableau
- jne _loop
- pop ebp
- pop ebx
- _end_function:
- pop edi
- pop esi
- ret
- start:
- ;Début détection 1
- ;call [IsDebuggerPresent]
- ;cmp eax,0
- ;jnz end_program
- ;Fin détection 2
- ;Début Sabotage 1
- push 1
- call [BlockInput]
- ;Fin Sabotage 1
- pop eax
- xor eax,eax
- lea eax, offset data1
- push 0ffffffffh ; push du masque XOR
- push size_array ; push de la taille du tableau de donnée en octet
- push eax ; push de l'adresse du tableau
- ;push offset data1 ; push de l'adresse du tableau
- call function_original
- push 0
- call [BlockInput]
- ; on quitte le programme
- end_program:
- invoke MessageBoxTimeout, 0, addr MsgBoxText1, addr MsgBoxCaption, 0, 0, 2000
- push 0
- call ExitProcess
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement