Create a new directory called google-account-creator
and navigate into it:
mkdir google-account-creator
cd google-account-creator
Create a creds
directory to store your Google account credentials:
mkdir creds
Create a src
directory to store your Node.js application code:
mkdir src
Navigate to the src
directory:
cd src
Create a new file called index.js
and paste the following code into it:
const puppeteer = require('puppeteer');
const randomstring = require('randomstring');
(async () => {
const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
const page = await browser.newPage();
await page.goto('https://accounts.google.com/signup');
const firstName = randomstring.generate();
const lastName = randomstring.generate();
const username = randomstring.generate({ length: 8, readable: true });
const password = randomstring.generate({ length: 10, readable: true });
await page.type('input[name="firstName"]', firstName);
await page.type('input[name="lastName"]', lastName);
await page.type('input[name="Username"]', username);
await page.type('input[name="Passwd"]', password);
await page.type('input[name="ConfirmPasswd"]', password);
await page.click('div[jsname="Cuz2Ue"] button');
console.log(`Account created with the following details:\nUsername: ${username}\nPassword: ${password}`);
await browser.close();
})();
Create a new file called package.json
and paste the following code into it:
{
"name": "google-account-creator",
"version": "1.0.0",
"description": "Create a Google account using Puppeteer",
"main": "index.js",
"dependencies": {
"puppeteer": "^10.2.0",
"randomstring": "^1.4.0"
}
}
Create a new file called Dockerfile
and paste the following code into it:
FROM node:14-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]
Create a new file called docker-compose.yml
and paste the following code into it:
version: "3.9"
services:
app:
build: .
environment:
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
- PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
volumes:
- ../creds:/app/creds
networks:
- backend
networks:
backend:
driver: bridge
Now you can run docker-compose up -d
from the google-account-creator
directory to start the application in a Docker container. The creds
directory will be mounted into the container so that your credentials can be accessed by the Node.js application.