Kahoot Namerator and Name Length Bypass

Bypasses kahoot nickname generator as well as the maximum name length

当前为 2023-05-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Kahoot Namerator and Name Length Bypass
  3. // @author slither
  4. // @version 2.2.0
  5. // @license MIT
  6. // @description Bypasses kahoot nickname generator as well as the maximum name length
  7. // @match https://kahoot.it/*
  8. // @grant none
  9. // @run-at document-start
  10. // @namespace https://greasyfork.org/users/964173
  11. // ==/UserScript==
  12.  
  13. let nick = "";
  14.  
  15. const nativeSend = XMLHttpRequest.prototype.send;
  16. XMLHttpRequest.prototype.send = function() {
  17. const oldCallback = this.onreadystatechange;
  18.  
  19. this.onreadystatechange = function() {
  20. if (this.readyState === 4) {
  21. try {
  22. const response = JSON.parse(this.responseText);
  23.  
  24. if (response.namerator === true) {
  25. response.namerator = false;
  26. alert("Namerator Bypassed!");
  27. }
  28.  
  29. Object.defineProperty(this, "responseText",{
  30. writable: false,
  31. configurable: true,
  32. value: JSON.stringify(response)
  33. });
  34. } catch (e) {
  35. console.error(e);
  36. }
  37. }
  38.  
  39. if (oldCallback)
  40. return oldCallback.apply(this, arguments);
  41. };
  42.  
  43. return nativeSend.apply(this, arguments);
  44. };
  45.  
  46. const nativeWebSocket = window.WebSocket;
  47. window.WebSocket = function() {
  48. const ws = new nativeWebSocket(...arguments);
  49. const nativeSend = ws.send;
  50.  
  51. ws.send = function() {
  52. const interceptedMessage = JSON.parse(arguments[0]);
  53.  
  54. if (interceptedMessage[0] && interceptedMessage[0].data) {
  55. if (interceptedMessage[0].content && JSON.parse(interceptedMessage[0].data.content).usingNamerator === false)
  56. interceptedMessage[0].data.content = JSON.stringify({...JSON.parse(interceptedMessage[0].data.content), usingNamerator: true});
  57.  
  58. if (nick && interceptedMessage[0].data.name) {
  59. interceptedMessage[0].data.name = nick;
  60. nick = "";
  61. }
  62. }
  63.  
  64. return nativeSend.apply(this, [JSON.stringify(interceptedMessage)]);
  65. };
  66.  
  67. return ws;
  68. };
  69.  
  70. const nativePushState = history.pushState;
  71. history.pushState = function() {
  72. const ret = nativePushState.apply(history, arguments);
  73.  
  74. if (location.href.includes("kahoot.it/join")) {
  75. const observer = new MutationObserver(function() {
  76. if (document.getElementById("nickname")) {
  77. const nickname = document.getElementById("nickname");
  78. nickname.removeAttribute("maxlength");
  79.  
  80. document.querySelector("button").addEventListener("click", function() {
  81. nick = nickname.value;
  82. if (nick.length > 15)
  83. nickname[Object.keys(nickname).find(v => v.includes("__reactProps"))].onChange({target: {value: "Limit Bypassed!"}});
  84. });
  85.  
  86. observer.disconnect();
  87. }
  88. });
  89.  
  90. observer.observe(document.body, {
  91. childList: true,
  92. subtree: true
  93. });
  94. }
  95.  
  96. return ret;
  97. };