Update anti_ddos_challenge.lua

Update to fix hex encode in Javascript encryption so that it no longer requires Nginx Lua's ngx_devel_kit
This commit is contained in:
C0nw0nk 2019-11-12 21:48:59 +00:00 committed by GitHub
parent f13998a56e
commit 4e5060ef41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -174,7 +174,7 @@ Encrypt/Obfuscate Javascript output to prevent content scrappers and bots decryp
3 = Hex encryption
4 = Base64 Javascript Encryption
]]
local encrypt_javascript_output = 1
local encrypt_javascript_output = 0
--[[
IP Address Whitelist
@ -277,6 +277,12 @@ local function sep(str, patt, re)
return rstr:sub(1, #rstr - #re)
end
local function stringtohex(str)
return str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end)
end
--encrypt_javascript function
local function encrypt_javascript(string1, type, defer_async, num_encrypt, encrypt_type, methods) --Function to generate encrypted/obfuscated output
local output = "" --Empty var
@ -320,7 +326,7 @@ local function encrypt_javascript(string1, type, defer_async, num_encrypt, encry
end
if type == 3 then --Hex
local hex_output = ndk.set_var.set_encode_hex(string1) --Encode string in hex
local hex_output = stringtohex(string1) --ndk.set_var.set_encode_hex(string1) --Encode string in hex
local hexadecimal_x = "" --Create var
local encrypt_type_origin = encrypt_type --Store var passed to function in local var