URLDECode method replenishment.

zhaozj2021-02-11  208

There is no URLDECode function in the ASP, as if there is aspx, I am not very clear, but there are many ASPs. Find a URLDECode function written online on the Internet, but this function has an error, and it is more difficult to understand in some respects. And there is a mistake, when there is an uncommon dual-byte text, it will generate an error. If "乄" is "% 81W" after urlencoder, the decoding cannot be successful.

In fact, double-byte encoding is here as long as "W" is also compiled into a 16-way ASC code.

Knowledge: Cookie in the computer is also encoded by Urlencode, so Urldecode is also useful for cracking cookies.

Here is the source code:

Function Urldecode (ENSTR) DIM DESTRDIM C, I, VDESTR = "" for i = 1 to Len (ENSTR) C = MID (ENSTR, I, 1) IF C = "%" THENV = EVAL ("& H" MID ENSTR, I 1, 2)) IF V <128 Thendestr = Destr & Chr (V) i = i 2ELSE IF IsValidHex (MID (ENSTR, I, 3)) THEN IF IsValidHex (MID (ENSTR, I 3, 3) ) THEN V = EVAL ("& H" MID (ENSTR, I 1, 2) MID (ENSTR, I 4, 2)) DESTR = Destr & Chr (V) i = i 5 else v = Eval ("& H " MID (ENSTR, I 1, 2) CSTR (HEX (ASC (ENSTR, I 3, 1))))))))))))))))))))))) DESTR = DESTR & CHR (V) i = i 3 end if else destr = destr & c Endness ifelseif c = " " thendestr = destr & "Elsedestr = deStr & CEND IFEND IFNEXTURLDECODE = DESTREND FUNCTION

Function isvalidhex (str) isvalidHex = truestr = ucase (str) if len (str) <> 3 Then isvalidHex = false: EXIT FUNCTIONIF LEFT (STR, 1) <> "" Then isvalidHex = false: exit functionc = MID (STR , 2, 1) IF Not ((C> = "0") AND (c <= "9")) OR (C> = "a") AND (c <= "z")) The ISValidHex = false: exit functionc = MID (STR, 3, 1) IF NOT (((c> = "0") AND (c <= "9")) or (c> = "a") AND (c < = "Z"))) The isvalidHex = false: exit functionend function

You use this method to decode "% 81w" to see, yes. Of course, you can also play a small paragraph to make it your own string encryption.

Zhongxun machine section Yongyi.

Ddyyyy@163.net 2004-1-4.

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

New Post(0)