Monday, December 31, 2012

UNDERSTANDING HOW VIRUS WORKS


Basically computer virus is set of instruction which copies itself continuously as soon as it is executed. Computer virus occupies whole space in main memory (RAM) results in no space for executing other programs, thus system performance degrades drastically. This is general example of how virus works. Virus will not affect the system performance every time; it basically depends on what code the virus program has been written.
To understand the virus behavior we will create a virus for UBUNTU (UNIX) using C program. Look at the code given below, make the same in Ubuntu and run using the following steps.

#include<stdio.h>
int main()
{
system("gnome-terminal");
system("gcc filename.c");
system("./virus");
return 0;
}

It will not cause damage to your system. It is just simulating program for understanding the virus behavior.
 Steps to run virus:
1. Make the same C file with above code.
2. To Compile type “gcc  filename.c –o virus” in terminal.
3. To run type“./virus ” and look what happens.

You have to execute it once then look what happens. It will never stop executing until the whole space of memory is not occupied by it. We cannot stop the execution of this program. Because it will not leave space in main memory to execute other programs. Now we will look what happened after execution of this file shown in fig 1. 
Fig 1. output after running above code