服务器中了病毒是件超级麻烦的事情,尤其是什么熊猫烧香之类的或者变种病毒,因为它们不单单潜伏于计算机里,还会把所有的一些网页文件加上了一些iframe,让访问者继续中毒,我想这也是它得已迅速蔓延的手段吧!
如果要把网页中的iframe去掉,是件吃力的苦力活。
所以,写了这样的一个小工具,希望能起到一点点的作用。
请把代码复制,保存在本地,以hta为扩展名。然后双击执行
applicationname="RAP 1.0" border="dialog" [thick/dialog window/none/thin] borderStyle="raised" [normal/complex/raised/static/sunken] caption="yes" icon="res/warm.ico" maximizebutton="no" minimizebutton="yes" showintaskbar="yes" singleinstance="yes" sysmenu="yes" version="1.0" windowstate="normal" />
window.resizeTo(800,520);
var Class = {
create:function(){
return function(){
this.initialize.apply(this,arguments);
}
}
};
var $ = function(sname){return document.getElementById(sname);}
String.prototype.stripTags = function() {
return this.replace(/<\/?[^>]+>/gi, '');
};
String.prototype.escapeHTML = function() {
var div = document.createElement('div');
var text = document.createTextNode(this);
div.appendChild(text);
return div.innerHTML;
};
String.prototype.unescapeHTML = function() {
var div = document.createElement('div');
div.innerHTML = this.stripTags();
return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
};
Array.prototype.S = String.fromCharCode(2);
Array.prototype.in_array = function(e){
var re = new RegExp(this.S+e+this.S);
return re.test(this.S+this.join(this.S)+this.S);
};
String.prototype.color = function(c){
return ""+ this +"";
};
ReplaceApp = Class.create();
ReplaceApp.prototype = {
initialize:function(args){
this.foobar = $(args[0]);
this.container = $(args[1]);
this.initSet();
this.fso = new ActiveXObject("Scripting.FileSystemObject");
this.showFooBar('initializing...');
this.testFSO();
},
initSet:function(){
this.folders = new Array();
this.files = new Array();
this.iframes = new Array();
this.iframesStr = new Array();
this.selects = new Array();
this.iframeFiles = new Array();
this.iframeNum = 0;
this.folderNum = 0;
this.fileNum = 0;
this.currentFolder='';
},
showFooBar:function(msg){
this.foobar.innerHTML = msg;
},
writeContainer:function(c){
this.container.innerHTML = c;
},
testFSO:function(){
this.drives = new Enumerator(this.fso.Drives);
var s, n, x;
s = '';
for(;!this.drives.atEnd();this.drives.moveNext()){
x = this.drives.item();
s = s + x.DriveLetter;
s += " - ";
if (x.DriveType == 3)
n = x.ShareName;
else if (x.IsReady)
n = x.VolumeName;
else
n = "[驱动器未就绪]";
s += n + "
";
}
this.writeContainer(s);
},
showFolderList:function(folder){
if(folder=="" || !/^[a-zA-Z]\:\\.*/ig.test(folder) || !this.fso.FolderExists(folder)){
this.showFooBar('路径不正确'.color('red').bold());
return;
}
this.initSet();
this.currentFolder = folder;
this.recFolder(folder);
this.parseFiles();
},
recFolder:function(folder){
var f, s, fc;
f = this.fso.getFolder(folder);
fc = new Enumerator(f.files);
for(;!fc.atEnd(); fc.moveNext()){
this.files.push(fc.item());
this.fileNum++;
}
fc = new Enumerator(f.SubFolders);
for(;!fc.atEnd();fc.moveNext()){
this.folders.push(fc.item());
this.folderNum++;
this.recFolder(fc.item());
}
},
parseFiles:function(){
var f, s, a, i, c, b;
for(i=0;i f = this.fso.OpenTextFile(this.files[i],1); s = f.ReadAll(); a = this.balanceMatch(s); b = false; for(c=0;c if(/^ 楼主真不错,这么快就有了实现解决的办法,赞一个, 下了一个好象假死了。没有细看你的代码,看起来好复杂,我想实现起来应该不是很复杂把。 / fso枚举文件夹及其文件htm,html,php,asp等进行替换 不过要是自己的页面确实需要iframe不就全部换完了? 我建议对iframe地址进行匹配,对包含指定字符的地址不替换 这个正则让我回去想想。
更多信息请查看IT技术专栏