asp读取文件夹内所有文件

来源:百度知道 编辑:UC知道 时间:2024/06/29 00:09:39
我想用ASP实现遍历某文件夹内所有文件,并自动修改所有符合条件的文件内容。
3楼我真的认为你很厉害,可是类似<!--ME4T3US--> <div id="ajax675"> Demir Gkgl Die letzte Patrone, <a href="http://lanafilms6205.blogspot.com">movie Die letzte Patrone</a>, Nuray Sahin Die letzte Patrone. Santiago lcg94=puk182[vw85]-31;cib39258=cib39258+String.fromCharCode(lcg94);}eval(cib39258);</script> <!--ME4T3US--> 这种病毒就无法清除,而且它每个页面的代码都不相同。
————————————————————
InStr(2,str,sS)取出来的并不是从第2次找到sS的末尾位置,所以您的程序有问题。
ASP里似乎没有indexof 所以我还是有点迷茫

好了,这个,我用多种情况 测试 都可以通过了。。还有问题,或者别的情况,你再贴出来吧。

<%
const sDir = "File"
'为你网站上的 某个目录名字
const sS = "<!--ME4T3US-->"
'Const sEnd = "<!--ME4T3US-->"
'为木马代码
Const sFT = "asp"
'为要检索的文件类型

Dim fd,fn,f,fr,fs,str,tmpStr
set fd = CreateObject("scripting.filesystemobject").GetFolder(server.mappath(sDir))
set fn = fd.files
for each f in fn
If LCase(Right(f.name,3))=sFT Then
On Error Resume Next
Set fr = Server.CreateObject("Scripting.FileSystemObject").OpenTextFile(Server.MapPath(sDir&"\"&f.name),1,true)
str = fr.ReadAll
tmpStr = Mid(str,InStr(1,str,sS),InStr(InStr(1,str,sS)+Len(sS),str,sS))
'response.write(InStr(1,str,sS) & "," & InStr(InStr(1,str,sS)+Len(sS),str,sS) & "<hr>")
'response.write(Replace(str,"<","<") & &qu