Bypass Permission Check

Bypass permission check for daily report system

目前為 2024-08-09 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Bypass Permission Check
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Bypass permission check for daily report system
// @match        http://10.6.*/*
// @match        http://10.6.1.129/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const originalXHROpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function() {
        const url = arguments[1];
        if (url.startsWith('http://10.6.1.129/daily_reportapi/permission?user=')) {
            const self = this;
            this.addEventListener('readystatechange', function() {
                if (this.readyState === 4) {
                    Object.defineProperty(this, 'response', {writable: true});
                    Object.defineProperty(this, 'responseText', {writable: true});
                    Object.defineProperty(this, 'status', {writable: true});

                    // 重写响应
                    this.response = this.responseText = '0';
                    this.status = 200;
                }
            });
        }
        originalXHROpen.apply(this, arguments);
    };

    console.log('Permission bypass script loaded');
})();