feat: added functionality to set quasi-random cookie if captcha is passed

This commit is contained in:
Eugene Prodan
2021-06-08 00:40:37 +03:00
parent 0fde9b873b
commit 0f7bd9951b
3 changed files with 24 additions and 2 deletions

18
scripts/utils.lua Normal file
View File

@ -0,0 +1,18 @@
local _M = {}
local md5 = require("md5")
function _M.get_hostname()
local f = io.popen ("/bin/hostname")
local hostname = f:read("*a") or ""
f:close()
hostname =string.gsub(hostname, "\n$", "")
return hostname
end
function _M.get_floating_hash()
-- This ensures that a cookie is rotated every day
return md5.sumhexa(_M.get_hostname() .. os.date("%d"))
end
return _M