summary refs log tree commit diff
path: root/ReferenceClientProxyImplementation/Resources/Private/Injections/WebSocketDumper.html
blob: 14dc989fed5113a0a50b4fb1562370cee042c6e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<script>
    window.sockets = [];
    var lastBuff = '';
    const nativeWebSocket = window.WebSocket;
    window.WebSocket = function (...args) {
        console.log("Starting new websocket");
        const socket = new nativeWebSocket(...args);
        window.sockets.push(socket);
        if (!args[0].includes('spotify'))
            socket.addEventListener("message", ev => {
                console.log("Dumping message...");
                lastBuff = ev.data;
                var dat = new Uint8Array(lastBuff);
                if (window.toHexString) console.log(window.toHexString(dat));
                var xhr = new XMLHttpRequest;
                xhr.open("POST", "http://localhost:2001/dump/cs", false);
                xhr.send(ev.data);
            });
        console.log("Websocket hooked!", socket);
        return socket;
    };
</script>