This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
script.user.js
425 lines (407 loc) · 14.9 KB
/
script.user.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
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
// ==UserScript==
// @name Omegle Toolkit
// @namespace https://github.com/Smooklu/OmegleToolkit
// @version 1.02
// @description A toolkit designed to make your experience on Omegle safe and smooth.
// @author Smooklu & Chinoto
// @match https://www.omegle.com/
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
// @ts-check
(async function () {
'use strict';
// Startup Vars
let api_key = localStorage.getItem('api_key');
let ip = '';
let country = '';
let blacklist_stopped = false;
let geo_turnoff = false;
let version_number = '1.02';
let auto_reroll = false;
let chat_time = 0;
// IP and Country Blacklist
function addToIPBlacklist() {
if (!ip) {
console.log('No IP specified!');
return;
}
let unparsed = localStorage.getItem('ip_blacklist');
let parsed = unparsed ? JSON.parse(unparsed) : [];
parsed.push(ip);
localStorage.setItem('ip_blacklist', JSON.stringify(parsed));
console.log(`Added ${ip} to the IP Blacklist!`);
}
function addToCountryBlacklist() {
let country = prompt('Enter country to be blacklisted:');
if (!country) {
console.log('No country specified!');
return;
}
let unparsed = localStorage.getItem('country_blacklist');
let parsed = unparsed ? JSON.parse(unparsed) : [];
parsed.push(country);
localStorage.setItem('country_blacklist', JSON.stringify(parsed));
console.log(`Added ${country} to the Country Blacklist!`);
}
function checkIPBlacklist() {
let ip_blacklist = localStorage.getItem('ip_blacklist');
if (!ip_blacklist) {
return;
}
ip_blacklist = JSON.parse(ip_blacklist);
if (ip_blacklist.indexOf(ip) !== -1) {
console.log('Blacklisted IP detected! Disconnecting!');
social_buttons.children[1].textContent =
'Last Action: IP Blacklist Disconnect';
start_stop();
}
}
function checkCountryBlacklist() {
let country_blacklist = localStorage.getItem('country_blacklist');
if (!country_blacklist) {
return;
}
country_blacklist = JSON.parse(country_blacklist);
if (country_blacklist.indexOf(country) !== -1) {
console.log('Blacklisted country detected! Disconnecting!');
social_buttons.children[1].textContent =
'Last Action: Country Blacklist Disconnect';
start_stop();
}
}
// Inject Custom Style Sheet
let link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.href = 'https://smooklu.github.io/OmegleToolkit/otk.css';
document.head.appendChild(link);
// Automatic Blacklist and Server Status Updating
let response = await fetch(
'https://raw.githubusercontent.com/Smooklu/OmegleToolkit/main/blacklist.json'
);
let blacklist = await response.json();
blacklist.regex = blacklist.regex.map(x => new RegExp(x));
let omegle_status = await (
await fetch('https://front29.omegle.com/status')
).json();
let user_count = omegle_status.count;
// Simple Geo Location
window.originalRTCPeerConnection =
window.originalRTCPeerConnection || window.RTCPeerConnection;
window.RTCPeerConnection = function (...args) {
const pc = new window.originalRTCPeerConnection(...args);
pc.original_addIceCandidate = pc.addIceCandidate;
pc.addIceCandidate = function (iceCandidate, ...rest) {
const fields = iceCandidate.candidate.split(' ');
if (fields[7] === 'srflx') {
ip = fields[4];
getLocation();
}
return pc.original_addIceCandidate(iceCandidate, ...rest);
};
return pc;
};
let statuslog = document.getElementsByClassName('statuslog');
let getLocation = async () => {
let output = `<h2 class="geo_loc">Unknown</h2>`;
if (api_key && !geo_turnoff) {
let url = `https://api.ipgeolocation.io/ipgeo?apiKey=${api_key}&ip=${ip}`;
let response = await fetch(url);
let json = await response.json();
output = `<img class="flag" src=${json.country_flag}></img><h2 class="geo_loc">${json.country_name}</h2>`;
country = json.country_name;
}
statuslog[0].innerHTML = output;
};
function autoConfirmTerms() {
let confirm = document.querySelector(
'input[value="Confirm & continue"]'
);
if (!confirm) {
return;
}
let checkboxes = confirm
.closest('div')
.querySelectorAll('input[type=checkbox]:not(:checked)');
for (let checkbox of checkboxes) {
checkbox.click();
}
confirm.click();
}
// Interface Stuff
let social_buttons = document.getElementById('sharebuttons');
function deleteSocialButtons() {
while (social_buttons.children.length) {
social_buttons.children[0].remove();
}
document.getElementById('onlinecount').remove();
}
let logwrapper = document.getElementsByClassName('logwrapper');
let videologo = document.getElementById('videologo');
async function addInterface() {
while (!logwrapper[0]) {
await new Promise(res => setTimeout(res, 50));
}
// Don't run if the menu or if the status display already exists
if (document.querySelector('.button_menu')) {
return;
}
let log_box = logwrapper[0];
let menu = document.createElement('menu');
menu.className = 'button_menu';
let [submenu1, submenu2] = [0, 0].map(() => {
let submenu = document.createElement('div');
menu.appendChild(submenu);
return submenu;
});
social_buttons.className = 'otk_status_display';
if (!social_buttons.children.length) {
[
`User Count: ${user_count}`,
'Last Action:',
'Chat Session Length:',
].map(text => {
let status = document.createElement('p');
status.textContent = text;
status.style.margin = '1px';
social_buttons.appendChild(status);
return status;
});
social_buttons.style.marginTop = '-5px';
}
let [
ip_blacklist_category,
add_ip_blacklist,
clear_ip_blacklist,
country_blacklist_category,
add_country_blacklist,
clear_country_blacklist,
display_country_blacklist,
misc_category,
enter_api,
toggle_geo,
toggle_blacklist,
a_reroll,
version,
] = [
'C*IP Blacklist',
'Add to IP Blacklist',
'Clear IP Blacklist',
'C*Country Blacklist',
'Add Country to Blacklist',
'Clear Country Blacklist',
'Display Country Blacklist',
'C*Settings',
'Enter API Key',
'Geolocation Enabled',
'Blacklist Enabled',
'Auto Reroll Disabled',
`Omegle Toolkit v${version_number}`,
].map(text => {
if (text.startsWith('C*')) {
let category = document.createElement('p');
category.textContent = text.slice(2);
category.className = 'category';
submenu1.appendChild(category);
return category;
} else {
let button = document.createElement('button');
button.textContent = text;
button.className = 'buttons';
submenu1.appendChild(button);
return button;
}
});
add_ip_blacklist.onclick = addToIPBlacklist;
clear_ip_blacklist.onclick = function () {
localStorage.setItem('ip_blacklist', '');
ip = '';
console.log('Cleared IP Blacklist!');
};
toggle_blacklist.onclick = function () {
if (blacklist_stopped) {
blacklist_stopped = false;
console.log('Enabled blacklist!');
toggle_blacklist.className = 'buttons enabled';
toggle_blacklist.textContent = 'Blacklist Enabled';
} else {
blacklist_stopped = true;
console.log('Disabled blacklist!');
toggle_blacklist.className = 'buttons disabled';
toggle_blacklist.textContent = 'Blacklist Disabled';
}
};
enter_api.onclick = function () {
let api_key = prompt(
'Enter API key from https://app.ipgeolocation.io/'
);
if (!api_key) {
return;
}
localStorage.setItem('api_key', api_key);
};
add_country_blacklist.onclick = addToCountryBlacklist;
clear_country_blacklist.onclick = function () {
localStorage.setItem('country_blacklist', '');
country = '';
console.log('Cleared Country Blacklist!');
};
display_country_blacklist.onclick = function () {
window.alert(JSON.parse(localStorage.country_blacklist));
};
toggle_geo.onclick = function () {
if (geo_turnoff) {
geo_turnoff = false;
console.log('Enabled geo location features!');
toggle_geo.className = 'buttons enabled';
toggle_geo.textContent = 'Geolocation Enabled';
} else {
geo_turnoff = true;
console.log('Disabled geo location features!');
toggle_geo.className = 'buttons disabled';
toggle_geo.textContent = 'Geolocation Disabled';
}
};
if (geo_turnoff) {
toggle_geo.className = 'buttons disabled';
toggle_geo.textContent = 'Geolocation Disabled';
} else {
toggle_geo.className = 'buttons enabled';
toggle_geo.textContent = 'Geolocation Enabled';
}
if (blacklist_stopped) {
toggle_blacklist.className = 'buttons disabled';
toggle_blacklist.textContent = 'Blacklist Disabled';
} else {
toggle_blacklist.className = 'buttons enabled';
toggle_blacklist.textContent = 'Blacklist Enabled';
}
if (auto_reroll) {
a_reroll.className = 'buttons enabled';
a_reroll.textContent = 'Auto Reroll Enabled';
} else {
a_reroll.className = 'buttons disabled';
a_reroll.textContent = 'Auto Reroll Disabled';
}
a_reroll.onclick = function () {
if (auto_reroll) {
auto_reroll = false;
console.log('Disabled auto reroll!');
a_reroll.className = 'buttons disabled';
a_reroll.textContent = 'Auto Reroll Disabled';
} else {
auto_reroll = true;
console.log('Enabled auto reroll!');
a_reroll.className = 'buttons enabled';
a_reroll.textContent = 'Auto Reroll Enabled';
}
};
version.classList.add('otk_version');
submenu2.appendChild(version);
log_box.appendChild(menu);
}
// Auto Reroll
function checkDisconnect(element) {
if (element.textContent.includes('disconnected')) {
if (auto_reroll) {
console.log('Rerolling!');
start_stop();
return false;
}
} else {
return true;
}
return false;
}
// Chat Session Length
let disconnectbtn = document.getElementsByClassName('disconnectbtn');
function secondCounter() {
if (!auto_reroll) {
social_buttons.children[2].textContent = '';
return;
}
if (
!Array.from(statuslog)
.slice(-3)
.some(x => x.textContent.includes('disconnected'))
) {
chat_time += 1;
}
if (!disconnectbtn[0]) {
chat_time = 0;
}
if (chat_time == 0) {
social_buttons.children[2].textContent = `Chat Session Length: No Session`;
} else {
let minutes =
chat_time >= 60 ? Math.floor(chat_time / 60) + 'm ' : '';
let seconds = chat_time % 60;
social_buttons.children[2].textContent = `Chat Session Length: ${minutes}${seconds}s`;
}
}
// Blacklist Phrase Detection and Auto-Disconnect
function start_stop() {
if (
disconnectbtn[0]?.textContent.startsWith("New") &&
auto_reroll
) {
var amt = 1;
} else if (disconnectbtn[0]?.textContent.split('\n')[0] == 'Really?') {
var amt = 1;
} else if (disconnectbtn[0]?.textContent.split('\n')[0] == 'Stop') {
var amt = 2;
}
for (let i = 0; i < amt; i++) {
disconnectbtn[0]?.click();
}
ip = '';
country = '';
chat_time = 0;
}
function verify(element) {
let msg = element.children[1].textContent.toLowerCase();
let match = '';
if (blacklist.exact.indexOf(msg) >= 0) {
match = 'Exact match';
} else if (
blacklist.starts_with.some(element => msg.startsWith(element))
) {
match = 'Starts with';
} else if (blacklist.includes.some(element => msg.includes(element))) {
match = 'Includes';
} else if (blacklist.regex.some(element => element.test(msg))) {
match = 'Regex';
}
if (match !== '') {
console.log(match + ' blacklist phrase detected! Disconnecting!');
social_buttons.children[1].textContent =
'Last Action: Phrase Blacklist Disconnect';
start_stop();
}
return match === '';
}
let strangermsg = document.getElementsByClassName('strangermsg');
function check() {
autoConfirmTerms();
addInterface();
if (social_buttons.className == 'otk_status_display') {
secondCounter();
}
if (blacklist_stopped) {
return;
}
let arr = Array.from(strangermsg);
let arr1 = Array.from(statuslog);
checkIPBlacklist();
checkCountryBlacklist();
arr1.every(element => checkDisconnect(element));
if (arr.length == 0) {
return;
}
arr.every(element => verify(element));
console.log(`Checking: ${arr.length} messages`);
}
window.myInterval = setInterval(check, 1000);
window.setTimeout(deleteSocialButtons, 500);
})();