您的位置:首页 > 其它

antivirus usb BY LAtETom

2011-03-13 11:24 253 查看
#include "stdio.h"

main()
{
    FILE *fp;
    char driver;
    char path[20];
    char name[20];
    char c;
    char YN1,YN2;
    char dos1[20],dos2[20];
    int i=0;
    int flag=0;
    for(;i<20;i++)
    {
        dos1[i]=dos2[i]=path[i]=name[i]='/0';
    }
    printf("Please input the driver./n");
    scanf("%c",&driver);
    sprintf(path,"%c://autorun.inf",driver);
    fp=fopen(path,"r+");
    if (!fp)
    {
        printf("No virus in %c./n",driver);
    }
    else
    {
        flag=1;
    }
    while((c=fgetc(fp))!=EOF)
    {
        if(c=='o'||'O'==c)
        {
            c=fgetc(fp);
            if(c=='p'||'P'==c)
            {
                c=fgetc(fp);
                if('e'==c||'E'==c)
                {
                    c=fgetc(fp);
                    if('n'==c||'N'==c)
                    {
                        c=fgetc(fp);
                        if('='==c)
                        {   i=0;
                            while((c=fgetc(fp))!='/n'&&c!=EOF)
                            {
                                name[i]=c;
                                i++;
                            }

                        }
                    }
                }
            }
        }
    }
    if('e'==name[strlen(name)-1])
    {
        printf("Find virus in %c://%s./n",driver,name);
    }
    else
    {
        flag=0;
    }
    if(flag)
    {
        printf("The virus is in %c://%s./n",driver,name);
        sprintf(dos1,"del %c://autorun.inf",driver);
        if(0==system(dos1))
        {
            printf("/nDelete %c://autorun.inf successfully./n",driver);
        }
        sprintf(dos2,"del %c://%s",driver,name);
        if(0==system(dos2))
        {
            printf("/nDelete %c://%s successfuuly.",driver,name);
        }

     }
    getch();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  dos fp c path system include