diff --git a/lua/captcha.lua b/lua/captcha.lua index 6196190..be2d8e8 100644 --- a/lua/captcha.lua +++ b/lua/captcha.lua @@ -4,19 +4,19 @@ local base64 = require "misc.base64" function M.get_challenge () local cap = captcha.new() - cap:font("/usr/local/lib/lua/misc/Vera.ttf") + cap:font("/opt/bunkerized-nginx/lua/misc/Vera.ttf") cap:generate() return cap:jpegStr(70), cap:getStr() end function M.get_code (img, antibot_uri) -- get template - local f = io.open("/antibot/captcha.html", "r") + local f = io.open("/opt/bunkerized-nginx/antibot/captcha.html", "r") local template = f:read("*all") f:close() -- get captcha code - f = io.open("/antibot/captcha.data", "r") + f = io.open("/opt/bunkerized-nginx/antibot/captcha.data", "r") local captcha_data = f:read("*all") f:close() diff --git a/lua/javascript.lua b/lua/javascript.lua index 26a6b4c..e7d328e 100644 --- a/lua/javascript.lua +++ b/lua/javascript.lua @@ -15,12 +15,12 @@ end function M.get_code (challenge, antibot_uri, original_uri) -- get template - local f = io.open("/antibot/javascript.html", "r") + local f = io.open("/opt/bunkerized-nginx/antibot/javascript.html", "r") local template = f:read("*all") f:close() -- get JS code - f = io.open("/antibot/javascript.data", "r") + f = io.open("/opt/bunkerized-nginx/antibot/javascript.data", "r") local javascript = f:read("*all") f:close() @@ -32,14 +32,11 @@ function M.get_code (challenge, antibot_uri, original_uri) end function M.check (challenge, user) - ngx.log(ngx.ERR, "debug challenge = " .. challenge) - ngx.log(ngx.ERR, "debug user = " .. user) local resty_sha256 = require "resty.sha256" local str = require "resty.string" local sha256 = resty_sha256:new() sha256:update(challenge .. user) local digest = sha256:final() - ngx.log(ngx.ERR, "debug digest = " .. str.to_hex(digest)) return str.to_hex(digest):find("^0000") ~= nil end diff --git a/lua/recaptcha.lua b/lua/recaptcha.lua index 1bbef61..d26839f 100644 --- a/lua/recaptcha.lua +++ b/lua/recaptcha.lua @@ -4,15 +4,15 @@ local cjson = require "cjson" function M.get_code (antibot_uri, recaptcha_sitekey) -- get template - local f = io.open("/antibot/recaptcha.html", "r") + local f = io.open("/opt/bunkerized-nginx/antibot/recaptcha.html", "r") local template = f:read("*all") f:close() -- get recaptcha code - f = io.open("/antibot/recaptcha-head.data", "r") + f = io.open("/opt/bunkerized-nginx/antibot/recaptcha-head.data", "r") local recaptcha_head = f:read("*all") f:close() - f = io.open("/antibot/recaptcha-body.data", "r") + f = io.open("/opt/bunkerized-nginx/antibot/recaptcha-body.data", "r") local recaptcha_body = f:read("*all") f:close()