mirror of
https://github.com/C0nw0nk/Nginx-Lua-Anti-DDoS.git
synced 2023-12-14 04:31:21 +00:00
Update anti_ddos_challenge.lua
Big Fix : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Malformed_URI URIError: The URI to be encoded contains invalid character (Edge) URIError: malformed URI sequence (Firefox) URIError: URI malformed (Chrome) To prevent this happening on my Hex encryption of javascript "\x char" and "%" char values a soloution is to use `unescape()` or `escape()` i decided to escape values.
This commit is contained in:
@ -535,13 +535,13 @@ local function encrypt_javascript(string1, type, defer_async, num_encrypt, encry
|
||||
|
||||
if defer_async == "0" or defer_async == nil then --Browser default loading / execution order
|
||||
--https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent
|
||||
output = "<script type=\"text/javascript\" charset=\"" .. default_charset .. "\" data-cfasync=\"false\">eval(decodeURIComponent('" .. hexadecimal_x .. "'))</script>"
|
||||
output = "<script type=\"text/javascript\" charset=\"" .. default_charset .. "\" data-cfasync=\"false\">eval(decodeURIComponent(escape('" .. hexadecimal_x .. "')));</script>"
|
||||
end
|
||||
if defer_async == "1" then --Defer
|
||||
output = "<script type=\"text/javascript\" defer=\"defer\" charset=\"" .. default_charset .. "\" data-cfasync=\"false\">eval(decodeURIComponent('" .. hexadecimal_x .. "'))</script>"
|
||||
output = "<script type=\"text/javascript\" defer=\"defer\" charset=\"" .. default_charset .. "\" data-cfasync=\"false\">eval(decodeURIComponent(escape('" .. hexadecimal_x .. "')));</script>"
|
||||
end
|
||||
if defer_async == "2" then --Defer
|
||||
output = "<script type=\"text/javascript\" async=\"async\" charset=\"" .. default_charset .. "\" data-cfasync=\"false\">eval(decodeURIComponent('" .. hexadecimal_x .. "'))</script>"
|
||||
output = "<script type=\"text/javascript\" async=\"async\" charset=\"" .. default_charset .. "\" data-cfasync=\"false\">eval(decodeURIComponent(escape('" .. hexadecimal_x .. "')));</script>"
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user