From c2a4be71c40e32b0b62aa287c74f6f3e98c21582 Mon Sep 17 00:00:00 2001 From: dami Date: Sat, 6 Dec 2025 19:35:32 +0800 Subject: [PATCH] Create tpl_v5.lua --- plugins/openresty/resty/obf/bak/tpl_v5.lua | 96 ++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 plugins/openresty/resty/obf/bak/tpl_v5.lua diff --git a/plugins/openresty/resty/obf/bak/tpl_v5.lua b/plugins/openresty/resty/obf/bak/tpl_v5.lua new file mode 100644 index 000000000..d6c2a3625 --- /dev/null +++ b/plugins/openresty/resty/obf/bak/tpl_v5.lua @@ -0,0 +1,96 @@ +-- Copyright (C) midoks + +local _M = { _VERSION = '1.0' } +local mt = { __index = _M } +local setmetatable = setmetatable + +local forgejs = require "resty.obf.forgejs" +local util = require "resty.obf.util" +local FJ = forgejs.content() + +local obf_log = require "resty.obf.log" +local log_fmt = obf_log.fmt +local log = ngx.log + + +function _M.new(self) + local self = { + } + return setmetatable(self, mt) +end + +function _M.content(data, iv, tag, key, debug_data) + local head_html = "\n\n \n \n \n \n \n\n" + local fj_open = "\n" + + local data_script = "\n" + + + if not (ngx.var.obf_rand_var == "false") then + data_script = util.obf_rand(data_script) + end + + local prof = ngx.var.obf_prof + if not (ngx.var.obf_rand_extra == "false") then + local t_add0 = util.tmark() + data_script = util.obf_rand_data(data_script) + if prof == "true" then + log(ngx.ERR, log_fmt("obf_prof obf_rand_data add_ms=%.2f", util.dt_ms(t_add0))) + end + end + + local t_df0 = util.tmark() + data_script = util.data_filter(data_script) + if prof == "true" then + log(ngx.ERR, log_fmt("obf_prof data_filter ms=%.2f", util.dt_ms(t_df0))) + end + + data_script = data_script:gsub("{{__HOLD_1__}}", data) + + return table.concat({ + head_html, + fj_open, + FJ, + fj_close, + data_script, + }) +end + + + +return _M