Visibilty API Bypass

Intercepts and kills the Event constructor itself

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Visibilty API Bypass
// @version      1.0
// @description  Intercepts and kills the Event constructor itself
// @author       Hayshemi
// @match        *://*/*
// @grant        none
// @run-at       document-start
// @license      MIT
// @namespace https://greasyfork.org/users/1570244
// ==/UserScript==

(function() {
    'use strict';

    const forbidden = ['visibilitychange', 'blur', 'fullscreenchange', 'webkitfullscreenchange', 'mouseleave', 'focusout'];

    // 1. Intercept the Event Constructor
    // If a script tries to create or trigger one of these events, we return a "dead" event
    const RawEvent = window.Event;
    window.Event = function(type, dict) {
        if (forbidden.includes(type)) {
            console.warn(`[Stealth] Neutered event creation: ${type}`);
            return new RawEvent('UNUSED');
        }
        return new RawEvent(type, dict);
    };

    // 2. Kill addEventListener at the root
    const orgAdd = EventTarget.prototype.addEventListener;
    EventTarget.prototype.addEventListener = function(type, cb, options) {
        if (forbidden.includes(type)) {
            console.warn(`[Stealth] Blocked listener for: ${type}`);
            return;
        }
        return orgAdd.apply(this, [type, cb, options]);
    };

    // 3. Fake the properties (Hard-Lock)
    const lock = (obj, prop, value) => {
        Object.defineProperty(obj, prop, {
            get: () => value,
            set: () => {}, // Prevent the site from changing it back
            configurable: false
        });
    };

    lock(document, 'visibilityState', 'visible');
    lock(document, 'hidden', false);
    lock(window, 'onblur', null);
    lock(document, 'onvisibilitychange', null);

    // 4. Spoof Fullscreen
    lock(document, 'fullscreenElement', document.documentElement);
    lock(document, 'webkitFullscreenElement', document.documentElement);

    console.log("Bypass Active");
})();