Bonk.io IP Logger

See people's IP addresses in bonk.io

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Bonk.io IP Logger
// @namespace    http://tampermonkey.net/
// @version      0.2.2
// @description  See people's IP addresses in bonk.io
// @author       Aspect#8445
// @match        *://bonk.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bonk.io
// @grant        none
// @license      GPL
// ==/UserScript==
/* jshint esversion: 6 */

window.onload = () => {
    let iframe = document.getElementById("maingameframe");
    let w = iframe.contentWindow;

    // get ad box
    let ad = document.getElementById("adboxverticalleftCurse");
    setInterval(() => {
        ad.style.display = "block";
    }, 100);
    function resetBox() {
        // delete the other box
        document.getElementById("adboxverticalCurse").innerHTML = '';
        ad.style.overflow = "auto";
        let btn = document.createElement("button");
        btn.innerText = "Reset";
        ad.style.marginLeft = "10px";
        ad.innerHTML = '<h1 style="font-family: sans-serif; color: white">IP Box</h1>';
        ad.appendChild(btn);
        btn.setAttribute("onclick", "window.__rASP()");
        ad.innerHTML += `<p style="font-family: monospace; color: green; user-select: text;">Addresses will appear here. Some addresses may be incorrect, if you get a static IP, they're likely on a VPN or you got the wrong address.</p>`
    }
    window.__rASP = resetBox;

    resetBox();

    function addIp(addr) {
        ad.innerHTML += `<p style="font-family: monospace; color: white; user-select: text;">Got IP address: ${addr}</p>`;
    }

    w.RTCPeerConnection.prototype.addIceCandidate2 = w.RTCPeerConnection.prototype.addIceCandidate;
    w.RTCPeerConnection.prototype.addIceCandidate = function(...args) {
        if (!args[0].address.includes(".local")) {
            addIp(args[0].address);
        }
        this.addIceCandidate2(...args);
    }
};