Skip to content

A program used to produce the secret TEST_ACCOUNTS used by the chatgpt-scraper.

Notifications You must be signed in to change notification settings

daily-coding-problem/accounts-serializer

Repository files navigation

Accounts Serializer

Docker Linux Python

This program is used to produce the secret TEST_ACCOUNTS used by the chatgpt-scraper. TEST_ACCOUNTS is a dictionary of the form:

{
	"test@company.com": {
		"provider": "basic",
		"password": "some password",
		"secret": {
			"google": "some secret",
			"chatgpt": "some secret"
		}
	}
}

How to obtain the secret for a given email

The secret is obtained from the totp.Account URL which comes from the QR code generated by w3id when setting up 2FA.

For example: otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example

The secret is the value of the secret query parameter.

E.g., JBSWY3DPEHPK3PXP in the above example.

Configuration

Configuration is done via environment variables. Please see the .env.example file for a list of all available variables.

Requirements

  • Python 3.11+
  • Poetry

Installation

poetry install

Usage

To use the accounts_serializer.py script, you can pass the emails, passwords, providers, and secrets as arguments. Here's an example:

poetry run python accounts_serializer.py \
    --emails test@company.com user@anothercompany.com \
    --passwords password123 userpassword456 \
    --providers basic basic \
    --secrets google:google-secret-abc chatgpt:chatgpt-secret-xyz github:github-secret-123 aws:aws-secret-789

Example Output

Running the above command will produce a JSON structure like the following:

{
    "test@company.com": {
        "provider": "basic",
        "password": "password123",
        "secret": {
            "google": "google-secret-abc",
            "chatgpt": "chatgpt-secret-xyz"
        }
    },
    "user@anothercompany.com": {
        "provider": "basic",
        "password": "userpassword456",
        "secret": {
            "github": "github-secret-123",
            "aws": "aws-secret-789"
        }
    }
}

This JSON structure is then base64 encoded to be used as the TEST_ACCOUNTS environment variable.

Docker

You can also build and run the script using Docker:

docker build -t accounts_serializer .
docker run --rm --env-file .env accounts_serializer --help
docker run --rm --env-file .env accounts_serializer \
    --emails test@company.com user@anothercompany.com \
    --passwords password123 userpassword456 \
    --providers basic basic \
    --secrets google:google-secret-abc chatgpt:chatgpt-secret-xyz github:github-secret-123 aws:aws-secret-789

This will allow you to generate the TEST_ACCOUNTS environment variable in a consistent and reproducible way.

About

A program used to produce the secret TEST_ACCOUNTS used by the chatgpt-scraper.

Resources

Stars

Watchers

Forks