-
Notifications
You must be signed in to change notification settings - Fork 161
/
Copy pathindex.js
194 lines (158 loc) · 6.77 KB
/
index.js
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
(() => {
/*
Gimkit hack by Drew Snow
Created: Fri Aug 23 2019 14:57:53 GMT-0700 (Pacific Daylight Time)
Updated: Thu Mar 19 2020 08:15:08 GMT-0700 (Pacific Daylight Time)
*/
let Exploit = function () {
this.terms = {};
this.game = {};
this.interval = -1;
this.shop = {
'MPQ': [10, 100, 1e3, 1e4, 75e3, 3e5, 1e6, 1e7, 1e8],
'SB': [15, 150, 1500, 15e3, 115e3, 45e4, 15e5, 15e6, 2e8],
'Multi': [50, 300, 2e3, 12e3, 85e3, 7e5, 65e5, 65e6, 1e9],
'Powerups': [
{
'name': 'Love Song',
'price': 55
}, {
'name': 'Clapinator',
'price': 25
}, {
'name': 'Icer',
'price': 45
}, {
'name': 'Deflector',
'price': 60
}, {
'name': 'Rebooter',
'price': 1005
}, {
'name': 'Gift',
'price': 205
}, {
'name': 'Subtractor',
'price': 155
}, {
'name': 'Reducer',
'price': 135
}, {
'name': 'Discounter',
'price': 255
}, {
'name': 'Mini Bonus',
'price': 25
}, {
'name': 'Mega Bonus',
'price': 55
},
]
};
/*this.elem = document.createElement('div');
this.elem.style = `position: fixed; z-index: 2147483638; top: 60px; right: 0; border: 5px 0 0 5px;`;
this.elem.innerHTML = `
<div>Money Per Question: <span name="inp_mpq">$10</span></div>
<div>Streak Bonus: <span name="inp_sb">$15</span></div>
<div>Multiplier: <span name="inp_mp">$50</span></div>
`;
document.body.appendChild(this.elem);*/
this.fetch = this.clean('fetch');
this.initiate();
}
Exploit.prototype.clean = function (key) {
let iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
let window = iframe.contentWindow;
iframe.parentNode.removeChild(iframe);
return window[key];
};
Exploit.prototype.closest_number = function (number = 0, array = []) {
let arr = array.map(function (k) { return Math.abs(k - number) }),
min = Math.min.apply(Math, arr);
return array[arr.indexOf(min)];
};
Exploit.prototype.update_shop = function () {
let upgrades = this.shop,
money = this.money();
document.querySelector('*[name="inp_mpq"]').textContent = '$' + this.closest_number(money, upgrades.MPQ);
document.querySelector('*[name="inp_sb"]').textContent = '$' + this.closest_number(money, upgrades.SB);
document.querySelector('*[name="inp_mp"]').textContent = '$' + this.closest_number(money, upgrades.Multi);
};
Exploit.prototype.money = function () {
let root = document.getElementById('root'),
money = root.children[0].children[0].textContent;
return Number(money.replace(/[^0-9.-]+/g, ''))
};
Exploit.prototype.style_text = function (elem) {
elem.style.borderRadius = '5px';
elem.style.borderBottom = '5px solid red';
};
Exploit.prototype.style_img = function (elem) {
elem.style.borderRadius = '5px';
elem.style.borderBottom = '5px solid red';
};
Exploit.prototype.loop = function () {
if (document.getElementsByClassName('animated tada').length || document.getElementsByClassName('animated jello').length) return false;
let question = this.header().textContent,
answers = this.terms.filter(e => e.text == question),
answer = answers[Math.floor(Math.random() * answers.length)];
if (!answer) return false;
let type = answer.type
answer = answer.answers.filter(e => e.correct)[0]
if (type == 'mc') {
if (answer.image) {
let element = document.querySelector(`img[src="${answer.image}"]`);
if (element) this.style_img(element);
} else if (answer.text) {
let elements = Array.from(document.querySelectorAll('span')).filter(e => e.textContent == answer.text),
element = elements[Math.floor(Math.random() * elements.length)];
this.style_text(element);
}
} else if (type == 'text') {
let input = this.input();
if (input) {
input.value = answer.text;
input.placeholder = answer.text;
}
}
};
Exploit.prototype.initiate = function () {
let questions = this.questions();
if (questions.length < 1) return setTimeout(() => { this.initiate(); }, 1000);
this.fetch_terms(questions[0].game, terms => {
this.interval = setInterval(() => { this.loop(); }, 100);
});
};
Exploit.prototype.fetch_terms = function (gameId = '', callback = console.log) {
let req = new XMLHttpRequest();
req.open('GET', 'https://www.gimkit.com/api/games/fetch/' + gameId);
req.onreadystatechange = () => {
if (req.readyState == 4 && req.status == 200) {
let json = JSON.parse(req.responseText);
this.game = json;
this.terms = json.kit.questions;
if (callback) callback(json.kit.questions);
}
}
req.send();
};
Exploit.prototype.questions = function () {
let questions = JSON[Object.keys(JSON)[0]];
return questions || [];
}
Exploit.prototype.header = function () {
let root = document.getElementById('root');
return root.children[0].children[1].children[0].children[0].children[0];
};
Exploit.prototype.options = function () {
return Array.from(document.getElementById('root').children[0].children[1].children[0].children[0].children[1].children);
};
Exploit.prototype.input = function () {
return document.querySelector('input');
};
alert('GIMKIT SCRIPT V0.02\n- Drew Snow\n\nThis script is "under development" as people are still complaining about being kicked.\n\nInstructions:\n‣ For text questions press any key inside the text box then click answer.\n‣ For multiple choice the correct answer should be underlined in red.\n\nThis script is still in beta, send me a message on discord if anything is not working correctly.');
let Session = new Exploit();
return 'Script has been loaded.';
})();