Kahoot Namerator Bypass

Bypasses kahoot nickname generator

当前为 2023-03-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Kahoot Namerator Bypass
  3. // @author slither
  4. // @version 2.0.0
  5. // @license MIT
  6. // @description Bypasses kahoot nickname generator
  7. // @match https://kahoot.it/*
  8. // @grant none
  9. // @run-at document-start
  10. // @namespace https://greasyfork.org/users/964173
  11. // ==/UserScript==
  12.  
  13. const nativeSend = XMLHttpRequest.prototype.send;
  14. XMLHttpRequest.prototype.send = function() {
  15. const oldCallback = this.onreadystatechange;
  16.  
  17. this.onreadystatechange = function() {
  18. if (this.readyState === 4) {
  19. try {
  20. const response = JSON.parse(this.responseText);
  21.  
  22. if (response.namerator === true) {
  23. response.namerator = false;
  24. alert("Namerator Bypassed!");
  25. }
  26.  
  27. Object.defineProperty(this, "responseText",{
  28. writable: false,
  29. configurable: true,
  30. value: JSON.stringify(response)
  31. });
  32. } catch (e) {
  33. console.error(e);
  34. }
  35. }
  36.  
  37. if (oldCallback)
  38. return oldCallback.apply(this, arguments);
  39. };
  40.  
  41. return nativeSend.apply(this, arguments);
  42. };
  43.  
  44. const nativeWebSocket = window.WebSocket;
  45. window.WebSocket = function() {
  46. const ws = new nativeWebSocket(...arguments);
  47. const nativeSend = ws.send;
  48.  
  49. ws.send = function() {
  50. const interceptedMessage = JSON.parse(arguments[0]);
  51.  
  52. if (interceptedMessage[0] && interceptedMessage[0].data && interceptedMessage[0].data.content === "{\"usingNamerator\":false}")
  53. interceptedMessage[0].data.content = "{\"usingNamerator\":true}";
  54.  
  55. return nativeSend.apply(this, [JSON.stringify(interceptedMessage)]);
  56. };
  57.  
  58. return ws;
  59. };