Add to git
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
logs/*.txt
|
||||
1107
accounts.json
Normal file
1107
accounts.json
Normal file
File diff suppressed because it is too large
Load Diff
140
index.js
Normal file
140
index.js
Normal file
@@ -0,0 +1,140 @@
|
||||
'use strict';
|
||||
|
||||
import fs from 'fs';
|
||||
import WebSocket from 'ws';
|
||||
import request from 'request';
|
||||
import HttpsProxyAgent from 'https-proxy-agent';
|
||||
|
||||
import {
|
||||
accounts
|
||||
} from './accounts.json';
|
||||
let masterPingTimeout = null;
|
||||
let masterPingInterval = null;
|
||||
let susmsg = {};
|
||||
let socket = null;
|
||||
let connected = false;
|
||||
let acc = 0;
|
||||
let spamloop = null;
|
||||
|
||||
let ks = 1;
|
||||
const agent = new HttpsProxyAgent('http://ckjownvo-rotate:ke4p9155j0mk@p.webshare.io', {
|
||||
secureProxy: true
|
||||
});
|
||||
const smessage = 'Matt can you satisfy me?';
|
||||
|
||||
const headers = {
|
||||
'x-hq-client': 'Android/1.20.0',
|
||||
'content-type': 'application/json; charset=UTF-8',
|
||||
'user-agent': 'okhttp/3.8.0',
|
||||
};
|
||||
|
||||
const S4 = () => {
|
||||
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1).toUpperCase();
|
||||
};
|
||||
|
||||
const uuid = () => {
|
||||
return (S4() + S4() + "-" + S4() + "-4" + S4().substr(0, 3) + "-" + S4() + "-" + S4() + S4() + S4());
|
||||
};
|
||||
|
||||
const run = () => {
|
||||
request({
|
||||
uri: 'https://api-quiz.hype.space/shows/now',
|
||||
agent: agent,
|
||||
headers: { ...headers,
|
||||
'Authorization': `Bearer ${accounts[acc].accessToken}`
|
||||
}
|
||||
}, (err, res, body) => {
|
||||
|
||||
let response = JSON.parse(body);
|
||||
if (response.active) {
|
||||
|
||||
susmsg = {
|
||||
"type": "subscribe",
|
||||
"broadcastId": response.broadcastId
|
||||
};
|
||||
socket = new WebSocket(response.broadcast.socketUrl, {
|
||||
headers: { ...headers,
|
||||
'Authorization': `Bearer ${accounts[acc].accessToken}`
|
||||
},
|
||||
agent: agent
|
||||
});
|
||||
socket.on('error', (eer) => {
|
||||
console.error(eer);
|
||||
console.error('WS error');
|
||||
});
|
||||
socket.on('pong', function () {
|
||||
clearTimeout(masterPingTimeout);
|
||||
});
|
||||
socket.on('open', function () {
|
||||
console.log('Connected!');
|
||||
connected = true;
|
||||
socket.send(JSON.stringify(susmsg));
|
||||
spamloop = setInterval(() => {
|
||||
if (ks > 50) {
|
||||
socket.close();
|
||||
} else {
|
||||
let spammy = {
|
||||
"type": "interaction",
|
||||
"metadata": {
|
||||
"username": accounts[acc].username,
|
||||
"message": smessage,
|
||||
"messageId": uuid,
|
||||
"userId": accounts[acc].userId,
|
||||
"interaction": "chat",
|
||||
"avatarUrl": accounts[acc].avatarUrl
|
||||
},
|
||||
"itemId": "chat"
|
||||
};
|
||||
socket.send(JSON.stringify(spammy));
|
||||
}
|
||||
}, 8000);
|
||||
masterPingInterval = setInterval(function () {
|
||||
if (!connected) return;
|
||||
if (!socket) return;
|
||||
try {
|
||||
socket.ping();
|
||||
masterPingTimeout = setTimeout(function () {
|
||||
socket.terminate();
|
||||
try {
|
||||
console.log('connection closed.');
|
||||
connected = false;
|
||||
} catch (e) {}
|
||||
}, 2000);
|
||||
} catch (error) {
|
||||
socket.close();
|
||||
connected = false;
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
});
|
||||
socket.on('message', function (message) {
|
||||
console.log(message);
|
||||
let msg = JSON.parse(message);
|
||||
if (msg.type === "broadcastEnded") {
|
||||
connected = false;
|
||||
socket.close();
|
||||
}
|
||||
fs.appendFile('logs/messages.txt', message + '\n', function (err) {
|
||||
if (err) console.error(err);
|
||||
});
|
||||
});
|
||||
socket.on('close', function () {
|
||||
connected = false;
|
||||
clearInterval(spamloop);
|
||||
console.log("Master closed");
|
||||
});
|
||||
} else {
|
||||
console.warn(`HQ isn't active`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
setInterval(() => {
|
||||
if (!connected) {
|
||||
run();
|
||||
acc += 1;
|
||||
} else if (socket.readyState === socket.CLOSED) {
|
||||
connected = false;
|
||||
}
|
||||
}, 5000);
|
||||
0
logs/.placeholder
Normal file
0
logs/.placeholder
Normal file
3894
package-lock.json
generated
Normal file
3894
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
49
package.json
Normal file
49
package.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "swagiq",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "sigFinder.js",
|
||||
"dependencies": {
|
||||
"async-request": "^1.2.0",
|
||||
"aws4": "^1.7.0",
|
||||
"base-64": "^0.1.0",
|
||||
"chalk": "^2.4.1",
|
||||
"cloudsms-api": "^1.0.2",
|
||||
"discord.js": "^11.3.2",
|
||||
"express": "^4.16.3",
|
||||
"faker": "^4.1.0",
|
||||
"fingerprintjs2": "^1.8.0",
|
||||
"fs": "0.0.1-security",
|
||||
"googleapis": "^32.0.0",
|
||||
"https": "^1.0.0",
|
||||
"https-proxy-agent": "^2.2.1",
|
||||
"js-md5": "^0.7.3",
|
||||
"moment": "^2.22.2",
|
||||
"prompt": "^1.0.0",
|
||||
"prompts": "^0.1.10",
|
||||
"pushover-notifications": "^1.0.0",
|
||||
"query-string": "^6.1.0",
|
||||
"querystring": "^0.2.0",
|
||||
"read": "^1.0.7",
|
||||
"request": "^2.87.0",
|
||||
"request-promise": "^4.2.2",
|
||||
"select-shell": "^1.1.2",
|
||||
"simple-node-logger": "^0.93.37",
|
||||
"tesladon": "^0.1.1",
|
||||
"url": "^0.11.0",
|
||||
"ws": "^5.2.2",
|
||||
"zlib": "^1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-es2016": "^6.24.1",
|
||||
"babel-preset-stage-2": "^6.24.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "babel-node index.js --presets env,es2016,stage-2"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
||||
Reference in New Issue
Block a user