|
从网上兴致冲冲地下载了ASP源代码,准备学习研究的时候.一打开文件,天书般的加密代码.很让人郁闷吧 :(
在网上是找到了解密的方法,得一个文件挨一个文件地打开,复制,粘贴,解密,再复制,再粘贴,再保存......
如果一个ASP程序有几百个文件???
解决办法来了..
decode.asp
<% @Language="javascript" %> <%
/* *--------------- decode.asp ----------------- * 功能:遍历某个目录下的所有文件,对加密过的.asp文件 * 进行解密,并写入源文件中. * 实例:单个文件解密 * Response.Write(DncodeFile(Server.MapPath("conn.asp"))); * 实例:目录下所有文件解密. * DncodeFolderFiles(Server.MapPath("xml")) * author:wanghr100(灰豆宝宝.net) * update:2004-5-17 11:31 *--------------- decode.asp ----------------- */
function DncodeFile(sFilePath) { /* *--------------- DncodeFile(sFilePath) ----------------- * DncodeFile(sFilePath) * 功能:打开文件sFilePath,Encode解密,重写该文件. * 参数:sFilePath,字符串,文件的路径. * 返回:sFilePath,文件的路径. * 实例:Response.Write(DncodeFile(Server.MapPath("conn.asp"))); * author:wanghr100(灰豆宝宝.net) * update:2004-5-17 0:58 *--------------- DncodeFile(sFilePath) ----------------- */ var ForReading = 1, ForWriting =2, ForAppending =8; var fso = Server.CreateObject("Scripting.FileSystemObject"); var f = fso.OpenTextFile(sFilePath,ForReading,true); sFileText = f.ReadAll(); f.Close(); sDncodeText = strdec(sFileText) var f = fso.OpenTextFile(sFilePath,ForWriting,true); f.Write(sDncodeText); f.Close(); //return sDncodeText; return sFilePath; }
function GetFilesPath(sFolderPath) { /* *--------------- GetFilesPath(sFolderPath) ----------------- * GetFilesPath(sFolderPath) * 功能:遍历sFolderPath目录下的所有文件.返回数组.存储文件路径. * 参数:sFolderPath,字符串,目录绝对路径. * 实例:Response.Write(GetFilesPath(Server.MapPath("xml"))) * update:2004-5-12 8:33 * author:wanghr100(灰豆宝宝.net) *--------------- GetFilesPath(sFolderPath) ----------------- */ var sFilePath = new Array(); var fso = Server.CreateObject("Scripting.FileSystemObject"); var oFolder = fso.GetFolder(sFolderPath); var oSubFolders = oFolder.SubFolders; var oFiles = oFolder.Files; icount = oFiles.Count;
var enmFiles = new Enumerator(oFiles);
上一篇:asp 用存储过程实现数据分页
下一篇:ACCESS数据库在ASP中的应用
|