MooMoo.io Script Unpatcher (Any Hack) (All patches, fixes packets)

Rewrites packets to most recent version (e.g. 33 -> f)

  1. // ==UserScript==
  2. // @name MooMoo.io Script Unpatcher (Any Hack) (All patches, fixes packets)
  3. // @namespace http://tampermonkey.net/
  4. // @version 99999999
  5. // @description Rewrites packets to most recent version (e.g. 33 -> f)
  6. // @author JavedPension
  7. // @match *://*.moomoo.io/*
  8. // @require https://greasyfork.org/scripts/423602-msgpack/code/msgpack.js
  9. // @grant none
  10. // @run-at document-start
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. /* How to use
  15.  
  16. Copy and paste the code below to the end of your hack.
  17. This technically will auto-fix all hacks after the first update in 2021.
  18.  
  19. If you do not have msgpack locally referencable, include the `// @require` line in your mod metadata as done above.
  20.  
  21. */
  22.  
  23. const PACKET_MAP = {
  24. // wont have all old packets, since they conflict with some of the new ones, add them yourself if you want to unpatch mods that are that old.
  25. "33": "9",
  26. // "7": "K",
  27. "ch": "6",
  28. "pp": "0",
  29. "13c": "c",
  30.  
  31. // most recent packet changes
  32. "f": "9",
  33. "a": "9",
  34. "d": "F",
  35. "G": "z"
  36. }
  37.  
  38. let originalSend = WebSocket.prototype.send;
  39.  
  40. WebSocket.prototype.send = new Proxy(originalSend, {
  41. apply: ((target, websocket, argsList) => {
  42. let decoded = msgpack.decode(new Uint8Array(argsList[0]));
  43.  
  44. if (PACKET_MAP.hasOwnProperty(decoded[0])) {
  45. decoded[0] = PACKET_MAP[decoded[0]];
  46. }
  47.  
  48. return target.apply(websocket, [msgpack.encode(decoded)]);
  49. })
  50. });