CEOofAfrica

Updated Quizziz Answer Hack

Jul 21st, 2020 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var x = document.createElement("link");
  2. x.rel = 'stylesheet';
  3. x.type = 'text/css'
  4. x.href = "https://cdn.jsdelivr.net/gh/EastArctica/JS-Plugins@master/Un-Released/Kahoot/KahootModal.css"
  5. document.head.appendChild(x);
  6.  
  7. var xhttp = new XMLHttpRequest()
  8. var URL = window.location.href
  9. var found = URL.search("https://quizizz.com/join/game/");
  10. if (found == 0) { found = true }
  11. if (found) {
  12.     var Modal = document.createElement("div")
  13.     Modal.id = "mainModal"
  14.     Modal.className = "mainModal"
  15.     Modal.style = "position: fixed; z-index: 2147483647; left: 0px; top: 0px; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.4); display: none;"
  16.     var ModalContent = document.createElement("div")
  17.     ModalContent.className = "modal-content"
  18.     ModalContent.id = "ModalContent"
  19.     var Close = document.createElement("span")
  20.     Close.className = "close"
  21.     Close.innerHTML = "×"
  22.     var btn = document.createElement("button")
  23.     btn.id = "ModalButton"
  24.     btn.innerText = "View Answers"
  25.     btn.onclick = function() {
  26.         Modal.style.display = "block";
  27.     }
  28.     Close.onclick = function() {
  29.         Modal.style.display = "none";
  30.     }
  31.     window.onclick = function(event) {
  32.         if (event.target == Modal) {
  33.             Modal.style.display = "none";
  34.         }
  35.     }
  36.     document.getElementsByClassName("actions-container")[0].appendChild(btn)
  37.     ModalContent.appendChild(Close)
  38.     Modal.appendChild(ModalContent)
  39.     document.getElementsByClassName("root-bootstrapper-container")[0].prepend(Modal)
  40.     if (!window.idiidk) {
  41.         window.idiidk = function() {
  42.             const offset = 33;
  43.             class Encoding {
  44.                 static encode(t, e, o = 2) {
  45.                     const s = this.encodeRaw(e, !0);
  46.                     return `${s}${this.encodeRaw(t,!1,e)}${String.fromCharCode(33+s.length)}${o}`
  47.                 }
  48.                 static encodeRaw(t, e, o = "quizizz.com") {
  49.                     let s = 0;
  50.                     s = e ? o.charCodeAt(0) : o.charCodeAt(0) + o.charCodeAt(o.length - 1);
  51.                     const r = [];
  52.                     for (let o = 0; o < t.length; o++) {
  53.                         const n = t[o].charCodeAt(0),
  54.                             c = e ? this.safeAdd(n, s) : this.addOffset(n, s, o, 2);
  55.                         r.push(String.fromCharCode(c))
  56.                     }
  57.                     return r.join("")
  58.                 }
  59.                 static decode(t, e = !1) {
  60.                     if (e) {
  61.                         const e = this.extractHeader(t);
  62.                         return this.decodeRaw(e, !0)
  63.                     } {
  64.                         const e = this.decode(this.extractHeader(t), !0),
  65.                             o = this.extractData(t);
  66.                         return this.decodeRaw(o, !1, e)
  67.                     }
  68.                 }
  69.                 static decodeRaw(t, e, o = "quizizz.com") {
  70.                     const s = this.extractVersion(t);
  71.                     let r = 0;
  72.                     r = e ? o.charCodeAt(0) : o.charCodeAt(0) + o.charCodeAt(o.length - 1), r = -r;
  73.                     const n = [];
  74.                     for (let o = 0; o < t.length; o++) {
  75.                         const c = t[o].charCodeAt(0),
  76.                             a = e ? this.safeAdd(c, r) : this.addOffset(c, r, o, s);
  77.                         n.push(String.fromCharCode(a))
  78.                     }
  79.                     return n.join("")
  80.                 }
  81.                 static addOffset(t, e, o, s) {
  82.                     return 2 === s ? this.verifyCharCode(t) ? this.safeAdd(t, o % 2 == 0 ? e : -e) : t : this.safeAdd(t, o % 2 == 0 ? e : -e)
  83.                 }
  84.                 static extractData(t) {
  85.                     const e = t.charCodeAt(t.length - 2) - 33;
  86.                     return t.slice(e, -2)
  87.                 }
  88.                 static extractHeader(t) {
  89.                     const e = t.charCodeAt(t.length - 2) - 33;
  90.                     return t.slice(0, e)
  91.                 }
  92.                 static extractVersion(t) {
  93.                     if ("string" == typeof t && t[t.length - 1]) {
  94.                         const e = parseInt(t[t.length - 1], 10);
  95.                         if (!isNaN(e)) return e
  96.                     }
  97.                     return null
  98.                 }
  99.                 static safeAdd(t, e) {
  100.                     const o = t + e;
  101.                     return o > 65535 ? o - 65535 + 0 - 1 : o < 0 ? 65535 - (0 - o) + 1 : o
  102.                 }
  103.                 static verifyCharCode(t) {
  104.                     if ("number" == typeof t) return !(t >= 55296 && t <= 56319 || t >= 56320 && t <= 57343)
  105.                 }
  106.                 static generateIdentifier(t, e, o = 1, s = (new Date).getTime()) {
  107.                     let r = e;
  108.                     return "function" == typeof e && (r = e()), "".concat(t, ".").concat(r, "|").concat(o, ".").concat(s)
  109.                 }
  110.             }
  111.             var URL = window.location.href
  112.             var GameType = URL.slice(URL.search("gameType=")+9, URL.length)
  113.             const prevConx = localStorage.getItem("previousContext"),
  114.                 parsedConx = JSON.parse(prevConx),
  115.                 encodedRoomHash = parsedConx.game.roomHash,
  116.                 roomHash = Encoding.decode(encodedRoomHash.split("-")[1]),
  117.                 data = {
  118.                     roomHash: roomHash,
  119.                     type: GameType
  120.                 };
  121.             fetch("https://game.quizizz.com/play-api/v3/getQuestions", {
  122.                 method: "POST",
  123.                 headers: {
  124.                     "Content-Type": "application/json"
  125.                 },
  126.                 body: JSON.stringify(data)
  127.             }).then(t => t.json()).then(t => {
  128.                 let e = 0;
  129.                 for (const o of Object.keys(t.questions)) {
  130.                     e++;
  131.                     const s = t.questions[o],
  132.                         r = s.structure.kind,
  133.                         n = s.structure.answer,
  134.                         c = Encoding.decode(n);
  135.                         ModalContent.insertAdjacentHTML( 'beforeend', `<b>Question: </b>`)
  136.                         ModalContent.insertAdjacentHTML( 'beforeend', `${s.structure.query.text}<br>`)
  137.                         if (c[0] == "[") {
  138.                             newc = c.slice(1, c.length-1)
  139.                             newc = newc.split(",");
  140.                             // c has been turned into an array :)
  141.                             ModalContent.insertAdjacentHTML( 'beforeend', `<b>Answers:</b><br>`)
  142.                             for (let i = 0; i < newc.length; i++) {
  143.                                 ModalContent.insertAdjacentHTML( 'beforeend', `${s.structure.options[Number(newc[i])].text || s.structure.options[Number(newc[i])].media[0].url} <br>`)
  144.                             }
  145.                             ModalContent.insertAdjacentHTML( 'beforeend', `<br>`)
  146.                         } else {
  147.                             //console.log(s.structure)
  148.                             ModalContent.insertAdjacentHTML( 'beforeend', `<b>Answer:</b> ${s.structure.options[c].text || s.structure.options[c].media[0].url} <br><br>`)
  149.                         }
  150.                 }
  151.             });
  152.         }
  153.         window.idiidk();
  154.     } else {
  155.         window.idiidk();
  156.     }
  157. }
Add Comment
Please, Sign In to add comment