Decrypt ASP Source Code (reproduced)

zhaozj2021-02-16  85

Original address: http://dev.9cbs.net/Article/27/27930.shtm

From the Internet, I downloaded the ASP source code. When I prepare for learning research. One opening file, the book code. It is very depressed: (I found a way to understand the secret method online, get a file Open, copy, paste, decrypt, replicate, then paste, save ... If a ASP program has hundreds of files ???

The solution is coming ..

Decode.asp

<% @ Language = "javascript"%> <%

/ *? * --------------- decode.asp -----------------? * Function: Traverse all in a directory Document, decrypt the encrypted .asp file? * ????? and write in the source file.? * Instance: Single file decryption? * Response.write (DNCodefile (Server.MAppath " )))));? * Instance: Decryption in the directory.? * DNCodeFolderFiles (Server.MAppath ("XML"))? * Author: Wanghr100 (Gray Beans Baby .NET)? * Update: 2004-5-17 11: 31? * -------------- Decode.asp -----------------? * /

Function DNCODEFILE (SFILEPATH) {/ *? * --------------- DNCodefile (sfilepath) -----------------? * DNCodefile ( SFILEPATH? * Function: Open the file sfilepath, eNCode decrypt, rewrite the file.? * Parameters: sfilepath, string, file path.? * Return: SFilePath, file path.? * Instance: response.write (Dncodefile (Server.MAppath))))))))))))))))))));? * Author: WANGHR100 (Gray bean baby .NET)? * Update: 2004-5-17 0:58? * ---------- ----- DNCodefile (sfilepath) -----------------? * / ??? Var Forreading = 1, forwriting = 2, forting = 8; ??? var fso = Server.createObject ("scripting.filesystemObject"); ??? var f = fso.opentextfile (sfilepath, forreading, true);? ??? sfitext = f.readall (); ??? f.close ();? ?? sdncodetext = strdec (sfiletext) ??? var f = fso.opentextfile (sfilepath, forwriting, true); ??? f.write (sdncodetext); ??? f.close (); ???? c Return SDNCODETEXT; ??? Return sfilepath;}

