This is the source code to an article set to publish in an upcoming issue of 2600 magazine. The article is intended as an introduction to computer viruses, overview of the general ideas involved, the mechanics / algorithms, history and importantly the ethics.
A whole section of the article is dedicated to ethics, something that I feel many young programming enthusiasts might not consider when they get intrigued and focused on solving the fascinating problems involved in coding a computer virus.
The example provided with the article is written in Windows Powershell script, it implements self-replication, and an example of a basic stealth technique, obfuscating the virus code through a simple cipher. The reasons Powershell script was chosen are that it presents almost no actual functionality in the wild because of the security restrictions in the shell, as such we are NOT adding to the public code base available for use to bad actors. Also it was an interesting exercise for me develop a piece of self-replicating code in a scripting language such as MSPS. Lastly it makes for a piece of code that should be accessible and easy to understand to a broad segment of people illustrating the ideas presented in the article.