-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
177 lines (131 loc) · 7.01 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
const puppeteer = require('puppeteer');
const readline = require('readline');
const { EmbedBuilder, WebhookClient, AttachmentBuilder } = require('discord.js');
const fs = require('fs')
const bfile = new AttachmentBuilder(__dirname + "/begin.png");
const ffile = new AttachmentBuilder(__dirname + "/final.png");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
const LOGO = `[Puppeteer]: `
function print(message) {
console.log(`${LOGO}${message}`)
}
(async () => {
console.log("-------------------------------------------------------------------------------------------------------------")
const oauth = await new Promise((resolve) => {
rl.question(LOGO + 'Enter the OAuth Link for the Pterodactyl Server: ', (answer) => {
resolve(answer);
});
});
const minutes = await new Promise((resolve) => {
rl.question(LOGO + 'How many credits do you want?: ', (answer) => {
resolve(answer);
});
});
const discordToken = await new Promise((resolve) => {
rl.question(LOGO + 'What is your discord token?: ', (answer) => {
resolve(answer);
});
});
const discordLink = await new Promise((resolve) => {
rl.question(LOGO + 'What webhook would you like to send data to?: ', (answer) => {
resolve(answer);
});
});
const embed = new EmbedBuilder()
.setTitle("Discord Authentication Screenshot")
.setDescription("Graphical photo of headless browser interface to ensure successful authentication with Discord Application\n\n**Result:**")
.setColor("Green")
.setTimestamp()
.setImage("attachment://begin.png")
.setFooter({ text: "Puppeteer Client Interface", iconURL: 'https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png' })
const startEmbed = new EmbedBuilder()
.setTitle("Puppeteer Client was started...")
.setColor("Green")
.setTimestamp()
.addFields(
{ name: 'Credits to be earned', value: `${minutes}`, inline: false },
)
.setFooter({ text: "Puppeteer Client Interface", iconURL: 'https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png' })
const endEmbed = new EmbedBuilder()
.setTitle("Puppeteer Client was finished the process")
.setColor("Green")
.setTimestamp()
.addFields(
{ name: 'Credits earned', value: minutes + "\n\n**Result:**", inline: false },
)
.setImage("attachment://final.png")
.setFooter({ text: "Puppeteer Client Interface", iconURL: 'https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png' })
console.log("-------------------------------------------------------------------------------------------------------------")
console.log('@@@@@5 ..... 5@@@@@\n@@@@@5 ^B#BBBBY: !7. 5@@@@@\n@@@@@5 ^@@~::J@#.:^. .^^ .^^:~!~. .^^:~!~. .~!!^ .~&@?^. :~!!: .~!!^ :^.^!~ 5@@@@@\n@@@@@5 ^@@[email protected]@! !@B ^@&BPP#&J ^@&BPP#&J .5&GY5#B^^G&@BP^.P#PYP&P: Y#GY5#B~ P@BGGJ 5@@@@@\n@@@@@5 ^@@P55J~ B@! !@B ^@&: .#@!^@&: .#@~J@&5YYG&Y #@~ 5@#YYYG&77@&5YYG&5 P@5 5@@@@@\n@@@@@5 ^@@: P@5^~G@B ^@@J~~J@#:^@@J~~J@#:~@&?~!55^ B@J~.7@#7~!5Y.~&&?~!Y5^ P@J 5@@@@@\n@@@@@5 :55. :YGG5?PY ^@&YPGGJ: ^@&YPGGJ: ^JPGG57. ~5GG~ ^YPGG5! :JPGGP7. ?P! 5@@@@@\n@@@@@5 ^@&. ^@&. 5@@@@@\n@@@@@5 .7! .7! 5@@@@@\n@@@@@5 5@@@@@')
console.log("-------------------------------------------------------------------------------------------------------------")
print("Starting Puppeteer instance...")
// Launch Puppeteer and navigate to Discord's login page
const browser = await puppeteer.launch({headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox']});
const page = await browser.newPage();
const webhookLink = new WebhookClient({ url: discordLink })
await webhookLink.send({
username: "Puppeteer Client Interface",
avatarURL: "https://st2.depositphotos.com/4199035/6594/v/950/depositphotos_65942573-stock-illustration-puppet-cartoon-illustration-isolated-on.jpg",
embeds: [startEmbed]
})
const bypassLocalStorageOverride = (page) => page.evaluateOnNewDocument(() => {
// preserve localStorage as separate var to keep it before any overrides
let __ls = localStorage
// restrict closure overrides to break global context reference to localStorage
Object.defineProperty(window, 'localStorage', { writable: false, configurable: false, value: __ls })
})
print("Redirecting to https://discord.com/app ... (May take a few seconds)")
bypassLocalStorageOverride(page)
await page.goto('https://discord.com/app', { timeout: 0 });
await page.evaluate((token) => {
localStorage.setItem('token', `"${token}"`);
}, discordToken);
// Navigate to a page where you want to use the local storage value
await page.goto(oauth, { timeout: 0 });
print("Successfully logged in...")
await page.waitForTimeout(5000)
await page.screenshot({ path: 'begin.png' })
print("Generated success screenshot...")
await page.waitForTimeout(5000)
webhookLink.send({
username: "Puppeteer Client Interface",
avatarURL: 'https://st2.depositphotos.com/4199035/6594/v/950/depositphotos_65942573-stock-illustration-puppet-cartoon-illustration-isolated-on.jpg',
embeds: [embed],
files: [bfile]
})
print("Sent screenshot to webhook...")
async function countDown(minutes) {
let seconds = minutes * 60;
process.stdout.write(LOGO + `Time remaining: ${Math.floor(seconds / 60)}:${seconds % 60 < 10 ? '0' : ''}${seconds % 60}`);
while (seconds > 0) {
await page.waitForTimeout(1000);
seconds--;
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(LOGO + `Time remaining: ${Math.floor(seconds / 60)}:${seconds % 60 < 10 ? '0' : ''}${seconds % 60}`);
}
process.stdout.clearLine();
process.stdout.cursorTo(0);
await page.screenshot({ path: 'final.png' })
print("Took a final screenshot, overriding old version...")
await webhookLink.send({
username: "Puppeteer Client Interface",
avatarURL: "https://st2.depositphotos.com/4199035/6594/v/950/depositphotos_65942573-stock-illustration-puppet-cartoon-illustration-isolated-on.jpg",
embeds: [endEmbed],
files: [ffile]
})
print("Sent end embed...")
fs.unlinkSync('begin.png')
fs.unlinkSync('final.png')
print("Deleted screenshot...")
print("Finished waiting on process, now closing...")
console.log("-------------------------------------------------------------------------------------------------------------")
}
await countDown(minutes)
await browser.close()
await process.exit()
})();