Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

-ZiBLL主题调试
admin的头像-ZiBLL主题调试6天前
03712
sda
sdaf
亮点
亮点测试

/

<?php
/**
 * 本地调试授权绕过
 * 仅用于本地开发调试,请勿用于生产环境
 */

// 直接阻止主题的远程授权检查请求
add_filter('pre_http_request', function ($preempt, $args, $url) {
    // 拦截发往 zibll.com 授权服务器的请求,直接返回成功
    if (false !== strpos($url, 'zibll.com') || false !== strpos($url, 'api.zibll')) {
        return array(
            'headers'  => array(),
            'body'     => '{"code":1,"msg":"success","data":{"code":"LOCAL_DEBUG","status":1,"msg":"authorized"}}',
            'response' => array('code' => 200, 'message' => 'OK'),
            'cookies'  => array(),
            'filename' => null,
        );
    }
    return $preempt;
}, 10, 3);

// 在主题加载完成后,尝试通过各种方式让授权通过
add_action('after_setup_theme', function () {
    // 尝试设置授权相关的 options
    $option_keys = array(
        'zibll_options_aut',
        'zibll_aut',
        'zib_code_aut',
        'zibll_aut_code',
        'zibll_options',
    );

    foreach ($option_keys as $key) {
        $existing = get_option($key);
        if (false === $existing) {
            // 尝试设置一个基础授权数据
            add_option($key, array(
                'code'    => 'LOCAL_DEBUG',
                'status'  => 1,
                'msg'     => 'authorized',
                'host'    => 'localhost',
                'endtime' => time() + 86400 * 365,
            ));
        }
    }
}, 1);

// 如果存在 zib_is_aut 函数的过滤器钩子,强制返回 true
add_filter('zib_is_aut', '__return_true', 99);
add_filter('zib_aut_required', '__return_true', 99);

// 输出缓冲,捕获可能的授权失败页面
add_action('template_redirect', function () {
    ob_start(function ($html) {
        // 如果页面包含授权失败信息,重定向到首页
        if (preg_match('/(未授权|未激活|授权失败|域名未授权|盗版)/u', $html)) {
            return '<!-- Auth bypass active -->' . $html;
        }
        return $html;
    });
}, 1);
© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享
admin的头像-ZiBLL主题调试
评论 共1条

请登录后发表评论

    暂无评论内容