Last active
August 6, 2022 02:04
-
-
Save c0re100/3dea464145bf6abc8b1332a463fed525 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name U2 Show Peer location | |
// @namespace https://u2.dmhy.org | |
// @version 1.2.1 | |
// @description Show Peer location | |
// @author Husky | |
// @match https://u2.dmhy.org/details.php?id=* | |
// @match https://u2.dmhy.org/userdetails.php?id=* | |
// @grant none | |
// @require https://unpkg.com/xhook@latest/dist/xhook.min.js | |
// @run-at document-start | |
// ==/UserScript== | |
xhook.after(function (request, response) { | |
if (request.url.match(/(btclients|viewpeerlist).php\?id=\d+/)) { | |
let resp = response.text | |
// console.log(resp) | |
let parser = new DOMParser() | |
let clientRes = parser.parseFromString(resp, 'text/html') | |
let clientSpan = clientRes.getElementsByTagName('span') | |
// console.log(clientSpan) | |
for (let i = 0; i < clientSpan.length; i++) { | |
if (clientSpan[i].className.match(/ipv4_native|ipv6_native/)) { | |
clientSpan[i].innerHTML += ' ' + clientSpan[i].title.split('GeoIP: ')[1] | |
} | |
if (clientSpan[i].className.match(/ipv6_teredo/)) { | |
clientSpan[i].innerHTML += ' ' + clientSpan[i].title | |
} | |
if (clientSpan[i].className.match(/ipv4_box/)) { | |
clientSpan[i].style.color = 'white' | |
clientSpan[i].style.backgroundColor = 'red' | |
clientSpan[i].innerHTML += ' ' + clientSpan[i].title.split('GeoIP: ')[1] | |
} | |
} | |
// console.log(clientSpan) | |
response.text = clientRes.body.innerHTML | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment