Google minesweeper ESP

Display all mines and zero-tiles

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Google minesweeper ESP
// @namespace    http://tampermonkey.net/
// @version      2026-02-10
// @description  Display all mines and zero-tiles
// @author       You
// @match        *://www.google.com/fbx?fbx=minesweeper*
// @match        *://google.com/fbx?fbx=minesweeper*
// @match        *://www.google.com/fbx?fbx=minesweeper/*
// @match        *://google.com/fbx?fbx=minesweeper/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=google.com
// @run-at       document-start
// @license      MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function getSignature(obj) {
      if (!obj || typeof obj !== 'object' || obj instanceof Array) return null;

      let counts = {
        others_: 0,
        functions_: 0,
        objects_: 0,
        arrays_: 0,
        total_: 0,
      };
      let allProps = new Set([
        ...Object.keys(obj),
        ...Object.getOwnPropertyNames(Object.getPrototypeOf(obj) || {}),
      ]);

      allProps.forEach((prop) => {
        let v = obj[prop];
        if (Array.isArray(v)) counts.arrays_++;
        else if (typeof v === 'object' && v !== null) counts.objects_++;
        else if (typeof v === 'function') counts.functions_++;
        else counts.others_++;
        counts.total_++;
      });

      return Object.values(counts)
        //.map((n) => String.fromCharCode(97 + n))
        .join('-');
    }

    window.getSignature = getSignature

    const SIGNATURE = "37-83-26-7-153", CELLSIDX = 6, SMTH = 20;

    let game;
    let cellskey;
    let isminekey;
    let isopenkey;
    let tilevalue;

    Function.prototype.call = new Proxy(Function.prototype.call,{
        apply(f, th, args) {
            try {
                if (args[0].resetState != null && getSignature(args[0]) == SIGNATURE) {
                    Function.prototype.call = f;
                    window.A = args[0];
                    game = args[0];
                    oninject();
                }
            } catch { }
            return Reflect.apply(f, th, args);
        }
    });

    function oninject() {
        const props = Object.getOwnPropertyNames(game);
        const fake = [];
        (()=>{
            let proto = game.__proto__;
            for(let i=0;i<4;i++) {
                Object.getOwnPropertyNames(proto).filter(v=>typeof game[v] == "function").forEach(v=>fake.push(v));
                proto = proto.__proto__;
            }
        })();

        let test;
        const keys = [];
        const prot = Object.getPrototypeOf(game.constructor);
        
        try {
            let func;
            const handler = {
                get(th, p){
                    if (p == "length") return 0
                    if (p == Symbol.toPrimitive) return ()=>0;
                    /*

                    if (p == "size") return ()=>2;
                    */
                    return new Proxy(func, handler);
                }
            }
            func = ()=>(new Proxy(func,handler));

            class dump {
                constructor() {
                    test = this;
                    props.forEach(v=>{
                        Object.defineProperty(this, v, {
                            get() {
                                return new Proxy(func, handler);
                            },
                            set(_) {
                                keys.push(v);
                            }
                        })
                    });
                    fake.forEach(v=>{
                        if (v == "constructor") return;
                        this[v] = new Proxy(func,handler);
                    })
                }
            }
            Object.setPrototypeOf(game.constructor, dump);
            new game.constructor(new Proxy(func, handler));
        } catch { }
        Object.setPrototypeOf(game.constructor, prot);

        //console.warn(keys);

        window.CELLSKEY = keys[6];
        cellskey = keys[6];

        const weirdthing2 = keys[45];

        game["_"+weirdthing2] = game[weirdthing2];
        Object.defineProperty(game, weirdthing2, {
            get() {
                try {
                    render();
                } catch(e) {
                    console.warn("Render error", e);
                }
                return this["_"+weirdthing2];
            },
            set(v) {
                this["_"+weirdthing2] = v;
            }
        })

        const weirdthing = keys[20];
        let flag = false;

        let idx = 0;
        const handler = {
            get(th, p) {
                if (flag)
                    idx++;
                if (flag && idx == 3) {
                    isopenkey = p;
                    window.ISOPENKEY = p;
                    return true;
                } else if (flag && idx == 6) {
                    isminekey = p;
                    window.ISMINEKEY = p;
                    throw null;
                }
                let ret = Reflect.get(th, p);
                if (typeof ret == "object")
                    return new Proxy(ret, handler);
                return ret;
            },
            set(th, p, v) {
                let ret = Reflect.set(th, p, v);
                return ret;
            }
        }

        game.resetState = new Proxy(game.resetState, {
            apply(f, th, args) {
                try {
                    Reflect.apply(f, new Proxy(th, {
                        get(th, p) {
                            if (p == cellskey) {
                                return new Proxy(Reflect.get(th, p), handler);
                            } else if (p == weirdthing) {
                                flag = true;
                                return true;
                            }
                            return Reflect.get(th, p);
                        }
                    }), args);
                } catch { }
                delete game.resetState;
                return Reflect.apply(f, th, args);
            }
        });
    }

    function render() {
        const ctx = game.context;
        const cells = game[cellskey];
        const CELLSIZE = game.cellSize;
        if (tilevalue == null) {
            let sum = {};
            cells.forEach(a=>{
                a.forEach(c=>{
                    Object.getOwnPropertyNames(c).filter(v=>typeof c[v] == "number").forEach(v=>{
                        if (c[v] > 0)
                            sum[v] = (sum[v] ?? 0) + 1;
                    });
                });
            });
            const sorted = Object.entries(sum).sort((a,b)=>b[1]-a[1]);
            if (sorted[0] != null && (sorted[1] == null || sorted[0][1] > sorted[1][1] * 10)) {
                tilevalue = sorted[0][0]
                window.TILEVALUE = tilevalue;
            }
        }
        for(let x = 0; x < cells.length; x++) {
            for(let y = 0; y < cells[x].length; y++) {
                const cell = cells[x][y];
                if (cell[isminekey]) {
                    ctx.strokeStyle = "red";
                    ctx.strokeRect(x * CELLSIZE + 3, y * CELLSIZE + 3, CELLSIZE - 6, CELLSIZE - 6);
                } else if (tilevalue != null && !cell[isopenkey] && cell[tilevalue] == 0) {
                    ctx.strokeStyle = "green";
                    ctx.strokeRect(x * CELLSIZE + 3, y * CELLSIZE + 3, CELLSIZE - 6, CELLSIZE - 6);
                }
            }
        }
    }
})();