How computer viruses work?
All computer viruses need to be run in order to be activated. Once activated, a virus may replicate into only one program at a time, it may infect some randomly-chosen set of programs, or it may infect every program on the system. Sometimes a virus will replicate based on some random event or on the current value of the clock.
In general a virus performs four actions.
1. Replication: The virus inserts copies of itself into other program files. Then each time the host program is run the virus infects more files.
2. Camouflage: Stealth viruses disguise themselves to avoid detection by antivirus software.” Different viruses employ different methods to camouflage their existence. One method is to create fake code that is interspersed with good code and each time the virus runs it changes the fake code to hide its presence.
3. Event watching: Every time the virus runs it checks for certain conditions whenever the triggering condition exists, the virus delivers it destructive payload.
4. Delivery: When the triggering condition is met, the virus unleashes its payload. This payload may be a harmless poem on the screen to show you have been hit. On the other hand, the payload can be as destructive as scrambling or deleting important system files on the disk drive. The worst viruses perform their destruction, such as changing accounting or stealing passwords, without announcing their presence.