Anatomy of a Virus

Today, we will be doing something special. We will writing our own virus. Don’t worry, the code is not malicious, but it demonstrates the power of computer viruses, and how easy it is for anyone with a little programming knowledge (like you guys) to make your own viruses.

Please download the following code:

https://pastebin.com/embed_iframe/XKcwdEh8

Step 1: Create a new folder somewhere on your computer, preferably on your desktop or in documents, you can call it ‘foofolder’

Step 2: Open Wing and copy/paste the code above into a new file, call it foo.py and save it in ‘foofolder’.

Step 3: Open Wing again, and create a new document, type in “Please don’t mess with this file”, and save it as test.foo in the ‘foofolder’.

Optional Step 4: Repeat step 3 but type in something else and name it something else but still with the .foo extension.

Step 5: (Do not run your program in Wing) Open up terminal, change directory to ‘foofolder’, and run “python3 foo.py”

Step 6: Now, open up the files test.foo and anything else that is .foo from ‘foofolder’. You should see the results of the virus.

Step 7: Now make another folder somewhere on your computer, call it ‘anotherfoofolder’.

Step 8: Copy test.foo from ‘foofolder’ to ‘anotherfoofolder’.

Step 9: Repeat Step 3 but instead this time create any random .foo files in ‘anotherfoofolder’.

Step 10: Open terminal and change directory into ‘anotherfoofolder’. Now type “./test.foo”

Step 11: Open any .foo files from ‘anotherfoofolder’, and see the results.

When done, please copy you ‘foofolder’, make sure you rename it to your name so that it will look different than everyone elses, into the server.

What changes could be made to make this code more malicious?

Leave a comment