Created
June 18, 2021 14:42
-
-
Save hpiaia/f2399b0f2de5ae7474c398176a4421c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
const users = require('./users.json'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto('https://<pfsense-address>'); | |
await page.type('#usernamefld', 'admin'); | |
await page.type('#passwordfld', '<password>'); | |
await page.click('[name="login"]'); | |
await page.waitForNavigation() | |
for (const user of users) { | |
await page.goto('https://<pfsense-address>/system_usermanager.php?act=new') | |
await page.type('#usernamefld', user.username); | |
await page.type('#passwordfld1', user.password); | |
await page.type('#passwordfld2', user.password); | |
await page.type('#descr', user.name); | |
await page.select('select[multiple]', 'users') | |
await page.click('#movetoenabled') | |
await page.click('#save') | |
await page.waitForNavigation() | |
await page.screenshot({ path: `screenshots/${user.username}.png` }); | |
} | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment