-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadmin-bot.js
59 lines (49 loc) · 1.61 KB
/
admin-bot.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
// npm install puppeteer
const puppeteer = require("puppeteer");
// change these
const USERNAME = "ADMIN_ACCOUNT";
const PASSWORD = "ADMIN_PASSWORD";
const SITE = "http://paymentpal.localhost";
const visit = async (url) => {
let browser;
try {
browser = await puppeteer.launch({
headless: 'chrome',
pipe: true,
args: [
"--no-sandbox",
"--disable-setuid-sandbox",
"--js-flags=--noexpose_wasm,--jitless",
],
dumpio: true
});
let page = await browser.newPage();
await page.goto(SITE, {
waitUntil: "networkidle2"
});
await page.evaluate((username, password) => {
document.querySelector("input[name=username]").value = username;
document.querySelector("input[name=password]").value = password;
document.querySelector("#login_btn").click();
}, USERNAME, PASSWORD);
page.once('dialog', async dialog => {
await dialog.dismiss();
});
await page.waitForNavigation();
// yeah, this is indeed the payment-pal website :')
await page.waitForTimeout(1000);
await page.evaluate(() => {
document.querySelector("#logout_btn").click();
});
await page.waitForTimeout(2000);
await page.goto(url);
await page.waitForTimeout(10000);
await browser.close();
browser = null;
} catch (err) {
console.log(err);
} finally {
if (browser) await browser.close();
}
};
visit("https://yourwebsite/payload");