Advertisement
yorath

obfuscation

Sep 9th, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;;;;;;;;;;;obfuscation.asm
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4.  
  5. format PE GUI 4.0
  6. entry start
  7.  
  8. include 'win32ax.inc'
  9. include 'obfuscation.inc'
  10. ;include 'api\kernel32.inc'
  11.  
  12. section '.code' code readable executable
  13. start:
  14.     push ebp
  15.     mov ebp, esp
  16.  
  17.     x_call 'kernel32'
  18.     pop edx
  19.     invoke LoadLibrary, edx
  20.  
  21.     x_call 'CreateRemoteThread'
  22.     pop edx
  23.     invoke GetProcAddress, eax, edx
  24.    
  25. section '.idata' import readable
  26.     library kernel32, 'kernel32.DLL'
  27.     import kernel32, \
  28.         GetProcAddress, 'GetProcAddress', \
  29.         LoadLibrary, 'LoadLibraryA'
  30.  
  31. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  32. ;;;;;;;obfuscation.inc
  33. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  34. macro x_call str
  35. {
  36.     local size, .x, .s, .l, x, v
  37.    
  38.     if str eqtype ''
  39.         call .s
  40.        
  41.         .x db str, 0
  42.         size = ($ - .x)
  43.        
  44.         if ~ size eq
  45.             load x BYTE from (.x)
  46.             repeat size
  47.                 load v BYTE from .x + % - 1
  48.                 store BYTE v xor x at .x + % - 1
  49.             end repeat
  50.         .s:
  51.             push ecx
  52.             push edx
  53.             mov ecx, size
  54.             mov edx, .x
  55.         .l:
  56.             xor BYTE [edx+ecx-1], x
  57.             loop .l
  58.             pop edx
  59.             pop ecx
  60.         end if
  61.     else
  62.         push str
  63.     end if
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement