-
Notifications
You must be signed in to change notification settings - Fork 100
/
index.js
235 lines (218 loc) · 7.88 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
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
const proxyChecker = require('proxy-checker');
const express = require('express');
const request = require('request');
const fs = require('fs');
const app = express();
const { Bot } = require('./Source/spammer.js');
const { scrapeProxies } = require('./Source/scraper.js');
const config = require('./config.json');
const authTokens = fs.readFileSync('./tokens.txt', 'utf-8').replace(/\r|\"/gi, '').split("\n");
const EventEmitter = require('events');
const emitter = new EventEmitter();
emitter.setMaxListeners(Number.POSITIVE_INFINITY);
var tokens = [];
var proxies = [];
var verified = [];
var unverified = [];
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/Design'));
app.get('/', (req, res) => {
return res.render('index', {
unverified: unverified.length,
verified: verified.length,
proxies: proxies.length
});
});
app.get('/stats', (req, res) => {
var json = {};
json.unverified = unverified.length;
json.verified = verified.length;
json.proxies = proxies.length;
return res.end(JSON.stringify(json));
});
app.get('/join', (req, res) => {
if (!req.query.invite) {
var json = {};
json.type = "error";
json.title = "Invalid Invite";
json.message = "Please specify a valid invite!";
return res.end(JSON.stringify(json));
} else {
var invite = req.query.invite.toString().replace(/https:\/\/|http:\/\/|discord\.gg|discordapp\.com/gi, '');
var json = {};
json.type = "success";
json.title = "Sent Bots To Join";
json.message = `Sent ${tokens.length} bots to join ${invite}!`;
if (config.console_output === true) console.log(json.message);
var i = 0;
var g = 0;
setInterval(() => {
if (i >= tokens.length) return;
if (g >= proxies.length) g = 0;
Bot.join(invite, tokens[i], proxies[g]);
i++;
g++;
}, config.timeout);
return res.end(JSON.stringify(json));
}
});
app.get('/leave', (req, res) => {
if (!req.query.guild || req.query.guild !== req.query.guild.replace(/[^0-9]/gi, '')) {
var json = {};
json.type = "error";
json.title = "Invalid Guild ID";
json.message = "Please specify a valid guild id!";
return res.end(JSON.stringify(json));
} else {
var json = {};
json.type = "success";
json.title = "Sent Bots To Leave";
json.message = `Sent ${tokens.length} bots to leave ${req.query.guild}!`;
if (config.console_output === true) console.log(json.message);
var i = 0;
var g = 0;
setInterval(() => {
if (i >= tokens.length) return;
if (g >= proxies.length) g = 0;
Bot.leave(req.query.guild, tokens[i], proxies[g]);
i++;
g++;
}, config.timeout);
return res.end(JSON.stringify(json));
}
});
app.get('/spam', (req, res) => {
if (!req.query.channel || req.query.channel !== req.query.channel.replace(/[^0-9]/gi, '')) {
var json = {};
json.type = "error";
json.title = "Invalid Channel ID";
json.message = "Please specify a valid channel!";
return res.end(JSON.stringify(json));
} else if (!req.query.message) {
var json = {};
json.type = "error";
json.title = "Invalid Message";
json.message = "Please enter a valid message!";
return res.end(JSON.stringify(json));
} else {
var json = {};
json.type = "success";
json.title = "Launched Spam";
json.message = `Sent ${tokens.length} bots to spam ${req.query.channel} (message: "${req.query.message}" | tts: ${req.query.tts || false})!`;
if (config.console_output === true) console.log(json.message);
var i = 0;
var g = 0;
setInterval(() => {
if (i >= tokens.length) return;
if (g >= proxies.length) g = 0;
Bot.spam(req.query.channel, req.query.message, req.query.tts || false, config.time * 1000, config.timeout, Date.now(), tokens[i], proxies[g]);
i++;
g++;
}, config.time / 10);
return res.end(JSON.stringify(json));
}
});
app.get('/dm', (req, res) => {
if (!req.query.user || req.query.user !== req.query.user.replace(/[^0-9]/gi, '')) {
var json = {};
json.type = "error";
json.title = "Invalid ID";
json.message = "Please specify a valid user id!";
return res.end(JSON.stringify(json));
} else if (!req.query.message) {
var json = {};
json.type = "error";
json.title = "Invalid Message";
json.message = "Please enter a valid message!";
return res.end(JSON.stringify(json));
} else {
var json = {};
json.type = "success";
json.title = "Launched DM Spam";
json.message = `Sent ${tokens.length} bots to dm spam ${req.query.user} with (message: "${req.query.message}")!`;
if (config.console_output === true) console.log(json.message);
var i = 0;
var g = 0;
setInterval(() => {
if (i >= tokens.length) return;
if (g >= proxies.length) g = 0;
Bot.dm(req.query.user, req.query.message, config.time * 1000, config.timeout, Date.now(), tokens[i], proxies[g]);
i++;
g++;
}, config.time / 10);
return res.end(JSON.stringify(json));
}
});
app.get('/friend', (req, res) => {
if (!req.query.user || req.query.user !== req.query.user.replace(/[^0-9]/gi, '')) {
var json = {};
json.type = "error";
json.title = "Invalid User ID";
json.message = "Please specify a valid user!";
return res.end(JSON.stringify(json));
} else {
var json = {};
json.type = "success";
json.title = "Friend Requests Sent";
json.message = `Sent ${tokens.length} bots to friend request ${req.query.user}!`;
if (config.console_output === true) console.log(json.message);
var i = 0;
var g = 0;
setInterval(() => {
if (i >= tokens.length) return;
if (g >= proxies.length) g = 0;
Bot.friend(req.query.user, tokens[i], proxies[g]);
i++;
g++;
}, config.timeout);
return res.end(JSON.stringify(json));
}
});
scrapeProxies.then(fetched => {
if (fetched.length > config.max_proxies) {
fetched.splice(config.max_proxies - fetched.length);
}
fs.writeFile('Source/proxies.txt', fetched.join("\n"), (err) => {
if (err) throw err;
proxyChecker.checkProxiesFromFile('Source/proxies.txt', {
url: 'http://www.example.com',
}, (host, port, ok, statusCode, err) => {
if (ok) proxies.push(`${host}:${port}`);
});
});
console.log(`Checking ${fetched.length} proxies!`);
}).catch(err => {
proxyChecker.checkProxiesFromFile('Source/proxies.txt', {
url: 'http://www.example.com',
}, (host, port, ok, statusCode, err) => {
if (ok) proxies.push(`${host}:${port}`);
});
console.log(`Checking proxies from proxies.txt!`);
});
var t = -1;
setInterval(() => {
if (t >= authTokens.length) return;
request({
method: "GET",
url: "https://discordapp.com/api/v7/users/@me",
headers: {
authorization: authTokens[t++]
}
}, (error, response, body) => {
if (!body) return;
var json = JSON.parse(body);
if (json && json.id) {
if (json.verified) {
verified.push(authTokens[t]);
} else {
unverified.push(authTokens[t]);
}
tokens.push(authTokens[t]);
}
});
}, 100);
process.on('uncaughtException', (err) => {});
app.listen(config.port, () => {
console.log(`Started Discord Spammer on port ${config.port}`);
console.log(`Checking ${authTokens.length} tokens!`);
});