您现在的位置是:网站首页> 编程资料编程资料
用asp实现的iframe批量替换工具_木马相关_
2023-05-25
318人已围观
简介 用asp实现的iframe批量替换工具_木马相关_
说明:
1、此工具可以批量替换网站上asp,.txt,php,aspx...等等文本型的字符
2、将replace.asp上传至网站根目录后,运行http://网站域名/replace.asp
3、为了安全,使用本程序后请删除或更名
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit
Response.Buffer=true
Response.CharSet="GB2312"
Server.ScriptTimeout=9999999
%>
Iframe替换程序
<%
if request.querystring("add")="yes" then
%>
总文件: 个
替换过文件: 个
被替换过文件路径列表↓
<%
dim oldstr :oldstr=request.form("lookstr") '源字符串
dim newstr :newstr=request.form("replacestr") '新字符串
dim rep : rep=cbool(request.form("bak")) '是否备份文件,true为备份文件
dim i : i=0 '总文件个数
dim j : j=0 '被替换的文件个数
function chkexistsfile(path) '判断一个文件是否存在,如果存在,返回true,否则返回false
dim fso
set fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(path) then
chkexistsfile=true
else
chkexistsfile=false
end if
set fso=nothing
end function
function getfilecode(TemplateFname) '获取一个文件的代码
Dim FSO, FileObj, FileStreamObj
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FileExists(TemplateFname) = False Then
getfilecode=""
Else
Set FileObj = FSO.GetFile(TemplateFname)
Set FileStreamObj = FileObj.OpenAsTextStream(1)
If Not FileStreamObj.AtEndOfStream Then
getfilecode = FileStreamObj.ReadAll
End If
End If
Set FSO = Nothing:Set FileObj = Nothing:Set FileStreamObj = Nothing
end function
sub jstxt(txt) '使用JavaScript
response.write ""
end sub
sub getfolderfile(byval cpath) '替换某一个(子)文件夹下的所有文件
response.flush
dim fso : set fso=server.createobject("scripting.filesystemobject")
if fso.folderexists(cpath)=false then
jstxt("alert("" "&replace(cpath,"\","\\") & "不存在该文件夹!"&" "") ")
response.end
end if
dim folders : set folders=fso.GetFolder(cpath)
dim sfile
for each sfile in folders.files
dim filecode : filecode=getfilecode(sfile)
dim filecode_b : filecode_b=filecode
if instr(filecode,oldstr) <> 0 and fso.GetExtensionName(sfile) <> "bak" then
jstxt("document.getElementById(""txtreple"").value+="""& replace(sfile,"\","\\") & "\r\n""" &chr(13)&chr(10))
jstxt("window.status="""& replace(sfile,"\","\\")&"""")
jstxt("document.title="""& replace(sfile,"\","\\")&"""")
filecode=replace(filecode,oldstr,newstr)
dim newfilecode : set newfilecode=fso.opentextfile(sfile,2)
newfilecode.write filecode
j=j+1
if rep then
dim newfilecode_b : set newfilecode_b=fso.opentextfile(sfile+".bak",2,true)
newfilecode_b.write filecode_b
end if
end if
i=i+1
jstxt("document.getElementById(""allfile"").innerHTML="""&i&"""")
jstxt("document.getElementById(""repfile"").innerHTML="""&j&"""")
next
dim sfolder
for each sfolder in folders.subfolders
getfolderfile(sfolder)
next
set fso=nothing
end sub
getfolderfile(server.MapPath(trim(request.form("pfolder")))) '调用程序
else
%>
<% end if %>
1、此工具可以批量替换网站上asp,.txt,php,aspx...等等文本型的字符
2、将replace.asp上传至网站根目录后,运行http://网站域名/replace.asp
3、为了安全,使用本程序后请删除或更名
复制代码 代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit
Response.Buffer=true
Response.CharSet="GB2312"
Server.ScriptTimeout=9999999
%>
<%
if request.querystring("add")="yes" then
%>
程序处理结果
总文件: 个
替换过文件: 个
被替换过文件路径列表↓
<%
dim oldstr :oldstr=request.form("lookstr") '源字符串
dim newstr :newstr=request.form("replacestr") '新字符串
dim rep : rep=cbool(request.form("bak")) '是否备份文件,true为备份文件
dim i : i=0 '总文件个数
dim j : j=0 '被替换的文件个数
function chkexistsfile(path) '判断一个文件是否存在,如果存在,返回true,否则返回false
dim fso
set fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(path) then
chkexistsfile=true
else
chkexistsfile=false
end if
set fso=nothing
end function
function getfilecode(TemplateFname) '获取一个文件的代码
Dim FSO, FileObj, FileStreamObj
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FileExists(TemplateFname) = False Then
getfilecode=""
Else
Set FileObj = FSO.GetFile(TemplateFname)
Set FileStreamObj = FileObj.OpenAsTextStream(1)
If Not FileStreamObj.AtEndOfStream Then
getfilecode = FileStreamObj.ReadAll
End If
End If
Set FSO = Nothing:Set FileObj = Nothing:Set FileStreamObj = Nothing
end function
sub jstxt(txt) '使用JavaScript
response.write ""
end sub
sub getfolderfile(byval cpath) '替换某一个(子)文件夹下的所有文件
response.flush
dim fso : set fso=server.createobject("scripting.filesystemobject")
if fso.folderexists(cpath)=false then
jstxt("alert("" "&replace(cpath,"\","\\") & "不存在该文件夹!"&" "") ")
response.end
end if
dim folders : set folders=fso.GetFolder(cpath)
dim sfile
for each sfile in folders.files
dim filecode : filecode=getfilecode(sfile)
dim filecode_b : filecode_b=filecode
if instr(filecode,oldstr) <> 0 and fso.GetExtensionName(sfile) <> "bak" then
jstxt("document.getElementById(""txtreple"").value+="""& replace(sfile,"\","\\") & "\r\n""" &chr(13)&chr(10))
jstxt("window.status="""& replace(sfile,"\","\\")&"""")
jstxt("document.title="""& replace(sfile,"\","\\")&"""")
filecode=replace(filecode,oldstr,newstr)
dim newfilecode : set newfilecode=fso.opentextfile(sfile,2)
newfilecode.write filecode
j=j+1
if rep then
dim newfilecode_b : set newfilecode_b=fso.opentextfile(sfile+".bak",2,true)
newfilecode_b.write filecode_b
end if
end if
i=i+1
jstxt("document.getElementById(""allfile"").innerHTML="""&i&"""")
jstxt("document.getElementById(""repfile"").innerHTML="""&j&"""")
next
dim sfolder
for each sfolder in folders.subfolders
getfolderfile(sfolder)
next
set fso=nothing
end sub
getfolderfile(server.MapPath(trim(request.form("pfolder")))) '调用程序
else
%>
<% end if %>
相关内容
- asp最简单最实用的计数器_应用技巧_
- 推荐下天枫常用ASP函数封装,推荐大家使用_ASP CLASS类_
- asp #include命令_应用技巧_
- Server.Execute方法执行指定的ASP程序_应用技巧_
- CreateKeyWord asp实现的由给定的字符串生成关键字的代码_应用技巧_
- JoinChar 向地址中加入 ? 或 & 用于实现传参_应用技巧_
- ShowPage 显示“上一页 下一页”等信息的封装代码_应用技巧_
- asp实现检查目录是否存在与建立目录的函数_应用技巧_
- ScriptHtml 函数之过滤html标记的asp代码_应用技巧_
- GetPaing 函数之asp采集函数中用到的获取分页的代码_应用技巧_
