Last active
July 30, 2023 23:12
-
-
Save alula/1e5a70c954cf87dcbba9d58f13bfa1ba to your computer and use it in GitHub Desktop.
GX.games bypass meme (UserScript edition)
This file contains hidden or 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 GX.games bypass meme (UserScript edition) | |
// @description Piss poor way to bypass piss poor security through obscurity. | |
// @author https://github.com/alula | |
// @version 1 | |
// @grant none | |
// @run-at document-start | |
// @match https://play.gxc.gg/* | |
// @match https://gxc.gg/* | |
// @match https://gx.games/* | |
// ==/UserScript== | |
// While I'm a Firefox shill I advise to use Chromium-based browsers, as Firefox (last checked on 102) has issues with audio. | |
(() => { | |
try { | |
const script = document.createElement("script"); | |
script.textContent = ` | |
console.log("%cinjected owo", "color: #ff00ff;font-size:24px"); | |
// HOOK UP THE CHALLENGE-RESPONSE HANDLER -------------------------------------------------- | |
chrome = { | |
runtime: { | |
sendMessage: function (id, payload, callback) { | |
const { command, hash, randomString } = payload; | |
console.log("%csendMessage", "color:#ffff00", id, command, randomString, hash?.join(",")); | |
if (command !== "authenticate") { | |
console.log("%cUnrecognized command, did Opera devs change something?", "color:#ff00ff", command); | |
return; | |
} | |
// TURNS OUT YOU CAN REPLAY THIS FOR EVERY GAME AND IT JUST WORKS LOL | |
const replay = [77, 8, 83, 194, 13, 86, 92, 93, 100, 219, 164, 81, 197, 175, 203, 176, 19, 158, 70, 163]; | |
replay.forEach((b, i) => hash[i] = b); | |
callback({ hash }); | |
} | |
} | |
}; | |
// KILL THE ENTROPY SOURCES ---------------------------------------------------------------- | |
// Math.random = () => 0; // not present in runner.js | |
// crypto.getRandomValues = (e) => {e.fill(0); return e;}; // used in /dev/random and /dev/urandom, but YoYo runtime doesn't seem to use it. | |
// those are used by randomString generator, returning zeros here makes it always return "00000" lol | |
// Date.now = () => 0; // technically used but it's a fallback, commented out as it may potentially break date queries | |
performance.now = () => 0; // main entropy source | |
// SPOOF THE USER AGENT -------------------------------------------------------------------- | |
this.chrome = chrome; | |
console.log("chrome =", chrome); | |
console.log("this.chrome =", this.chrome); | |
navigator.__defineGetter__("userAgent", () => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 OPR/89.0.4447.64"); | |
navigator.__defineGetter__("userAgentData", () => ({ | |
"brands": [ | |
{ "brand": "Opera GX", "version": "89" }, | |
{ "brand": "Chromium", "version": "103" }, | |
{ "brand": "_Not:A-Brand", "version": "24" } | |
], | |
"mobile": false, | |
"platform": "Windows" | |
})); | |
`; | |
document.documentElement.appendChild(script); | |
script.remove(); | |
} catch (e) { | |
console.error("%cFailed to inject content-play.js!", "color: #ff0000;font-size:24px", e); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment