Diff is too large to be shown
wavedev / Game Badge Spoofer
Last active 2 months ago
Spoof your stats in game badge thingy.
wavedev revised this gist 2 months ago · e5291b6
1 file changed, 268 insertions, 69 deletions
wavedev revised this gist 2 months ago · 2b44f77
1 file changed, 119 insertions
| @@ -0,0 +1,119 @@ | |||
| 1 | + | # Game Badge Spoofer | |
| 2 | + | ||
| 3 | + | ||
| 4 | + | ## How to use | |
| 5 | + | ||
| 6 | + | - Crtl+shift+i to open Chrome Devtools. | |
| 7 | + | - Go to "Console" | |
| 8 | + | - type "allow pasting" | |
| 9 | + | - enter (ignore errors) | |
| 10 | + | - copy and paste the snippet | |
| 11 | + | - enter | |
| 12 | + | - profit | |
| 13 | + | ||
| 14 | + | ## Snippet | |
| 15 | + | ||
| 16 | + | ```js | |
| 17 | + | const cache = {}; | |
| 18 | + | if (typeof DiscordNative === 'undefined') | |
| 19 | + | console.log( | |
| 20 | + | 'Browser is not supported. Please use Discord client :wilted_rose:.', | |
| 21 | + | ); | |
| 22 | + | else { | |
| 23 | + | const req = webpackChunkdiscord_app.push([[Symbol()], {}, (r) => r]); | |
| 24 | + | webpackChunkdiscord_app.pop(); | |
| 25 | + | const mods = Object.values(req.c), | |
| 26 | + | api = mods.find((x) => x?.exports?.Bo?.get).exports.Bo; | |
| 27 | + | api.get('https://discord.com/api/v10/applications/detectable') | |
| 28 | + | .then(async ({ body: apps }) => { | |
| 29 | + | while (Object.keys(cache).length < Math.min(100, apps.length)) { | |
| 30 | + | const a = apps[(Math.random() * apps.length) | 0]; | |
| 31 | + | if (a?.id) cache[a.id] = a; | |
| 32 | + | } | |
| 33 | + | const ids = Object.keys(cache); | |
| 34 | + | let i = 0, | |
| 35 | + | t; | |
| 36 | + | async function spoof() { | |
| 37 | + | const s = window.__rpcSpooferState; | |
| 38 | + | if (s) { | |
| 39 | + | s.store.getRunningGames = s.getGames; | |
| 40 | + | s.store.getGameForPID = s.getPID; | |
| 41 | + | s.dispatcher.dispatch({ | |
| 42 | + | type: 'RUNNING_GAMES_CHANGE', | |
| 43 | + | removed: [s.game], | |
| 44 | + | added: [], | |
| 45 | + | games: [], | |
| 46 | + | }); | |
| 47 | + | delete window.__rpcSpooferState; | |
| 48 | + | } | |
| 49 | + | if (i >= ids.length) | |
| 50 | + | return ( | |
| 51 | + | clearInterval(t), | |
| 52 | + | console.log( | |
| 53 | + | 'All cached applications have been spoofed.', | |
| 54 | + | ) | |
| 55 | + | ); | |
| 56 | + | try { | |
| 57 | + | const id = ids[i], | |
| 58 | + | { body } = await api.get({ | |
| 59 | + | url: `/applications/public?application_ids=${id}`, | |
| 60 | + | }), | |
| 61 | + | a = body[0]; | |
| 62 | + | if (!a) | |
| 63 | + | return ( | |
| 64 | + | i++, | |
| 65 | + | console.error(`Cannot fetch application ${id}`) | |
| 66 | + | ); | |
| 67 | + | const store = mods.find( | |
| 68 | + | (x) => x?.exports?.Ay?.getRunningGames, | |
| 69 | + | ).exports.Ay, | |
| 70 | + | dispatcher = mods.find( | |
| 71 | + | (x) => x?.exports?.h?.__proto__?.flushWaitQueue, | |
| 72 | + | ).exports.h, | |
| 73 | + | pid = (Math.random() * 3e4 + 1e3) | 0; | |
| 74 | + | const exe = | |
| 75 | + | a.executables | |
| 76 | + | ?.find((x) => x.os === 'win32') | |
| 77 | + | ?.name?.replace('>', '') || | |
| 78 | + | a.name.replace(/[\/\\:*?"<>|]/g, ''); | |
| 79 | + | const game = { | |
| 80 | + | cmdLine: `C:\\Program Files\\${a.name}\\${exe}`, | |
| 81 | + | exeName: exe, | |
| 82 | + | exePath: `c:/program files/${a.name.toLowerCase()}/${exe}`, | |
| 83 | + | hidden: false, | |
| 84 | + | isLauncher: false, | |
| 85 | + | id, | |
| 86 | + | name: a.name, | |
| 87 | + | pid, | |
| 88 | + | pidPath: [pid], | |
| 89 | + | processName: a.name, | |
| 90 | + | start: Date.now(), | |
| 91 | + | }, | |
| 92 | + | real = store.getRunningGames(); | |
| 93 | + | window.__rpcSpooferState = { | |
| 94 | + | store, | |
| 95 | + | dispatcher, | |
| 96 | + | game, | |
| 97 | + | getGames: store.getRunningGames, | |
| 98 | + | getPID: store.getGameForPID, | |
| 99 | + | }; | |
| 100 | + | store.getRunningGames = () => [game]; | |
| 101 | + | store.getGameForPID = (p) => (p === pid ? game : void 0); | |
| 102 | + | dispatcher.dispatch({ | |
| 103 | + | type: 'RUNNING_GAMES_CHANGE', | |
| 104 | + | removed: real, | |
| 105 | + | added: [game], | |
| 106 | + | games: [game], | |
| 107 | + | }); | |
| 108 | + | console.log(`(${++i}) Playing: ${a.name} (${id})`); | |
| 109 | + | } catch (e) { | |
| 110 | + | console.error('Spoof error:', e); | |
| 111 | + | i++; | |
| 112 | + | } | |
| 113 | + | } | |
| 114 | + | spoof(); | |
| 115 | + | t = setInterval(spoof, ((Math.random() * 2) | 0) + 1 * 61000); | |
| 116 | + | }) | |
| 117 | + | .catch(console.error); | |
| 118 | + | } | |
| 119 | + | ``` | |