Function getfilespath (sfolderpath) {/ *? * --------------- GetFileSpath (SfolderPath) -----------------? * getFileSpath SfolderPath? * Function: Traverse all files in the SFolderPath directory. Return to array. Storage file path.? * Parameters: sfolderpath, string, directory absolute path.? * Instance: response.write (GetFilesPath ("XML "))))? * Update: 2004-5-12 8: 33? * Author: Wanghr100 (Gray bean baby .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) ; ??? for (; "! enmfiles.atend (); enmfiles.movenext ()) ??? {??????? sfilepath [sfilepath.length] = enmfiles.Item (). PATH ???}

??? Var enmfolders = new enumerator; ??? for (; enmfolders.atend (); enmfolders.movenext ()) ??? {??????? / * OLD number set up a multi-dimensional. * / ??????? //sfilepath[sfilepath.length]=getfilespath (); ???????? / * add 2004-5-17 11:09 is only one Dimension group * / ?????? sfilepath = sfilepath.concat (getFileSpath (enmfolders.Item (). PATH); ???}

??? Return sfilepath;

}

Function getFileType (sfilename) {/ *? * --------------- GetFileType (sfilename) -----------------? * getfiletype SFileName)? * Function: By suffix, get the file type of SFileName.? * Parameters: sfilename, string, file name.? * Instance: response.write (getFileType ("decode.asp")? * Update: 2004- 5-13 8: 33? * Author: Wanghr100 (Gray Beans Baby .NET)? * -------------- GetFileType (sfilename) ----------- -----? * / ??? sfilename = string (sfilename); ??? Return SfileName.Split (".") [sfilename.split ("."). Length-1];}

/ * START Decryption Implementation: Li Huihuang Start * / Function Screncode (S, L) {ENC = New ActiveXObject ("scripting.encoder"); return enc.Encodescriptfile ("." L, S, 0, L "cript" );} ??? var state_copy_input ??????? = 100 ??? var state_readlen ?????? = 101 ??? var state_decode ??????? = 102 ??? var state_unescape? ???? = 103 ??? Var pick_encoding = new array (??????? 1, 2, 0, 1, 2, 0, 2, 0, 0, 2, 0, 2, 1, 0, 2, 0, ??????? 1, 0, 2, 0, 1, 1, 2, 0, 0, 2, 1, 0, 2, 0, 0, 2, ?????? 1, 1, 0, 2, 0, 2, 0, 1, 0, 1, 1, 2, 0, 1, 0, 2, ??????? 1, 0, 2, 0, 1, 1 , 2, 0, 0, 1, 1, 2, 0, 1, 0, 2 ???) ??? var Rawdata =

New array (??????? 0x64, 0x37, 0x69, 0x50, 0x7e, 0x2c, 0x22, 0x5a, 0x65, 0x4a, 0x45, 0x72, ??????? 0x61, 0x3a, 0x5b, 0x5e, 0x79 0x66, 0x5d, 0x59, 0x75, 0x5b, 0x27, 0x4c, ??????? 0x42, 0x76, 0x45, 0x60, 0x63, 0x76, 0x23, 0x62, 0x2a, 0x65, 0x4d, 0x43, ???? ??? 0x5f, 0x51, 0x33, 0x7e, 0x53, 0x42, 0x4f, 0x52, 0x20, 0x52, 0x20, 0x63, ??????? 0x7a, 0x26, 0x4a, 0x21, 0x54, 0x5a, 0x46, 0x71, 0x38, 0x20, 0x2b, 0x79, ??????? 0x26, 0x66, 0x32, 0x63, 0x2a, 0x57, 0x2a, 0x58, 0x6c, 0x76,0x7f, 0x2b, ??????? 0x47, 0x7b, 0x46, 0x25, 0x30, 0x52, 0x2c, 0x31, 0x4f, 0x29, 0x6c, 0x3d, ??????? 0x69, 0x49, 0x70, 0x3f, 0x3f, 0x3f, 0x27, 0x78, 0x7b, 0x3f, 0x3f, 0x3f ??????? 0x67, 0x5f, 0x51, 0x3f, 0x3f, 0x3f, 0x62, 0x29, 0x7a, 0x41, 0x24, 0x7e, ??????? 0x5a, 0x2f, 0x3b, 0x66, 0x39, 0x47 0x32, 0x33, 0x41, 0x73, 0x6f, 0x77, ??????? 0x4d, 0x21, 0x56, 0x43, 0x75, 0x5f, 0x71, 0x28, 0x26, 0x39, 0x42, 0x78, ?????? 0x7c, 0x46, 0x6e, 0x53, 0x4a, 0x64, 0x48, 0x5c, 0x74, 0x31, 0x48, 0x67, ??????? 0x72, 0x36, 0x7d, 0x6e, 0x4b, 0x68, 0x70, 0x7d, 0x35, 0x49, 0x5d, 0x22, ??????? 0x3f, 0x6a, 0x55, 0x4b, 0x50, 0x3a, 0x6a, 0x69, 0x60, 0x2e, 0x23, 0 X6a, ??????? 0x7f, 0x09, 0x71, 0x28, 0x70, 0x6f, 0x35, 0x65, 0x49, 0x7d, 0x74, 0x5c, ??????? 0x24, 0x2c, 0x5d, 0x2d, 0x77, 0x27, 0x54, 0x44, 0x59, 0x37, 0x3f, 0x25, ??????? 0x7b, 0x6d, 0x7c, 0x3d, 0x7c, 0x23, 0x6c, 0x43, 0x6d, 0x34, 0x38, 0x28, ????? ?? 0x6d, 0x5e, 0x31, 0x4e, 0x5b, 0x39, 0x2b, 0x6e, 0x7f, 0x30, 0x57, 0x36, ??????? 0x6f, 0x4c, 0x54, 0x74, 0x34, 0x34, 0x6b, 0x72,0x62 0x4c, 0x25, 0x4e, ??????? 0x33, 0x56, 0x30, 0x56, 0x73, 0x5e, 0x3a, 0x68, 0x73, 0x78, 0x55, 0x09, ??????? 0x57, 0x47, 0x4b 0x77, 0x32, 0x61, 0x3b, 0x35, 0x24, 0x44, 0x2e, 0x4d, ??????? 0x2f, 0x64, 0x6b, 0x59, 0x4f, 0x44, 0x45, 0x3b, 0x21, 0x5c, 0x2d, 0x37, ??????? 0x68, 0x41, 0x53, 0x36, 0x61, 0x58, 0x58, 0x7a, 0x48, 0x79, 0x22,0x2e, ??????? 0x09, 0x60, 0x50, 0x75, 0x6b, 0x2d, 0x38, 0x4e, 0x29, 0x55, 0x3d, 0x3f ???) ??? var transformed =

New array () ??? for (var i = 0; i <3; i ) transformed [i] = new array () ??? for (var i = 31; i <= 126; i ) for (VAR J = 0; j <3; j ) Transformed [J] [Rawdata [(i-31) * 3 J]] = (i == 31)? 9: i ??? ??? var Digits = New Array ( ) ??? for (var i = 0; i <26; i ) ??? {??????? DIGITS ["a" .Charcode (0) i] = i ??????? Digits ["a" .CHARCODEAT (0) i] = i 26 ???} ??? for (var i = 0; i <10; i ) ??? Digits ["0" .Charcode (0) i] = i 52 ??? Digits [0x2b] = 62 ??? Digits [0x2f] = 63 ??? function unescape (char) ??? {??????? var escapes = "# & ! * $ "??????? var escaped =" / r / n <> @ "??????? if (char.charcodeat (0)> 126) ?? Return Char ????? ?? IF (escapes.indexof (char)! = -1) ??? Return Escaped.substr (escapes.indexof (char), 1) ??????? Return "?" ???}??? ??? function decodebase64 (string) ??? {??????? var val = 0 ??????? Val =? (DIGITS [String.Substr (0, 1) .Charcodeat (0) ] << 2) ??????? Val =? (DIGITS [String.Substr (1, 1) .Charcodeat (0)] >> 4) ??????? val =? (DIGITS [string.substr (1, 1) .Charcodeat (0)] & 0xF) << 12 ??????? val = ((DIGITS [String.Substr (2, 1) .ch Arcodeat (0)] >> 2) << 8) ??????? val = ((DIGITS [String.Substr (2, 1) .Charcodeat (0)] & 0x3) << 22) ?? ????? val =? (DIGITS [String.Substr (3, 1) .Charcodeat (0)] << 16) ??????? Return Val ???} ??? function strdec (Encodingstring ) ??? {??????? ??????? var marker = "# @ ~ ^" ??????? var stringindex = 0 ??????? var scriptindex = 1 ??????? Var unencodingindex = 0 ??????? var char =

NULL ??????? var encodingLength = unencodingLength = 0 ??????? var state = state_copy_input ??????? var unencodingstring = "" ??????? var RE, ARR ?? ????? ??????? while (state) ??????? {??????????? Switch (state) ??????????? {??????????????? case (state_copy_input): ??????????????????? ScriptIndex = Encodingstring.indexof (Marker, StringIndex) ???????????????????? f (scriptindex! = -1) ??????????????????? {??? ????????????????????? Unencodingstring = Encodingstring.substring (StringIndex, scriptindex) ???????????????????? ???? scriptindex = Marker.Length ???????????????state = state_readlen ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????} ???????????????????????????????? {???? ??????????????????? StringIndex = StringIndex == 0? 0: StringIndex ?????????????????????? ?? unencodingstring = encodingstring.substr (stringIndex, encodingstring.length) ?????????????????????????????????????????????????????????????????? ??????????} ??????????????????????????????? ??????????? case (state_readlen) ???: ???????????????????? eNCodingLength = E Ncodingstring.substr (ScriptIndex, 6) ???????????????????? UnencodingLength = decodeBase64 (EncodingLength) ????????????????? ScriptIndex = (6 "==". Length) ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????? breAK ???????????????????????? case (state_decode):???? ??????????????? IF (! unencodingLength) ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????????????? StringIndex = scriptindex "dqgaaa == ^ # ~ @". Length ??????????????????????? UnencodingIndex = 0 ???????????????state = state_copy_input ???????????? ??? Break ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Encodingstring.substr (scriptindex, 1) ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????? Else ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ????? if (char.charcodeat (0) <0xff) ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????? UnencodingString = string.fromcharcode (Transformed [PICK_ENCODING [UnencodingIndex% 64] [CHAR.CHARCODEAT (0)]) ???????? ???????????????????? UnencodingIndex ?????????????????????} ?????? ??????????????????????????????????? {???????? ???????????????????? unencodingstring = char ???????????????????????????????????} ??? ?????????????????????????????????? ScriptIndEx ??????? ????????????????? UnencodingLength - ???????????????????????????????????????? ????????????} ????????????????????????? Case State_unescape: ????????????????????????????????????????????????????????????????? UnencodingString = Unescape (EncodingString.Substr ( ScriptIndex, 1)) ???????????????????????? ???? Scriptindex ;? unencodingLength - = 2 ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? State = State_Decode ???????????? ??????? Break ???????????} ?????????????? r? = new regexp ("(" JScript | VBScript) .Encode "," GMI ") ??????? while (Arr = Re.exec (Unencodingstring))? Unencodingstring = regexp.LeftContext regexp. $ 1 regexp.rightcontext ?????? RETURN Unencodingstring ???} / * End Decryption Implement: Li Huihuang End * / Function DNCodefolderfiles (SfolderPath) {/ *? * -------------- DNCodeFolderFiles (SfolderPath) --- --------------? * DNCODEFOLDERFILES (SFOLDERPATH)? * Function: Decrypt the encrypted .asp files? * ????? in the SfolderPath directory. Write into the source file.? * Instance: DNCodeFolderFiles (Server.MAppath ("XML"));

? * Author: wanghr100 (Gray bean baby .NET)? * Update: 2004-5-17 8:07? * --------------- DNCodeFolderfiles (SfolderPath) ----- ------------? * / ??? var arrfiles = getFileSpath (SfolderPath) ??? for (var i = 0; i ??? {

??????? IF (getFileType (Arrfiles [i]) == "ASP")

??????? {

??????????? Response.write (DNCodefile (Arrfiles [i]))

??????????? response.write ("OK.

")

???????}

???}

}

// Get all the files in the XML directory. Decrypt .DNCodeFolderFiles (Server.mAppath ("XML")) // gets T.asp. Decryption .Response.write (server.mappath ("t.asp"))))) %>

转载请注明原文地址:https://www.9cbs.com/read-11640.html

New Post(0)