#coding uft-8
import os
def kill(x):
os.system('attrib -s -r "%s"' %x)
f=open(x,'w')
f.write('autokilled')
f.close()
os.system('attrib +s +r "%s"' %x)
def get_file(x):
os.system('attrib -s -h -r "%s"' %x)
viruses=[]
for each in os.listdir('.'):
postfix=each.split('.')[-1]
if postfix=='com' or postfix=='exe':
ans=raw_input('%s \tKill It?(y/n): ' %each)
if ans=='y':
viruses.append(each)
try:
kill(each)
except:
print each, 'cannot be killed'
elif os.path.isdir(each):
get_file(each)
print "________now________"
for i in viruses:
os.system('attrib -s "%s"' %i)
f=open(i)
s=f.read()
f.close()
os.system('attrib +s "%s"' %i)
if s=='autokilled':
print i,'\tKilled!'
raw_input()
|