Skip to content

ilytobias/CMSP-Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

CMSP Hack

Este bookmarklet foi projetado para melhorar sua experiência no CMSP. Siga as instruções abaixo para adicionar o hack à sua barra de favoritos para fácil acesso.

Instruções

  1. Arrastar e Soltar:

    • Para instalar o hack do CMSP, clique e segure o link do bookmarklet abaixo.
    • Arraste-o para a sua barra de favoritos e solte para adicioná-lo lá.
  2. Usando o Hack:

    • Quando estiver na plataforma CMSP, basta clicar no favorito na sua barra de favoritos para ativar o hack.

Bookmarklet

javascript:async function getData(){if("https://cmspweb.ip.tv/"!=location.href){let t=JSON.parse(sessionStorage.getItem("cmsp.ip.tv:iptvdashboard:state")).auth.auth_token,e=location.href.split("/task/")[1].split("/")[0];return btoa(t)+"$"+btoa(e)}{let t=document.getElementById("tms-area-body");open(t.childNodes[0].src)}}async function getQuestionData(t,e){const n=await fetch(`https://edusp-api.ip.tv/tms/task/${e}/apply?preview_mode=false`,{headers:{accept:"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9",priority:"u=1, i","sec-ch-ua":'"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-api-key":t,"x-dash-version":"1.1.732"},referrerPolicy:"no-referrer",mode:"cors",credentials:"omit"});return(await n.json()).questions.filter((t=>"info"!==t.type))}function filterQuestions(t){const e={"true-false":[],single:[],multi:[],cloud:[]};return t.forEach((t=>{const{id:n,type:o,options:s,statement:i}=t;e[o].push({id:n,options:s,statement:i})})),e}async function getAnswerTrueFalse(t,e,n){const o={accept:"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","content-type":"application/json",priority:"u=1, i","sec-ch-ua":'"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-api-key":e,"x-dash-version":"1.1.732"},s={};if(t.hasOwnProperty("true-false"))for(const e of t["true-false"]){const{id:t,options:i}=e,a=`https://edusp-api.ip.tv/tms/task/${n}/question/${t}/correct`,c={answer:{answer:{}}};for(const t in i)i.hasOwnProperty(t)&&(c.answer.answer[t]=!0);const r=await fetch(a,{method:"POST",headers:o,body:JSON.stringify(c)}),p=(await r.json()).comment;s[t]=p}return s}async function getAnswerCloud(t,e,n){const o={accept:"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","content-type":"application/json",priority:"u=1, i","sec-ch-ua":'"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-api-key":e,"x-dash-version":"1.1.732"},s={};if(t.hasOwnProperty("cloud"))for(const e of t.cloud){const{id:t,options:i}=e,a=`https://edusp-api.ip.tv/tms/task/${n}/question/${t}/correct`,c=i.words,r=c[Math.floor(Math.random()*c.length)],p=await fetch(a,{method:"POST",headers:o,body:JSON.stringify({answer:{answer:[r]}})}),d=(await p.json()).comment;s[t]=d}return s}async function getAnswerSingle(t,e,n){const o={accept:"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","content-type":"application/json",priority:"u=1, i","sec-ch-ua":'"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-api-key":e,"x-dash-version":"1.1.732"},s={};if(t.hasOwnProperty("single"))for(const e of t.single){const{id:t,options:i}=e,a=`https://edusp-api.ip.tv/tms/task/${n}/question/${t}/correct`,c={answer:{}};for(const t in i){c.answer[t]=!0;break}const r=await fetch(a,{method:"POST",headers:o,body:JSON.stringify({answer:c})}),p=(await r.json()).comment;s[t]=p}return s}async function getAnswerMulti(t,e,n){const o={accept:"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","content-type":"application/json",priority:"u=1, i","sec-ch-ua":'"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-site","x-api-key":e,"x-dash-version":"1.1.732"},s={};if(t.hasOwnProperty("multi"))for(const e of t.multi){const{id:t,options:i}=e,a=`https://edusp-api.ip.tv/tms/task/${n}/question/${t}/correct`,c={answer:{}};for(const t in i)c.answer[t]=!0;const r=await fetch(a,{method:"POST",headers:o,body:JSON.stringify({answer:c})}),p=(await r.json()).comment;s[t]=p}return s}function stripHtmlTags(t){return t.replace(/<\/?[^>]+(>|$)/g,"")}function injectAnswers(t){const e=document.childNodes[1];for(const[n,o]of Object.entries(t)){const t=Array.from(e.querySelectorAll(".ql-editor")).find((t=>t.innerHTML.includes(n)));if(t){const e=document.createElement("div");e.className="answer",e.innerHTML=`<p>${o}</p>`,t.parentNode.insertBefore(e,t.nextSibling)}}}function createNotification(){const t=document.createElement("div");t.id="notification",t.className="notification",t.innerHTML='\n        <div class="notification-content">\n            <span id="close-btn" class="close-btn">&times;</span>\n            <p>Injected answers!</p>\n            <div id="progress-bar" class="progress-bar"><div></div></div>\n        </div>\n    ',document.body.appendChild(t);const e=document.createElement("style");e.innerHTML="\n        .notification {\n            position: fixed;\n            bottom: 20px;\n            right: -320px;\n            background-color: #333;\n            color: #fff;\n            padding: 10px;\n            border-radius: 10px;\n            box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n            display: none;\n            z-index: 1000;\n            width: 320px;\n            height: 60px;\n            transition: right 0.5s ease;\n        }\n        .notification-content {\n            position: relative;\n            height: 100%;\n        }\n        .close-btn {\n            position: absolute;\n            top: 5px;\n            right: 10px;\n            cursor: pointer;\n            font-size: 20px;\n        }\n        .notification-content p {\n            margin: 0;\n            padding-top: 0;\n        }\n        .progress-bar {\n            position: absolute;\n            bottom: 5px;\n            left: 50%;\n            transform: translateX(-50%);\n            height: 5px;\n            background-color: #555;\n            border-radius: 5px;\n            width: 90%;\n            overflow: hidden;\n        }\n        .progress-bar div {\n            height: 100%;\n            background-color: #bbb;\n            width: 100%;\n            animation: progress 5s linear forwards;\n        }\n        @keyframes progress {\n            from {\n                width: 100%;\n            }\n            to {\n                width: 0;\n            }\n        }\n    ",document.head.appendChild(e)}function showNotification(){const t=document.getElementById("notification"),e=document.getElementById("progress-bar"),n=document.getElementById("close-btn");t.style.display="block",setTimeout((()=>{t.style.right="20px"}),10),e.innerHTML="<div></div>",n.onclick=function(){t.style.right="-300px",setTimeout((()=>{t.style.display="none"}),500)},setTimeout((()=>{t.style.right="-300px",setTimeout((()=>{t.style.display="none"}),500)}),5e3)}(async()=>{const t=await getData(),[e,n]=t.split("$"),o=atob(e),s=atob(n);let i=await getQuestionData(o,s);i=filterQuestions(i);let a=await getAnswerTrueFalse(i,o,s),c=await getAnswerCloud(i,o,s),r=await getAnswerSingle(i,o,s),p=await getAnswerMulti(i,o,s);a=Object.fromEntries(Object.entries(a).map((([t,e])=>[t,stripHtmlTags(e)]))),c=Object.fromEntries(Object.entries(c).map((([t,e])=>[t,stripHtmlTags(e)]))),r=Object.fromEntries(Object.entries(r).map((([t,e])=>[t,stripHtmlTags(e)]))),p=Object.fromEntries(Object.entries(p).map((([t,e])=>[t,stripHtmlTags(e)])));const d={...a,...c,...r,...p},l={};for(const[t,e]of Object.entries(d))for(const n in i)if(i.hasOwnProperty(n)){const o=i[n].find((e=>e.id===parseInt(t)));if(o){l[o.statement]=e;break}}injectAnswers(l),createNotification(),showNotification()})();

Credit

thank u @flowingsalt he made the whole hack. 🫶

obrigado @flowingsalt ele fez todo o hack. 🫶

About

script de hack para o site sp CMSP WEB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published