Kour.rip

Basic Kour.io exploits/cheat. Feel free to paste it kiddie.

当前为 2024-12-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @license MIT
  3. // @name Kour.rip
  4. // @match *://kour.io/*
  5. // @version 1.0.0
  6. // @author dropout (https://github.com/dropout1337)
  7. // @description Basic Kour.io exploits/cheat. Feel free to paste it kiddie.
  8. // @run-at document-start
  9. // @grant unsafeWindow
  10. // @namespace https://gf.qytechs.cn/users/1390357
  11. // ==/UserScript==
  12.  
  13. const Signatures = {
  14. ping: "f3 07 01 00 00", // Filter
  15. pong: "f3 06 01 01 01", // Filter
  16. anotherPing: "f3 04 e2 03 e3", // Filter
  17.  
  18. createGame: "f3 02 e3 03 ff 07 06", // Create Game / Party (Can be used to change partyId)
  19. updateState: "f3 02 fd 02 f4 03 c8", // Insta-kill
  20. damageTaken: "f3 04 c8 02 f5 15 04", // Invisibility
  21.  
  22. connectStarts: "f3 02 e", // Connect (start)
  23. connectEnds: "f1 1c e8 1c bf 0b 23" // Connect (end)
  24. }
  25.  
  26. class Kour {
  27. constructor() {
  28. // sockets: list of WebSocket
  29. this.sockets = [];
  30.  
  31. // What features you want enabled
  32. this.config = {
  33. Invisible: true,
  34. InstantKill: true
  35. }
  36.  
  37. // Current packet count (not used, just visually)
  38. this.packets = 0;
  39.  
  40. // Hook window.WebSocket
  41. unsafeWindow.WebSocket = class extends WebSocket {
  42. constructor() {
  43. super(...arguments);
  44. this.addEventListener("open", event => {
  45. // Add to this.sockets list.
  46. kourInstance.sockets.push(this);
  47.  
  48. // Hook send/onmessage
  49. kourInstance.hook(this);
  50. });
  51. }
  52. }
  53. }
  54.  
  55. /**
  56. * Converts an array of hexadecimal strings to a human-readable string.
  57. *
  58. * @param {string[]} hexArray - An array of strings, where each string represents a hexadecimal number.
  59. * @returns {string} - A string where each character is derived from the corresponding hexadecimal value.
  60. */
  61. hexArrayToString(hexArray) {
  62. let str = '';
  63.  
  64. for (let i = 0; i < hexArray.length; i++) {
  65. let hex = hexArray[i];
  66. let decimalValue = parseInt(hex, 16);
  67.  
  68. str += String.fromCharCode(decimalValue);
  69. }
  70.  
  71. return str;
  72. }
  73.  
  74. /**
  75. * Hooks into the WebSocket instance to intercept and log WebSocket messages and sends.
  76. *
  77. * @param {WebSocket} socket - The WebSocket instance to hook into.
  78. */
  79. hook(socket) {
  80. console.debug("%c !! ", "background:#7aadff;color:#000", `Intercepted WebSocket (${socket.url})`);
  81.  
  82. const send = socket.send; // Original send function
  83. const onmessage = socket.onmessage; // Original onmessage function
  84.  
  85. socket.onmessage = (event) => {
  86. if (event.data == null) {
  87. return onmessage.call(socket, event);
  88. }
  89.  
  90. this.packets += 1;
  91.  
  92. let hexArray = Array.from(new Uint8Array(event.data)).map(byte => byte.toString(16).padStart(2, '0'));
  93. let uint8Array = new Uint8Array(event.data);
  94. let stringHexArray = hexArray.join(" ");
  95.  
  96. if (stringHexArray == "") return onmessage.call(socket, event);
  97. if (stringHexArray.startsWith(Signatures.ping)) return onmessage.call(socket, event);
  98. if (stringHexArray.startsWith(Signatures.anotherPing)) return onmessage.call(socket, event);
  99. // If the event is a Damage/Shoot event ignore it.
  100. if (stringHexArray.startsWith(Signatures.damageTaken) && this.config.Invisible) {
  101. return;
  102. }
  103.  
  104. console.debug("%c <= ", "background:#FF6A19;color:#000", JSON.stringify({
  105. "hex_array": stringHexArray,
  106. "array": uint8Array,
  107. "base64": btoa(String.fromCharCode.apply(null, new Uint8Array(hexArray.map(hex => parseInt(hex, 16))))),
  108. "string": this.hexArrayToString(hexArray)
  109. }));
  110.  
  111. return onmessage.call(socket, event);
  112. };
  113.  
  114. socket.send = (data) => {
  115. this.packets += 1;
  116.  
  117. let hexArray = Array.from(new Uint8Array(data)).map(byte => byte.toString(16).padStart(2, '0'));
  118. let uint8Array = new Uint8Array(data);
  119. let stringHexArray = hexArray.join(" ");
  120.  
  121. if (stringHexArray == "") return send.call(socket, data);
  122. if (stringHexArray.startsWith(Signatures.pong)) return send.call(socket, data);
  123.  
  124. if (stringHexArray.startsWith(Signatures.createGame)) {
  125. let partyId = this.hexArrayToString(hexArray.slice(7, 13));
  126. console.debug("%c => ", "background:#7F7;color:#000", "Creating game:", partyId);
  127. return send.call(socket, data);
  128. } else if (stringHexArray.startsWith(Signatures.updateState) && this.config.InstantKill) { // Repeat state packets (movement, crouch, jump, shoot, switch weapon), causes the game to send 40 of the same packet. So if we shoot we actually send 40 damage packets instead of 1.
  129. console.debug("%c => ", "background:#7F7;color:#000", "State repeated.");
  130.  
  131. for (let i = 0; i < 40; i++) {
  132. send.call(socket, data);
  133. }
  134.  
  135. return send.call(socket, data);
  136. } else if (stringHexArray.startsWith(Signatures.connectStarts) && stringHexArray.endsWith(Signatures.connectEnds)) {
  137. console.debug("%c => ", "background:#7F7;color:#000", "Connecting to game.", this.hexArrayToString(hexArray));
  138. return send.call(socket, data);
  139. }
  140.  
  141. console.debug("%c => ", "background:#7F7;color:#000", JSON.stringify({
  142. "hex_array": stringHexArray,
  143. "array": uint8Array,
  144. "base64": btoa(String.fromCharCode.apply(null, new Uint8Array(hexArray.map(hex => parseInt(hex, 16))))),
  145. "string": this.hexArrayToString(hexArray)
  146. }));
  147.  
  148. return send.call(socket, data);
  149. };
  150. }
  151.  
  152. /**
  153. * Draws the watermark onto the unity-canvas.
  154. */
  155. watermark() {
  156. let overlayCanvas = document.createElement("canvas");
  157. let unityContainer = document.getElementById("unity-container");
  158. overlayCanvas.width = unityContainer.clientWidth;
  159. overlayCanvas.height = unityContainer.clientHeight;
  160. overlayCanvas.style.position = "absolute";
  161. overlayCanvas.style.top = "50%";
  162. overlayCanvas.style.left = "50%";
  163. overlayCanvas.style.transform = "translate(-50%, -50%)";
  164. overlayCanvas.style.pointerEvents = "none";
  165. unityContainer.appendChild(overlayCanvas);
  166. let ctx = overlayCanvas.getContext("2d");
  167. ctx.font = "15px monospace";
  168. ctx.textAlign = "center";
  169. ctx.textBaseline = "middle";
  170. let opacity = 0;
  171. let delta = 0.03;
  172. function animate() {
  173. let lines = [`kour.rip (${kourInstance.packets})`];
  174.  
  175. if (kourInstance.config.Invisible) {
  176. lines.push("<c>✔ Invisible")
  177. } else {
  178. lines.push("<c>✖ Invisible")
  179. }
  180.  
  181. if (kourInstance.config.InstantKill) {
  182. lines.push("<c>✔ Instant-Kill")
  183. } else {
  184. lines.push("<c>✖ Instant-Kill")
  185. }
  186.  
  187. let lineHeight = 20;
  188. let startY = overlayCanvas.height / 2 - ((lines.length - 1) * lineHeight) / 2 + 60;
  189. let centerX = overlayCanvas.width / 2;
  190. ctx.clearRect(0, 0, overlayCanvas.width, overlayCanvas.height);
  191. opacity += delta;
  192. if (opacity > 1) {
  193. opacity = 1;
  194. delta = -delta;
  195. } else if (opacity < 0) {
  196. opacity = 0;
  197. delta = -delta;
  198. }
  199. ctx.globalAlpha = opacity;
  200. lines.forEach((line, index) => {
  201. if (line.includes("<c>")) {
  202. line = line.replace("<c>", "");
  203. ctx.fillStyle = "#F8CEFF";
  204. } else {
  205. ctx.fillStyle = "white";
  206. }
  207. ctx.fillText(line, centerX, startY + index * lineHeight);
  208. });
  209. ctx.globalAlpha = 1;
  210. requestAnimationFrame(animate);
  211. }
  212. animate();
  213. }
  214. }
  215.  
  216. class Message {
  217. constructor() {
  218. this.msgArray = [243, 2, 253, 3, 246, 3, 1, 244, 34, 245, 23, 1, 7];
  219. this.sockets = kourInstance.sockets;
  220. }
  221.  
  222. /**
  223. * Converts a given string into an array of decimal ASCII codes.
  224. *
  225. * @param {string} text - The input text to be encoded.
  226. * @returns {number[]} An array of decimal ASCII codes representing each character in the input text.
  227. */
  228. encodeDec(text) {
  229. const decArray = [];
  230.  
  231. for (let i = 0; i < text.length; i++) {
  232. decArray.push(text.charCodeAt(i));
  233. }
  234.  
  235. return decArray;
  236. }
  237.  
  238. /**
  239. * Sends a message through the last socket in the sockets array.
  240. *
  241. * @param {string} msg - The message to be sent.
  242. */
  243. send(msg) {
  244. let socket = this.sockets[this.sockets.length - 1];
  245.  
  246. let msgArray = [...this.msgArray];
  247.  
  248. let savedlength = msg.length;
  249. let amount = Math.floor(savedlength/128);
  250. let strLength = [];
  251. if (savedlength > 128) {
  252. strLength.push(128 + (savedlength % 128));
  253. strLength.push(amount);
  254. } else {
  255. strLength.push(savedlength);
  256. }
  257.  
  258. msgArray.push(...strLength);
  259. msgArray.push(...this.encodeDec(msg));
  260.  
  261. socket.send(new Uint8Array(msgArray));
  262. }
  263. }
  264.  
  265. const kourInstance = new Kour();
  266. const kourMessager = new Message();
  267.  
  268. unsafeWindow.kourInstance = kourInstance;
  269. unsafeWindow.kourMessager = kourMessager;
  270.  
  271. window.addEventListener("load", kourInstance.watermark);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址