MooMoo.io Anti-Kick

Anti-kick for MooMoo.io

Bu script direkt olarak kurulamaz. Başka scriptler için bir kütüphanedir ve meta yönergeleri içerir // @require https://update.greasyfork.org/scripts/474034/1271161/MooMooio%20Anti-Kick.js

  1. // ==UserScript==
  2. // @name MooMoo.io Anti-Kick
  3. // @namespace https://greasyfork.org/users/1064285-vcrazy-gaming
  4. // @version 1
  5. // @description Prevent Getting Kicked From MooMoo.io
  6. // @author _VcrazY_
  7. // @match *://*/*
  8. // @icon data:image/webp;base64,UklGRi4CAABXRUJQVlA4WAoAAAAQAAAAHwAAHwAAQUxQSEcBAAANkCvbtmlb4xjXtm9k27azWze0bUWIbNvP72Wv3h/Ytm1jH58z9x9ExARAd32XdF/Tv9+vnL79DaTFpXoyQKDnE8tbWtKFy4XdDDSL3Bvs6u9qY+0V4m5uAO3Tmzd3NYibE/7IoLtj5bS6vAHQ3uiAqqDVB6Syw/NQFffLQPpr/CbUlkhA+r1GALUelaDV03+mhn8A6qGJlyqVMjLJYCMAaSzoY17dAWxNWbByOC+D9w8WOCFnGVjJ2LB+zcAEbFq+lYHDCv8fwHDZ+CMEPhpxWXgrAJ6Y6dHJHvKAa5aWdP/OAXj7zJ/u+RsAv04VcskOQfXAPoLq9YIa5BwW0vxvhPqPFSt6JMPQfOJsp55u/9aeayGbPD+jp1PfN2jLHGs4Gqzdq1To+jHVrcjHXMIFZL8/3T6zDcK9Y6/trYyFzLvPDyUcaAsAVlA4IMAAAADwBQCdASogACAAPt1kq0+opaQiKAqpEBuJbAC2+tqOAv/yo3pecQ1SQ38K5j1X4+D/7cw7/qVYgAD+8qOSIfqkS9a1lb6tEUU3vveBinOVdjPzUwth1t1Chw7D4CrZ5Naml0zrhLXC7P6Pzg2S9IRetxpXmem9ECxakv1JjYillR67TTKNMrgrs0z8UscOT49KzAEg5Vfk0ydfc/guvgT1t0NC16MURvoeRfej7JgO/Zj1yQsXi7520/2kDgfHgAA=
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. // Check the current URL
  14. if (window.location.hostname.includes("moomoo.io") ||
  15. window.location.hostname.includes("sandbox.moomoo.io") ||
  16. window.location.hostname.includes("dev.moomoo.io")) {
  17. // The code will only run on the specified domains
  18.  
  19. (() => {
  20. "use strict";
  21.  
  22. const PACKET_LIMITS = {
  23. PER_MINUTE: 1000,
  24. PER_SECOND: 80,
  25. };
  26.  
  27. const IGNORED_PACKET_TYPES = new Set(["pp", "rmd"]);
  28. const IGNORED_QUEUE_PACKETS = new Set(["5", "c", "33", "2", "7", "13c"]);
  29.  
  30. /**
  31. * Class to manage anti-kick functionality
  32. */
  33. class AntiKick {
  34. constructor() {
  35. this.resetRateLimit();
  36. }
  37.  
  38. /**
  39. * Reset packet rate limits
  40. */
  41. resetRateLimit() {
  42. // Packet history
  43. this.packetHistory = new Map();
  44. // Packet queue
  45. this.packetQueue = [];
  46. // Last packet sent time
  47. this.lastSent = Date.now();
  48. }
  49.  
  50. /**
  51. * Check if the packet is rate-limited
  52. * @param {ArrayBuffer} data - Binary packet data
  53. * @returns {boolean} True if rate-limited, false otherwise
  54. */
  55. isRateLimited(data) {
  56. const binaryData = new Uint8Array(data);
  57.  
  58. if (Date.now() - this.lastSent > PACKET_LIMITS.PER_MINUTE) {
  59. this.resetRateLimit();
  60. }
  61.  
  62. const packetType = binaryData[0];
  63.  
  64. if (!IGNORED_PACKET_TYPES.has(packetType)) {
  65. if (this.packetHistory.has(packetType) &&
  66. (("2" === packetType || "33" === packetType) && this.packetHistory.get(packetType)[0] === binaryData[1])) {
  67. return true;
  68. }
  69.  
  70. if (this.packetQueue.length > PACKET_LIMITS.PER_SECOND) {
  71. return IGNORED_QUEUE_PACKETS.has(packetType) || this.packetQueue.push(data);
  72. }
  73.  
  74. this.packetQueue.push({ type: packetType, data: binaryData.slice(1) });
  75. this.packetHistory.set(packetType, binaryData.slice(1));
  76. }
  77.  
  78. return false;
  79. }
  80. }
  81.  
  82. const antiKick = new AntiKick();
  83.  
  84. // Override the send method of WebSocket
  85. WebSocket.prototype.send = new Proxy(WebSocket.prototype.send, {
  86. /**
  87. * Apply the send method override
  88. * @param {function} target - WebSocket method to override
  89. * @param {object} thisArg - The WebSocket object
  90. * @param {ArrayBuffer} binary - Binary data to send
  91. * @returns {*} Result of the original send method
  92. */
  93. apply(target, thisArg, binary) {
  94. if (!thisArg.messageListenerSet) {
  95. // Listen for messages to process the packet queue
  96. thisArg.addEventListener("message", (event) => {
  97. if (antiKick.packetQueue.length) {
  98. const binaryData = new Uint8Array(event.data);
  99. if (binaryData[0] === 51) {
  100. thisArg.send(antiKick.packetQueue[0]);
  101. antiKick.packetQueue.shift();
  102. }
  103. }
  104. });
  105. thisArg.messageListenerSet = true;
  106. }
  107.  
  108. // Send the packet only if it's not rate-limited
  109. if (!antiKick.isRateLimited(binary)) {
  110. return Reflect.apply(target, thisArg, binary);
  111. }
  112. },
  113. });
  114. })();
  115. }