Professional Documents
Culture Documents
];
const DELTA_TIME_IF_NOT_CAPTCHA = 15*60; // Khoảng thời gian nếu ko gặp captcha để
kích hoạt thời gian ngủ bên dưới. Tính bằng giây
const SLEEP_TIME_IF_NOT_CAPTCHA = 0*60; // Thời gian ngủ nếu ko gặp catcha. Tính
bằng giây
function getIdByUserName(user_name){
return users_store[user_name]?.id;
}
function searchIdByUserName(user_name){
if(!user_name) return null;
for(let key in users_store){
if(key.includes(user_name)){
return users_store[key]?.id;
}
}
return null;
}
unsafeWindow.getIdByUserName = getIdByUserName;
unsafeWindow.searchIdByUserName = searchIdByUserName;
Object.assign($, {
create: function(tag, attrs = {}){
let elem = document.createElement(tag);
Object.assign(elem, attrs);
if(attrs.appendBody){
document.body.appendChild(elem);
}
if(attrs.appendHead){
document.head.appendChild(elem);
}
return elem;
},
ready: function(callback){
document.addEventListener("DOMContentLoaded", callback);
},
addStyle: function(source){
if(source.startsWith("http") || source.startsWith("blob:")){
$.create("link", {
rel: "stylesheet",
href: source,
appendHead: true,
});
}else{
$.create("style", {
innerText: source,
type: "text/css",
appendHead: true,
});
}
}
});
function intercept_localStorage_getItem(){
// discord delete native localStorage, we should backup it
unsafeWindow._localStorage = unsafeWindow.localStorage;
unsafeWindow._localStorage.__proto__._getItem =
unsafeWindow._localStorage.__proto__.getItem;
unsafeWindow._localStorage.__proto__.getItem = function(key){
let value = this._getItem(key);
if (key === "token" && value){
try{
unsafeWindow.discord_token = JSON.parse(value);
}catch(e){
unsafeWindow.discord_token = "";
alert("Không tìm thấy token. Vui lòng không chạy code");
}
}
return value;
}
}
if(!unsafeWindow.has_intercept_localStorage){
intercept_localStorage_getItem();
unsafeWindow.has_intercept_localStorage = true;
}
function intercept_websocket_decode(){
Object.defineProperty(Object.prototype, "onData", {
set: function(value){
if (this.constructor.toString().includes("inflateGetHeader")){
this._onData = function(){
if(arguments.length){
// console.log("data:", arguments[0], typeof arguments[0]);
unsafeWindow.dispatchEvent(new
CustomEvent("discordMessage", {detail: {message: arguments[0]}}));
}
return value.apply(this, arguments);
}
}else{
this._onData = value;
}
},
get: function(){
return this._onData;
}
},
{
configurable: true,
writable: false,
});
}
if(!unsafeWindow.has_intercept_websocket){
intercept_websocket_decode();
unsafeWindow.has_intercept_websocket = true;
}
function send_discord(text){
let text_node = $("span[data-slate-zero-width]");
if(text_node) text_node.textContent = text;
setTimeout(function(){
let text_area_node = $("div.slateTextArea-1Mkdgw");
if (text_area_node){
text_area_node.dispatchEvent(new Event('input', { bubbles: true}));
for(let i = 0; i < 2; ++i){
setTimeout(function(){
text_area_node.dispatchEvent(new KeyboardEvent("keydown", {
bubbles:true,
key: "Enter",
keyCode: 13,
which: 13,
shiftKey: false,
ctrlKey: false,
metaKey: false
}))
}, 500);
}
}
}, 100);
}
unsafeWindow.send_typing = send_typing;
async function sendRequest(url, method = "GET", data = null){
console.log("request send", method, url);
return new Promise(function(resolve, reject){
GM_xmlhttpRequest({
method: method,
url: url,
data: data,
onload: function(response) {
resolve(response);
},
onerror: function(resp){
console.log("GM_xmlhttpRequest", resp);
let error = resp.statusText || "There are some error";
reject(`HTTP ${resp.status}: ${error}`);
},
ontimeout: function(){
reject("Connect server timeout");
}
});
})
}
var command_index = 0;
function getNextCommand(){
command_index = command_index % COMMANDS.length;
let [command, time] = COMMANDS[command_index];
let time_sleep = typeof time === "function" ? time() : time;
++command_index;
return [command, time_sleep];
}
function btn_onChange(){
let elem = $("div#btn-auto-owo");
console.log("toggle", isRun);
if(isRun){
isRun = false;
elem.textContent = "Start";
return;
}else{
isRun = true;
resolve_captcha_done = true;
elem.textContent = "Stop";
autoSend();
}
}
function start_auto_send(){
isRun = false;
btn_onChange();
}
function stop_auto_send(){
isRun = true;
btn_onChange();
}
function calculateTimeResetCaptchaPassword(content){
let matches = content.match(/Password will reset in (\d+) minutes/);
if (matches?.length){
let min = parseInt(matches[1]);
let deadline = Date.now() + (min*60+5)*1000;
return deadline;
}
throw new Error("Không tìm thấy đúng định dạng thời gian Password reset");
}
function calculateDeadline(content){
let matches = content.match(/BACK IN (?:(\d+)?H)?(\d+)M WITH/);
if (matches?.length){
let hour = 0;
if (matches[1]){
hour = parseInt(matches[1]);
}
let min = parseInt(matches[2]);
let deadline = Date.now() + (hour*3600+min*60+10)*1000;
return deadline;
}
throw new Error("Không tìm thấy đúng định dạng thời gian");
}
function add_user_store(new_user){
const username = new_user.username;
const user = users_store[username];
if(!user){
users_store[username] = new_user;
}else{
users_store[username] = {...user, ...new_user};
}
}
function save_user(message){
const t = message?.t;
const d = message?.d;
if(t === "READY" && d?.users?.length){
let users = message.d.users;
users.forEach(add_user_store);
}else if(t === "GUILD_MEMBER_LIST_UPDATE" && d?.ops?.length){
if(!Array.isArray(d.ops)) return;
for(let op of d.ops){
if(!Array.isArray(op.items)) continue;
for(let item of op.items){
if(item.member?.user){
add_user_store(item.member.user);
}
}
}
}
}
// Beep Boop. Are you a real human? Please reply with the following 5 letter word
so I can check!
// user_name**, Beep Boop. Please DM me with only the following 5 letter word to
check that you are a human!
unsafeWindow.addEventListener("discordMessage", function(event){
let message = event.detail.message;
//console.log("message:", message);
try{
message = JSON.parse(message);
}catch(e){
console.error("Json parse error", e);
//console.log("message:", message);
return;
}
save_user(message);
if(message?.t == "MESSAGE_CREATE" && message.d?.content){
let content = message.d.content;
let channel_id = message.d.channel_id;
// Chú thích dòng này lại nếu không muốn dùng owo h, owo b
//
**********************************************************************
stop_auto_send();
if (message.d.attachments.length && message.d.attachments[0].url){
sendTextCaptcha2OwOBotChannel(message.d.attachments[0].url);
return;
}
let m = content.match(/(http:\/\/verify.owobot.com\/[0-9a-f]{8}-[0-
9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})/g);
//console.log("match", m);
if(m){
GM_openInTab(m[0], {active: true});
//window.open(m[0]);
}else{
Swal.fire({
icon: "error",
title: "Lỗi",
text: "Không phân tích được url verify"
});
}
//
**********************************************************************
return;
}
waitForNextAutoHunt(calculateTimeResetCaptchaPassword(content), TYPE_WRONG_PASS);
}catch(err){
Swal.fire({
icon: "error",
title: "Lỗi",
text: err
});
}
return;
}
function setupButtonDl(){
let elem = $.create("div", {
id: "auto-owo-container",
innerHTML: `<div class="auto-owo-title">
<span>Auto owo</span>
</div>
<div id="btn-auto-owo">Start</div>`,
appendBody: true
});
let draggie = new Draggabilly(elem);
//draggie.on("staticClick", btn_onChange);
$("#btn-auto-owo").onclick = btn_onChange;
}
$.ready(function(){
if(!window.Draggabilly){
let draggabilly = GM_getResourceText('draggabilly');
if (draggabilly) {
eval(draggabilly);
}
}
if(!window.Swal){
let sweetalert2 = GM_getResourceText('sweetalert2');
if (sweetalert2) {
eval(sweetalert2);
window.Swal = this.Sweetalert2;
}
}
$.addStyle('https://cdn.bootcdn.net/ajax/libs/font-awesome/4.0.0/css/font-
awesome.min.css');
// display: none;
// line-height: 70px;
$.addStyle(`#auto-owo-container {
z-index: 99999;
position: fixed;
border-radius: 5%;
top: 25%;
left: 85%;
width: 110px;
height: 115px;
border: #fff solid 1.5px;
box-shadow: 0 3px 10px rgb(212 26 104);
text-align: center;
background: rgb(212 26 104);
color: white;
cursor: pointer;
}
.auto-owo-title {
margin: 8px auto;
font-size: 19px;
display: inline-block;
vertical-align: middle;
}
#btn-auto-owo {
position: relative;
margin: auto;
width: 65px;
height: 65px;
border-radius: 50%;
border: #fff solid 1.5px;
box-shadow: 0 3px 10px #d8d225a8;
text-align: center;
background: #d8d225a8;
color: white;
cursor: pointer;
font-size: 1.3em;
display: flex;
justify-content: center;
align-items: center;
}
#btn-auto-owo:hover {
background-image: linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1));
}
`);
setupButtonDl();
});