A computer virus is basically a snippet of code that replicates and ocassionally does something else. It typically uses some other computer program or executable area as the "host".
There are many different types of computer viruses.
- Boot block virus
- Virus that spreads from boot block to another. Somewhat common in the era when people still used floppies to boot computers commonly. (First PC/MS-DOS virus was called Brain, and it was a boot virus and the first stealth virus!
- Executable virus
- A virus that infects executables (binaries or scripts). Typically it attaches itself to the end of the executable and adds a jump instruction to the front.
- Document viruses/Macro viruses
- Spread via macros stored in documents, using an application as the host.
Most infecting viruses check if the host file already has an infection. (Sometimes not. In this day and age, gigabyteful executables might be shrugged at.) These virus "signatures" are often used as basis of virus detection (but in case of polymorphic viruses, new kinds of heuristics have risen. Sorry, my literature is from end-1990s. =( )
The age of huge computer networks has brought us...
- E-mail viruses
- These are bordering on a worm and virus (some experts call this a "hybrid threat") - some of these have traits of both. Typically, they spread as E-mail attachments; the users are lured to open infected document (see document virus) or run an executable (this is behavior closer to a normal worm, but since it needs manual steps to spread instead of being fully automatic, it's also viral in nature).
In fact, E-mail viruses are older than Outlook Express... (see Christmas Tree Virus.)
Legality of viruses: In most countries, it seems, writing and intentional spearding of viruses is considered dishonorable (if not by courts, at least by users!), in some countries it is downright illegal. (Making and intentional spreading is illegal in Finland - of all countries! And this happened in the country that has F-Secure...)
Oh yeah, and the eternal nitpick: Not long ago, the plural of 'virus' was whatever you damn pleased wherever you wanted, but these days, you need to malloc() it.