-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathKhanware.js
More file actions
238 lines (204 loc) · 12.7 KB
/
Khanware.js
File metadata and controls
238 lines (204 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
const ver = "V3.9.7";
let isDev = false;
let repoPath;
const availableCDNs = [
`https://raw.githubusercontent.com/Niximkk/Khanware/refs/heads/${isDev ? "dev" : "main"}/`,
`https://cdn.jsdelivr.net/gh/niximkk/khanware@${isDev ? "dev" : "master"}/`,
`https://cdn.statically.io/gh/Niximkk/Khanware/refs/heads/${isDev ? "dev" : "main"}/`
];
let device = {
mobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone|Mobile|Tablet|Kindle|Silk|PlayBook|BB10/i.test(navigator.userAgent),
apple: /iPhone|iPad|iPod|Macintosh|Mac OS X/i.test(navigator.userAgent),
language: navigator.language.split('-')[0]
};
/* User */
let user = {
username: "Username",
nickname: "Nickname",
UID: 0
}
let loadedPlugins = [];
/* Elements */
const unloader = document.createElement('unloader');
const dropdownMenu = document.createElement('dropDownMenu');
const watermark = document.createElement('watermark');
const statsPanel = document.createElement('statsPanel');
const splashScreen = document.createElement('splashScreen');
let KWSection;
/* Globals */
window.features = {
questionSpoof: true,
videoSpoof: true,
showAnswers: false,
autoAnswer: false,
workerBees: false,
customBanner: false,
nextRecomendation: false,
repeatQuestion: false,
minuteFarmer: false,
rgbLogo: false
};
window.featureConfigs = {
autoAnswerDelay: 3,
customUsername: "",
customPfp: ""
};
/* Localization */
let translations = {};
function t(key) { return translations[device.language]?.[key] || translations['en']?.[key] || key; }
/* Security */
document.addEventListener('contextmenu', (e) => !window.disableSecurity && e.preventDefault());
document.addEventListener('keydown', (e) => { if (!window.disableSecurity && (e.key === 'F12' || (e.ctrlKey && e.shiftKey && ['I', 'C', 'J'].includes(e.key)))) { e.preventDefault(); } });
console.log(Object.defineProperties(new Error, { toString: {value() {(new Error).stack.includes('toString@') && location.reload();}}, message: {get() {location.reload();}}, }));
/* Misc Styles */
document.head.appendChild(Object.assign(document.createElement("style"),{innerHTML:"@font-face{font-family:'MuseoSans';src:url('https://corsproxy.io/?url=https://r2.e-z.host/4d0a0bea-60f8-44d6-9e74-3032a64a9f32/ynddewua.ttf')format('truetype')}" }));
document.head.appendChild(Object.assign(document.createElement('style'),{innerHTML:"::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: #f1f1f1; } ::-webkit-scrollbar-thumb { background: #888; border-radius: 10px; } ::-webkit-scrollbar-thumb:hover { background: #555; }"}));
document.querySelector("link[rel~='icon']").href = 'https://r2.e-z.host/4d0a0bea-60f8-44d6-9e74-3032a64a9f32/ukh0rq22.png';
/* Emmiter */
class EventEmitter{constructor(){this.events={}}on(t,e){"string"==typeof t&&(t=[t]),t.forEach(t=>{this.events[t]||(this.events[t]=[]),this.events[t].push(e)})}off(t,e){"string"==typeof t&&(t=[t]),t.forEach(t=>{this.events[t]&&(this.events[t]=this.events[t].filter(t=>t!==e))})}emit(t,...e){this.events[t]&&this.events[t].forEach(t=>{t(...e)})}once(t,e){"string"==typeof t&&(t=[t]);let s=(...i)=>{e(...i),this.off(t,s)};this.on(t,s)}};
const plppdo = new EventEmitter();
new MutationObserver((mutationsList) => { for (let mutation of mutationsList) if (mutation.type === 'childList') plppdo.emit('domChanged'); }).observe(document.body, { childList: true, subtree: true });
/* Misc Functions */
window.debug = function(text) { console.log(text); /* Hi, im just a "this exists", i am soon going to be replaced with some bullshit from /visuals/devTab.js. */}
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
const playAudio = url => { const audio = new Audio(url); audio.play(); debug(`🔊 Playing audio from ${url}`); };
const findAndClickBySelector = selector => { const element = document.querySelector(selector); if (element) { element.click(); debug(`⭕ Pressing ${selector}`); } };
function sendToast(text, duration=5000, gravity='bottom') { Toastify({ text: text, duration: duration, gravity: gravity, position: "center", stopOnFocus: true, style: { background: "#000000" } }).showToast(); debug(text); };
async function showSplashScreen() { splashScreen.style.cssText = "position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;display:flex;align-items:center;justify-content:center;z-index:9999;opacity:0;transition:opacity 0.5s ease;user-select:none;color:white;font-family:MuseoSans,sans-serif;font-size:30px;text-align:center;"; splashScreen.innerHTML = '<span style="color:white;">KHANWARE</span><span style="color:#72ff72;">.SPACE</span>'; document.body.appendChild(splashScreen); setTimeout(() => splashScreen.style.opacity = '1', 10);};
async function hideSplashScreen() { splashScreen.style.opacity = '0'; setTimeout(() => splashScreen.remove(), 1000); };
async function loadScript(url, label) { return fetch(url).then(response => response.text()).then(script => { loadedPlugins.push(label); eval(script); }); }
async function loadCss(url) { return new Promise((resolve) => { const link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = url; link.onload = () => resolve(); document.head.appendChild(link); }); }
function createTab(name, href = '#', id) {
const li = document.createElement('li');
li.innerHTML = `<a class="_sdyfgnu" id="${id}" href="${href}" target="_blank"><span class="_i7xxeac">${name}</span></a>`;
return li;
}
/* Repo Fallback */
async function initializeRepoPath() {
for (const cdn of availableCDNs) {
try {
const response = await fetch(cdn + 'Khanware.js', { method: 'HEAD' });
if (response.ok) {
repoPath = cdn;
try { translations = await (await fetch(repoPath+'utils/langs.json')).json();
} catch(e) { console.warn('How did you even break this? Failed to load translations.', e); };
return;
}
} catch {}
}
console.log('The entire internet is down for some reason. God help us all...');
}
/* Visual Functions */
function setupMenu() {
plppdo.on("domChanged",(()=>{if(document.getElementById("khanwareTab"))return;const e=document.querySelector('nav[data-testid="side-nav"]');e&&(KWSection=document.createElement("section"),KWSection.id="khanwareTab",KWSection.className="_evg4u4",KWSection.innerHTML='<h2 class="_n0asy6j">Khanware</h2>',e.appendChild(KWSection))}));
loadScript(repoPath+'visuals/mainMenu.js', 'mainMenu');
loadScript(repoPath+'visuals/statusPanel.js', 'statusPanel');
loadScript(repoPath+'visuals/donationOverlay.js', 'donationOverlay');
loadScript(repoPath+'visuals/viewCounter.js', 'viewCounter');
if(isDev) loadScript(repoPath+'visuals/devTab.js', 'devTab');
loadScript(repoPath+'visuals/tweaksTab.js', 'tweaksTab');
}
/* Main Functions */
function setupMain(){
loadScript(repoPath+'functions/questionSpoof.js', 'questionSpoof');
loadScript(repoPath+'functions/videoSpoof.js', 'videoSpoof');
loadScript(repoPath+'functions/minuteFarm.js', 'minuteFarm');
loadScript(repoPath+'functions/spoofUser.js', 'spoofUser');
loadScript(repoPath+'functions/answerRevealer.js', 'answerRevealer');
loadScript(repoPath+'functions/rgbLogo.js', 'rgbLogo');
loadScript(repoPath+'functions/customBanner.js', 'customBanner');
loadScript(repoPath+'functions/autoAnswer.js', 'autoAnswer');
loadScript(repoPath+'functions/workerBees.js', 'workerBees');
}
/* Inject */
(async function boot() {
showSplashScreen();
await initializeRepoPath();
loadScript('https://cdn.jsdelivr.net/gh/adryd325/oneko.js@master/oneko.js', 'onekoJs').then(() => { onekoEl = document.getElementById('oneko'); onekoEl.style.backgroundImage = "url('https://cdn.jsdelivr.net/gh/adryd325/oneko.js@master/oneko.gif')"; onekoEl.style.display = "none"; });
loadScript('https://cdn.jsdelivr.net/npm/darkreader@latest/darkreader.min.js', 'darkReaderPlugin').then(()=>{ DarkReader.setFetchMethod(window.fetch); DarkReader.enable(); })
loadCss('https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css', 'toastifyCss');
loadScript('https://cdn.jsdelivr.net/npm/toastify-js', 'toastifyPlugin')
.then(async () => {
fetch(`${window.location.origin}/api/internal/graphql/getFullUserProfile`,{referrer:"https://pt.khanacademy.org/profile/me",body:'{"operationName":"getFullUserProfile","query":"query getFullUserProfile($kaid: String, $username: String) {\\n user(kaid: $kaid, username: $username) {\\n id\\n kaid\\n key\\n userId\\n email\\n username\\n profileRoot\\n gaUserId\\n isPhantom\\n isDeveloper: hasPermission(name: \\"can_do_what_only_admins_can_do\\")\\n isPublisher: hasPermission(name: \\"can_publish\\", scope: ANY_ON_CURRENT_LOCALE)\\n isModerator: hasPermission(name: \\"can_moderate_users\\", scope: GLOBAL)\\n isParent\\n isTeacher\\n isFormalTeacher\\n isK4dStudent\\n isKmapStudent\\n isDataCollectible\\n isChild\\n isOrphan\\n isCoachingLoggedInUser\\n canModifyCoaches\\n nickname\\n hideVisual\\n joined\\n points\\n countVideosCompleted\\n bio\\n profile {\\n accessLevel\\n __typename\\n }\\n soundOn\\n muteVideos\\n showCaptions\\n prefersReducedMotion\\n noColorInVideos\\n newNotificationCount\\n canHellban: hasPermission(name: \\"can_ban_users\\", scope: GLOBAL)\\n canMessageUsers: hasPermission(\\n name: \\"can_send_moderator_messages\\"\\n scope: GLOBAL\\n )\\n isSelf: isActor\\n hasStudents: hasCoachees\\n hasClasses\\n hasChildren\\n hasCoach\\n badgeCounts\\n homepageUrl\\n isMidsignupPhantom\\n includesDistrictOwnedData\\n includesKmapDistrictOwnedData\\n includesK4dDistrictOwnedData\\n canAccessDistrictsHomepage\\n isInKhanClassroomDistrict\\n underAgeGate {\\n parentEmail\\n daysUntilCutoff\\n approvalGivenAt\\n __typename\\n }\\n authEmails\\n signupDataIfUnverified {\\n email\\n emailBounced\\n __typename\\n }\\n pendingEmailVerifications {\\n email\\n __typename\\n }\\n hasAccessToAIGuideCompanionMode\\n hasAccessToAIGuideLearner\\n hasAccessToAIGuideDistrictAdmin\\n hasAccessToAIGuideParent\\n hasAccessToAIGuideTeacher\\n tosAccepted\\n shouldShowAgeCheck\\n birthMonthYear\\n lastLoginCountry\\n region\\n userDistrictInfos {\\n id\\n isKAD\\n district {\\n id\\n region\\n __typename\\n }\\n __typename\\n }\\n schoolAffiliation {\\n id\\n location\\n __typename\\n }\\n __typename\\n }\\n actorIsImpersonatingUser\\n isAIGuideEnabled\\n hasAccessToAIGuideDev\\n}"}',method:"POST",mode:"cors",credentials:"include"})
.then(async response => { let data = await response.json(); user = { nickname: data.data.user.nickname, username: data.data.user.username, UID: data.data.user.id.slice(-5) }; })
sendToast(`🌿 ${t('injection_success')}`);
playAudio('https://r2.e-z.host/4d0a0bea-60f8-44d6-9e74-3032a64a9f32/gcelzszy.wav');
await delay(500);
sendToast(`⭐ ${t('welcome_back')} ${user.nickname}`);
if(device.apple) { await delay(500); sendToast(`🪽 ${t('samsung_joke')}`); }
loadedPlugins.forEach(plugin => sendToast(`🪝 ${plugin} Loaded!`, 2000, 'top') );
hideSplashScreen();
setupMenu();
setupMain();
console.clear();
});
})();
/* Thank you to everyone who has purchased access to my cheat as of 10/28/24.
@Thomaz015
@grazynabazio
@melyssaxavier
@WESLEY.SPREDEMANN
@carine.rech.alves
@nazare.de.maria
@jowsanth
@bielzy
@rafaeldeagostino
@AMFDS
@Jv010107
@Mattheusfreitas01
@Guilhermeoliveira2623
@Matt010101
@voncallis
@Thamiris0001
@Holmes1212
@Martinss0000
@zRoque
@LaryCouto.com.br
@IanyckFerreira
@sales7
@AleSobral
@wbzz2121
@Umunizzz
@ViniciusMancini
@ricardaosantista
@marcos10pc
@bzinxxx
@ryanmzmartins
@Kaleb1577
@brunopereirabarros
@RodrigoMartins1236751
@guixzf
@Leandrohenrq
@damnntiago
@WhoisMe777
@Gustavopc21
@matheus.hx2
@WSZL
@LeozinB2
@Davas123
@joaoviturino
@orickmaxx
@l55nar5
@nextbyhawk
@Bruninda019
@GabrielRibeiroP
@Shinjoia
@hy7pee
@arthurmondequedutra
@PedrooVsp
@zBlucker
@vitiintavares
@Holmes1212
@Anthony06927
@refinado
@ErickMarinelli
@pedroomelhor
@gabrielmonteiro0053
@Felipealexandre10
@saantzx7
@alvarosouzaribeiro
@gabrielejte
@Kevinzada
@antonio77xs
@marcus.floriano.oliveira
*/