General Question

LostInParadise's avatar

How can a computer virus reproduce itself?

Asked by LostInParadise (32215points) July 30th, 2011

Along with messing up a person’s computer, a computer virus is able to make copies of itself to mess up other people’s computers. That means that a part of the program is able to reproduce the entire program. How is that possible?

Observing members: 0 Composing members: 0

8 Answers

LostInParadise's avatar

I think I have an idea of how this is done. If the program knows where it is located in the computer’s memory, it can run a loop to move each sequential line.

ragingloli's avatar

Viri infect other programs, that means they insert their viral code into other programs, which causes these programs, when run, to infect even more programs.
Just like actual viri insert viral code into the host cell, which then starts to assemble new viri.

jaytkay's avatar

Some viruses shanghai your email and send messages to your contacts, inviting them to click on a link, which gives them the virus.

LostInParadise's avatar

Let me make my question a little clearer. Suppose you wanted to write a paragraph with instructions on how to write the paragraph. What I suggested was a line at the end of the paragraph that says something like,“Write everything in the paragraph.” Suppose that the instructions were limited to talking about specific characters to be written. Do you see how this would cause problems?

john65pennington's avatar

My computer keeps duplicating files and your question makes me wonder if the duplicated files are viruses that my anti viruse program states it has deleted.

Good question. Now, we need a good answer. jp

koanhead's avatar

The virus does not use part of itself in order to make copies of itself; instead it uses facilities provided by the host operating system (without which it wouldn’t work at all). For example, it might cause the OS to save it to a file on disk, and then make copies of the file. Or, as @jaytkay points out, send the file as an email attachment.

Sentences and such can be constructed in such a way as to reproduce themselves in the way you specify, but it’s not easy so I’m not going to try it here. You can check out Hofstadter’s book Metamagical Themas for examples. He has a whole chapter on self-replicating sentences.

PhiNotPi's avatar

There are two types of self replicating programs, viruses and worms. A computer virus spreads when you run an infected file. The virus then edits other files and adds itself into them. To spread itself to other computers, they can do several things. They can send emails to other computers, or they can infect mobile storage devices. Most do both. When a computer gets sent an infected email, the computer does not get infected by itself. The user must open the attached file to get infected.

A worm, unlike a virus, does not need a human to run an infected program to spread. It is able to run and replicate on its own. This allows it to spread much faster.

Vortico's avatar

Extending on @koanhead‘s first paragraph, here is an example. You can write a batch script in Windows called virus.bat that looks like this:

copy virus.bat virus2.bat

The copy command provided by Windows allows the virus to replicate itself without using complex self-replicating algorithms in the code.

http://en.wikipedia.org/wiki/Quine_(computing)

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther