[Python][自己写的杀病毒脚本]
2016-04-02 16:43
501 查看
电脑里的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学习笔记][Python内置函数]
- Python&MySQL&PyQt
- [Python学习笔记][Python内置函数]
- [Python学习笔记][第八章Python异常处理结构与程序调试]
- [Python学习笔记][第八章Python异常处理结构与程序调试]
- [Python学习笔记][第七章Python文件操作]
- [Python学习笔记][第七章Python文件操作]
- [Python学习笔记][第六章Python面向对象程序设计]
- [Python学习笔记][第五章Python函数设计与使用]
- [Python学习笔记][第五章Python函数设计与使用]
- [Python学习笔记][第六章Python面向对象程序设计]
- [Python学习笔记][第四章Python字符串]
- [Python学习笔记][第四章Python字符串]
- [Python笔记][第四章Python正则表达式]
- [Python笔记][第四章Python正则表达式]
- [Python笔记][第三章Python选择与循环]
- [Python笔记][第三章Python选择与循环]
- [Python笔记][第二章Python序列-tuple,dict,set]
- [Python笔记][第二章Python序列-tuple,dict,set]