mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
refactor: organize lua dependencies
This commit is contained in:
14
dependencies-0-0.rockspec
Normal file
14
dependencies-0-0.rockspec
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
rockspec_format = "3.0"
|
||||||
|
package = "dependencies"
|
||||||
|
version = "0-0"
|
||||||
|
source = {
|
||||||
|
url = "https://github.com/mora9715/haproxy_ddos_protector"
|
||||||
|
}
|
||||||
|
dependencies = {
|
||||||
|
"lua > 5.1",
|
||||||
|
"md5 >= 1.3",
|
||||||
|
"net-url >= 0.9",
|
||||||
|
"luasec >= 1.0",
|
||||||
|
"luasocket >= 2",
|
||||||
|
"rapidjson >= 0.7"
|
||||||
|
}
|
@ -97,7 +97,7 @@ ADD haproxy/docker-entrypoint.sh /usr/local/bin/
|
|||||||
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
|
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
|
||||||
|
|
||||||
# This is terrible mess but we need it for simple testing purposes of our POC
|
# This is terrible mess but we need it for simple testing purposes of our POC
|
||||||
RUN apt-get update && apt-get install libssl-dev make nano wget gcc libreadline-dev unzip git socat -y
|
RUN apt-get update && apt-get install libssl-dev make nano wget gcc libreadline-dev unzip git socat cmake g++ -y
|
||||||
RUN wget http://www.lua.org/ftp/lua-5.3.5.tar.gz &&\
|
RUN wget http://www.lua.org/ftp/lua-5.3.5.tar.gz &&\
|
||||||
tar -zxf lua-5.3.5.tar.gz &&\
|
tar -zxf lua-5.3.5.tar.gz &&\
|
||||||
cd lua-5.3.5 &&\
|
cd lua-5.3.5 &&\
|
||||||
@ -114,7 +114,8 @@ RUN wget "https://luarocks.org/releases/luarocks-3.3.1.tar.gz" &&\
|
|||||||
RUN /usr/local/bin/luarocks install luasocket &&\
|
RUN /usr/local/bin/luarocks install luasocket &&\
|
||||||
/usr/local/bin/luarocks install luasec &&\
|
/usr/local/bin/luarocks install luasec &&\
|
||||||
/usr/local/bin/luarocks install net-url &&\
|
/usr/local/bin/luarocks install net-url &&\
|
||||||
/usr/local/bin/luarocks install md5
|
/usr/local/bin/luarocks install md5 &&\
|
||||||
|
/usr/local/bin/luarocks install rapidjson
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
1559
src/libs/JSON.lua
1559
src/libs/JSON.lua
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@ _M = {}
|
|||||||
|
|
||||||
local url = require("net.url")
|
local url = require("net.url")
|
||||||
local https = require("ssl.https")
|
local https = require("ssl.https")
|
||||||
local json = require("json")
|
local json = require("rapidjson")
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
local cookie = require("cookie")
|
local cookie = require("cookie")
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ function _M.view(applet)
|
|||||||
parsed_body["h-captcha-response"]
|
parsed_body["h-captcha-response"]
|
||||||
)
|
)
|
||||||
local body, _, _, _ = https.request(url)
|
local body, _, _, _ = https.request(url)
|
||||||
local api_response = json:decode(body)
|
local api_response = json.decode(body)
|
||||||
|
|
||||||
if api_response.success == true then
|
if api_response.success == true then
|
||||||
core.Debug("HCAPTCHA SUCCESSFULLY PASSED")
|
core.Debug("HCAPTCHA SUCCESSFULLY PASSED")
|
||||||
|
Reference in New Issue
Block a user