the rake bypass
-- ============================================================
-- Adonis 反作弊绕过脚本(一次性执行)
-- 用法:直接运行此脚本,控制台会输出绕过结果
-- 依赖:getgc, hookfunction, debug.info, newcclosure 等特权函数
-- ============================================================

local function resolveAdonisEnv()
    local gc = getgc or (debug and debug.getgc)
    local hookf = hookfunction
    local env = getrenv
    local renv = nil
    if type(env) == "function" then
        pcall(function()
            renv = env()
        end)
    end
    local dbgInfo = (type(renv) == "table" and renv.debug and renv.debug.info) or (debug and debug.info)
    local newcc = newcclosure or function(fn)
        return fn
    end
    local typeOf = typeof or function(value)
        return type(value)
    end
    return gc, hookf, env, dbgInfo, newcc, typeOf
end

local function eachAdonisGc(fn)
    local gc = getgc or (debug and debug.getgc)
    if type(gc) ~= "function" then
        return false
    end
    local ok, list = pcall(gc, true)
    if not ok or type(list) ~= "table" then
        return false
    end
    for _, value in next, list do
        local stop = fn(value)
        if stop then
            return true
        end
    end
    return true
end

-- 强制检测成功,使绕过逻辑始终执行(也可改为真实扫描)
local function detectAdonis()
    return true
end

local function bypassAdonis()
    local gc, hookf, env, dbgInfo, newcc, typeOf = resolveAdonisEnv()
    if not (type(gc) == "function" and type(hookf) == "function" and type(env) == "function" and type(dbgInfo) == "function") then
        print("[!] 缺少必要函数,无法绕过")
        return false
    end

    local DetectedMeth, KillMeth
    -- 扫描 GC 对象,寻找 Adonis 表
    eachAdonisGc(function(value)
        if typeOf(value) == "table" then
            local detected = rawget(value, "Detected")
            local kill = rawget(value, "Kill")
            if typeOf(detected) == "function" and not DetectedMeth then
                DetectedMeth = detected
                pcall(function()
                    hookf(DetectedMeth, function(methodName, methodFunc)
                        -- 使 Detected 方法返回 true(表示未检测到作弊)
                        return true
                    end)
                    print("[+] 已挂钩 Detected 方法")
                end)
            end
            if rawget(value, "Variables") and rawget(value, "Process") and typeOf(kill) == "function" and not KillMeth then
                KillMeth = kill
                pcall(function()
                    hookf(KillMeth, function(killFunc)
                        -- 使 Kill 方法空转,阻止踢出/封禁
                    end)
                    print("[+] 已挂钩 Kill 方法")
                end)
            end
            if DetectedMeth and KillMeth then
                return true -- 停止扫描
            end
        end
    end)

    -- 额外保护:挂钩 debug.info 防止调用栈检测
    if DetectedMeth and dbgInfo then
        local old
        pcall(function()
            old = hookf(dbgInfo, newcc(function(...)
                local functionName = ...
                if functionName == DetectedMeth then
                    return coroutine.yield(coroutine.running())
                end
                return old(...)
            end))
            print("[+] 已挂钩 debug.info 防止调用栈检测")
        end)
    end

    if DetectedMeth and KillMeth then
        return true
    elseif DetectedMeth then
        return true -- 至少挂钩了 Detected,也算部分成功
    else
        print("[!] 未找到 Adonis 模块,绕过可能不完整")
        return false
    end
end

-- ============================================================
-- 执行绕过
-- ============================================================
print("[*] 开始 Adonis 绕过...")
local ok, result = pcall(bypassAdonis)
if ok and result then
    print("[✓] Adonis 绕过成功!")
else
    print("[✗] Adonis 绕过失败:" .. tostring(result))
end