Advertisement
Guest User

Untitled

a guest
May 30th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .586
  2. .model flat, stdcall
  3. option casemap: none
  4. ASSUME FS:NOTHING
  5.  
  6. include     C:\masm32\include\windows.inc
  7. include     C:\masm32\include\kernel32.inc
  8. includelib  C:\masm32\lib\kernel32.lib
  9. include     C:\masm32\include\msvcrt.inc
  10. includelib  C:\masm32\lib\msvcrt.lib
  11. include     C:\masm32\include\user32.inc
  12. includelib  C:\masm32\lib\user32.lib
  13. include     C:\masm32\include\ntdll.inc
  14. includelib  C:\masm32\lib\ntdll.lib
  15.  
  16. .data
  17.  
  18. data1 dd 2, 5, 6, 3, 7, 1, 2, 8
  19. size_array dd 32
  20. MsgBoxCaption   DB "Statut du programme",0
  21. MsgBoxText1 DB "Tout va bien ! ",0
  22.  
  23. .code
  24. function_data:
  25.     mov eax, 1
  26.     cmp eax, 3
  27.     je bug_data
  28.     jne end_functiondata
  29.     bug_data:
  30.     _titi db 0fh
  31.     end_functiondata:
  32.     xor eax,eax
  33.     xor ebx,ebx
  34.     xor ecx,ecx
  35.     xor edx,edx
  36.     jmp end_functiondata
  37.     ret
  38.  
  39. function_original:
  40.     call function_data
  41.     ;Début sabotage 2
  42.     ;push NULL
  43.    ;push NULL
  44.    ;push 17
  45.    ;push -2
  46.    ;call NtSetInformationThread
  47.     ;Fin sabotage 2
  48.     push esi
  49.     push edi
  50.     ;Debut detection 2
  51.     ;cld
  52.     ;mov edi, start_protected
  53.     ;mov ecx, _end_function - start_protected ;taille en octet 
  54.     ;mov al, 0cch
  55.     ;repne scasb
  56.     ;start_protected:
  57.     ;jz _end_function
  58.     ;Fin détection 2
  59.     mov edi,dword ptr [esp+10h] ; taille en octet du tableau de donnée
  60.     xor eax,eax
  61.     xor esi,esi
  62.     ; Début d'un test
  63.     push 3
  64.     pop esi
  65.     cmp edi,esi
  66.     jbe _end_function
  67.     xor esi,esi
  68.     ; Fin d'un test
  69.     ;cmp edi,3 ; edi doit être supérieur à 3 donc au moins 4 octets pour travailler (une donnée est sur 32 bits)
  70.     ;jbe _end_function
  71.     mov edx,dword ptr [esp+0Ch] ; @ du tableau de données
  72.     add edi,0FFFFFFFCh
  73.     push ebx
  74.     mov ebx,dword ptr [esp+18h] ; masque du XOR
  75.     shr edi,2
  76.     push ebp
  77.     add edi,1
  78.     ;Début Sabotage/Obfuscation 1
  79.     mov eax, 2
  80.     cmp eax, 3
  81.     je bug
  82.     jne _loop
  83.     bug:
  84.     _toto db 0fh
  85.     ;Fin Sabotage/Obfuscation 1
  86.  _loop:
  87.     mov ecx,dword ptr [edx] ; ecx = donnée du tableau
  88.     mov ebp,ecx
  89.     xor ebp,esi ; xor avec la valeur précédante du tableau
  90.     xor ebp,ebx ; xor avec le masque
  91.     mov dword ptr [edx],ebp ; stockage du résultat
  92.     xor eax,ecx
  93.     add edx,4
  94.     sub edi,1
  95.     mov esi,ecx ; esi prend la valeur précédente du tableau
  96.     jne _loop
  97.     pop ebp
  98.     pop ebx
  99.  _end_function:
  100.     pop edi
  101.     pop esi
  102.     ret
  103.  
  104.  
  105.  
  106. start:
  107.         ;Début détection 1
  108.         ;call [IsDebuggerPresent]
  109.         ;cmp eax,0
  110.         ;jnz end_program
  111.         ;Fin détection 2
  112.         ;Début Sabotage 1
  113.         push 1
  114.         call [BlockInput]
  115.         ;Fin Sabotage 1
  116.         pop eax
  117.         xor eax,eax
  118.         lea eax, offset data1
  119.         push 0ffffffffh ; push du masque XOR
  120.         push size_array ; push de la taille du tableau de donnée en octet
  121.         push eax ; push de l'adresse du tableau
  122.         ;push offset data1 ; push de l'adresse du tableau
  123.         call function_original
  124.         push 0
  125.         call [BlockInput]
  126.        
  127.        
  128.         ; on quitte le programme
  129.         end_program:
  130.         invoke  MessageBoxTimeout, 0, addr MsgBoxText1, addr MsgBoxCaption, 0, 0, 2000
  131.         push 0
  132.         call ExitProcess
  133.                
  134. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement