[Python][自己写的杀病毒脚本]
Posted zy691357966
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Python][自己写的杀病毒脚本]相关的知识,希望对你有一定的参考价值。
电脑里的html都插入了一段VB病毒代码..只能自己手动清除了..发现Python确实好用
import os
import re;
Root = ["H:"];
for root in Root:
for rt, dirs, files in os.walk(root):
for f in files:
fname = os.path.splitext(f)
if fname[1]=='.html' :
fileString=rt+'\\\\'+f
print(fileString)
htmlfile=open(fileString,"r+");
Filecontent=htmlfile.read();
Filecontent=str(Filecontent);
NewFilecontent=re.sub("<SCRIPT Language=VBScript>[\\s\\S]*","",Filecontent);
htmlfile.close();
htmlfile=open(fileString,"w+");
htmlfile.write(NewFilecontent);
htmlfile.close();
以上是关于[Python][自己写的杀病毒脚本]的主要内容,如果未能解决你的问题,请参考以下文章
python 自己写的爬虫脚本,爬取搜索页的广告链接,并将其存储到练成中