Created
April 4, 2024 00:11
-
-
Save diamondburned/edd08950d0e1579b90b7c506a763e0e0 to your computer and use it in GitHub Desktop.
WS hack
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 WS hack | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over Discord! | |
// @author You | |
// @match https://discord.com/* | |
// @grant none | |
// @run-at document-start | |
// @require https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.11/pako.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function newInflator() { | |
return new pako.Inflate({to: "string", raw: false}); | |
}; | |
const nativeWebSocket = WebSocket.prototype.constructor; | |
WebSocket.prototype.constructor = function(url, ...args) { | |
console.log("INTERJECTED WS: " + url); | |
const socket = new nativeWebSocket(url, ...args); | |
if (!url.includes("gateway.discord.gg")) return socket; | |
let inflator = newInflator(); | |
socket.addEventListener("message", (ev) => { | |
inflator.push(ev.data, 2); | |
console.log("EVENT", JSON.parse(inflator.result)); | |
}); | |
return socket; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't work anymore and will need some fixing.