├── google
├── __init__.py
├── proxies.txt
├── requirements.txt
├── config.yml
├── README.md
├── config.py
├── smspool.py
└── index.py
├── ptc
├── __init__.py
├── mail_reader
│ ├── __init__.py
│ ├── requirements.txt
│ ├── Dockerfile
│ └── index.py
├── mail_server
│ ├── __init__.py
│ ├── requirements.txt
│ ├── Dockerfile
│ └── index.py
├── account_exporter
│ ├── __init__.py
│ ├── requirements.txt
│ ├── Dockerfile
│ └── index.py
├── klinklang
│ ├── core
│ │ ├── __init__.py
│ │ ├── models
│ │ │ ├── __init__.py
│ │ │ ├── mail_server_config.py
│ │ │ ├── mail_reader_config.py
│ │ │ ├── klinklang_database_config.py
│ │ │ └── account_export_config.py
│ │ ├── db_return.py
│ │ ├── ptc
│ │ │ ├── get_random_dob.py
│ │ │ ├── timeout.py
│ │ │ ├── get_country_for_proxy.py
│ │ │ ├── random_word_gen.py
│ │ │ └── __init__.py
│ │ └── config.py
│ └── __init__.py
├── stats_collector
│ ├── __init__.py
│ ├── requirements.txt
│ ├── Dockerfile
│ └── index.py
├── account_generation
│ ├── __init__.py
│ ├── proxies.txt
│ ├── requirements.txt
│ ├── config.yml
│ ├── config.py
│ └── index.py
├── MANIFEST.in
├── config.yml
├── pyproject.toml
├── docker-compose.yml
└── README.md
├── google_oauth
├── __init__.py
├── requirements.txt
├── README.md
├── api.py
├── login_test.py
└── helper.py
├── .gitignore
├── pyproject.toml
├── README.md
└── LICENSE.md
/google/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/google/proxies.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/google/requirements.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/google_oauth/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/mail_reader/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/mail_server/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/account_exporter/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/klinklang/core/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/mail_server/requirements.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/stats_collector/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/account_generation/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/account_generation/proxies.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/klinklang/core/models/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/stats_collector/requirements.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ptc/mail_reader/requirements.txt:
--------------------------------------------------------------------------------
1 | imap-tools
--------------------------------------------------------------------------------
/ptc/MANIFEST.in:
--------------------------------------------------------------------------------
1 | recursive-include klinklang *
--------------------------------------------------------------------------------
/google_oauth/requirements.txt:
--------------------------------------------------------------------------------
1 | fastapi
2 | uvicorn
3 | seleniumbase
4 | 2captcha-python
--------------------------------------------------------------------------------
/ptc/account_exporter/requirements.txt:
--------------------------------------------------------------------------------
1 | mysql-connector==2.2.9
2 | requests
3 | apscheduler==3.10.4
--------------------------------------------------------------------------------
/ptc/account_generation/requirements.txt:
--------------------------------------------------------------------------------
1 | pymongo==4.7.2
2 | pyyaml==6.0.2
3 | pydantic==2.7.1
4 | seleniumbase==4.30.3
--------------------------------------------------------------------------------
/google_oauth/README.md:
--------------------------------------------------------------------------------
1 | # Google OAuth Test
2 |
3 | just a POC oauth test for google. gets blocked by recaptcha. Added recaptcha bypass, but it's not working.
--------------------------------------------------------------------------------
/ptc/config.yml:
--------------------------------------------------------------------------------
1 | database:
2 | database_name: klinklang
3 | host: mongodb
4 | password: mongoadmin
5 | username: mongodb
6 | domains:
7 | domains:
8 | - domain_name: mail.test.de
9 |
--------------------------------------------------------------------------------
/ptc/klinklang/core/db_return.py:
--------------------------------------------------------------------------------
1 | def db_return(result):
2 | """
3 | Method to convert a MongoDB result to a list of dictionaries without the _id field
4 | """
5 | return [
6 | {key: value for key, value in item.items() if key not in ["_id"]}
7 | for item in result
8 | ]
9 |
--------------------------------------------------------------------------------
/google/config.yml:
--------------------------------------------------------------------------------
1 | proxy_file: proxies.txt
2 | #binary_location: '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
3 | additional_sleep_time : 10
4 | network_blocks:
5 | - "*.png"
6 | - "*.ico"
7 | - "*.css"
8 | - "*.gvt1.com"
9 | - "*.woff"
10 | - "*.svg"
11 | - "*.browser-intake-datadoghq.com"
12 | - "*.googleapis.com"
13 | - "_Incapsula_Resource"
14 | sms_pool_api_key: uTgwlQPhsTw3pdXxDi
--------------------------------------------------------------------------------
/ptc/klinklang/core/ptc/get_random_dob.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import random
3 |
4 | from klinklang.core.ptc import PossibleMonths
5 |
6 |
7 | def get_random_dob():
8 | possible_days = [i for i in range(1, 28)]
9 | current_year = datetime.datetime.now().year
10 | possible_years = [i for i in range(current_year - 40, (current_year - 18))]
11 |
12 | year = random.choice(possible_years)
13 | month = random.choice(PossibleMonths)
14 | day = random.choice(possible_days)
15 |
16 | return year, month, day
17 |
--------------------------------------------------------------------------------
/ptc/klinklang/core/models/mail_server_config.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class MailServerConfig(BaseModel):
5 | """
6 | Configuration for the mail server.
7 |
8 | Parameters
9 | ----------
10 | port : int
11 | The port inside the container, where the mail server should be openened.
12 | default: 25
13 | host : str
14 | The IP where the mail server should be opened.
15 | default: 0.0.0.0
16 | """
17 |
18 | port: int = 25
19 | host: str = "0.0.0.0"
20 |
--------------------------------------------------------------------------------
/ptc/mail_reader/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM --platform=linux/amd64 python:3.11-slim
2 | ENV PYTHONDONTWRITEBYTECODE=1
3 | ENV PYTHONUNBUFFERED=1
4 |
5 | RUN apt-get update && apt-get install -y git
6 |
7 | # Create a working directory
8 | WORKDIR /app
9 |
10 | # Copy only the requirements file and install dependencies
11 | COPY ./mail_reader .
12 | RUN pip install --no-cache-dir -r requirements.txt
13 |
14 | # Install klinklang
15 | COPY ../klinklang /app/klinklang
16 | COPY ../pyproject.toml /app/pyproject.toml
17 | RUN pip install .
18 |
19 | # Command to run the start script
20 | CMD [ "python", "index.py" ]
21 |
--------------------------------------------------------------------------------
/ptc/stats_collector/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM --platform=linux/amd64 python:3.11-slim
2 | ENV PYTHONDONTWRITEBYTECODE=1
3 | ENV PYTHONUNBUFFERED=1
4 |
5 | RUN apt-get update && apt-get install -y git
6 |
7 | # Create a working directory
8 | WORKDIR /app
9 |
10 | # Copy only the requirements file and install dependencies
11 | COPY ./stats_collector .
12 | RUN pip install --no-cache-dir -r requirements.txt
13 |
14 | # Install klinklang
15 | COPY ../klinklang /app/klinklang
16 | COPY ../pyproject.toml /app/pyproject.toml
17 | RUN pip install .
18 |
19 | # Command to run the start script
20 | CMD [ "python", "index.py" ]
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | *.pyc
3 | klinklang_public/imperva/core/scizorproxy.crx
4 | klinklang_public/imperva/core/scizorproxy.pem
5 | .DS_Store
6 | .queue
7 | database
8 | build
9 | .egg-info/
10 | get_accounts.py
11 | learning_test.py
12 | rotation_learning/
13 | scrapoxy/
14 | *accounts*.txt
15 | *.egg-info
16 | *.log
17 | *.png
18 | __pycache__
19 | klinklang_frontend
20 | */dist
21 | */account_generator_.py
22 | */utils_.py
23 | account_generation/account_generator_.py
24 | account_generation/dist
25 | account_generation/accounts
26 | account_generation/stats
27 | account_generation/downloaded_files
28 | .venv
29 |
30 | account_auth
--------------------------------------------------------------------------------
/ptc/mail_server/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM --platform=linux/amd64 python:3.11-slim
2 | ENV PYTHONDONTWRITEBYTECODE=1
3 | ENV PYTHONUNBUFFERED=1
4 |
5 | RUN apt-get update && apt-get install -y git
6 |
7 | # Create a working directory
8 | WORKDIR /app
9 |
10 | # Copy only the requirements file and install dependencies
11 | COPY ./mail_server/requirements.txt .
12 | RUN pip install --no-cache-dir -r requirements.txt
13 |
14 | # Install klinklang
15 | COPY ../klinklang /app/klinklang
16 | COPY ../pyproject.toml /app/pyproject.toml
17 | RUN pip install .
18 |
19 | # Install rest of files
20 | COPY ./mail_server .
21 |
22 | # Command to run the start script
23 | CMD [ "python", "index.py" ]
24 |
--------------------------------------------------------------------------------
/ptc/account_exporter/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM --platform=linux/amd64 python:3.11-slim
2 | ENV PYTHONDONTWRITEBYTECODE=1
3 | ENV PYTHONUNBUFFERED=1
4 |
5 | RUN apt-get update && apt-get install -y git
6 |
7 | # Create a working directory
8 | WORKDIR /app
9 |
10 | # Copy only the requirements file and install dependencies
11 | COPY ./account_exporter/requirements.txt .
12 | RUN pip install --no-cache-dir -r requirements.txt
13 |
14 | # Install klinklang
15 | COPY ../klinklang /app/klinklang
16 | COPY ../pyproject.toml /app/pyproject.toml
17 | RUN pip install .
18 |
19 | # Copy exporter files
20 | COPY ./account_exporter .
21 |
22 | # Command to run the start script
23 | CMD [ "python", "index.py" ]
24 |
--------------------------------------------------------------------------------
/google_oauth/api.py:
--------------------------------------------------------------------------------
1 | from fastapi import FastAPI, HTTPException
2 | from pydantic import BaseModel
3 | import requests
4 | from helper import handle_login
5 | app = FastAPI()
6 |
7 | class LoginRequest(BaseModel):
8 | url: str
9 | username: str
10 | password: str
11 |
12 | class LoginResponse(BaseModel):
13 | login_code: str
14 | status: str
15 |
16 | @app.post("/api/v1/login", response_model=LoginResponse)
17 | async def login(login_request: LoginRequest):
18 | await handle_login(login_request.url, login_request.username, login_request.password)
19 | return LoginResponse(login_code='test', status='SUCCESS')
20 |
21 | if __name__ == "__main__":
22 | import uvicorn
23 | uvicorn.run(app, host="0.0.0.0", port=8000)
--------------------------------------------------------------------------------
/ptc/klinklang/core/ptc/timeout.py:
--------------------------------------------------------------------------------
1 | import signal
2 |
3 |
4 | def timeout(seconds):
5 | """Decorator to add a timeout to a function."""
6 |
7 | def process_timeout(func):
8 | def handle_timeout(signum, frame):
9 | raise TimeoutError("The function timed out")
10 |
11 | def wrapper(*args, **kwargs):
12 | if not hasattr(signal, "SIGALRM"):
13 | return func(*args, **kwargs)
14 |
15 | signal.signal(signal.SIGALRM, handle_timeout)
16 | signal.alarm(seconds)
17 |
18 | try:
19 | result = func(*args, **kwargs)
20 | finally:
21 | signal.alarm(0) # No need to time out!
22 | return result
23 |
24 | return wrapper
25 |
26 | return process_timeout
27 |
--------------------------------------------------------------------------------
/google/README.md:
--------------------------------------------------------------------------------
1 | A Google Account Generator
2 |
3 | ## Requirements
4 | - Python 3.11 or higher
5 | - a SMSPool API key (https://www.smspool.net/)
6 | - Optional Proxies (both basic auth or user/pass are supported)
7 |
8 | ## Installation
9 | 1. Clone the repository
10 | 2. Install the klinklang python package `pip install ptc` (from repo root)
11 | 3. Install the requirements `pip install -r requirements.txt` (from google folder)
12 | 4. Edit the `config.yml` in the google folder according to your needs
13 | 5. Run the script `python index.py` (from google folder)
14 |
15 | The accounts get stored in a file called `gmail_accounts.txt` in the google folder.
16 | the prices for SMS can vary greatly, I have seen everything from 1 cent to 100 cents. A limit for this has yet to be implemented. However, if you have enough credit, you can generate an account very quickly
17 |
18 | ## TODOs
19 | - [ ] Add more sms providers
20 | - [ ] Add limits for the costs of the sms
--------------------------------------------------------------------------------
/ptc/klinklang/core/models/mail_reader_config.py:
--------------------------------------------------------------------------------
1 | from typing import List
2 |
3 | from pydantic import BaseModel
4 |
5 |
6 | class MailBox(BaseModel):
7 | """
8 | Configuration for a mail box, which should be read
9 |
10 | Parameters
11 | ----------
12 | username : str
13 | The username of the mail box.
14 | password : str
15 | The password of the mail box.
16 | imap_server : str
17 | The server under which the mail box is hosted.
18 | delete_after_read : bool
19 | If the mail should be deleted after reading it.
20 | default: True
21 | """
22 |
23 | username: str
24 | password: str
25 | imap_server: str
26 | delete_after_read: bool = True
27 |
28 |
29 | class MailReaderConfig(BaseModel):
30 | """
31 | Configuration for the mail reader.
32 |
33 | Parameters
34 | ----------
35 | mailbox : List[MailBox]
36 | The mail boxes which should be read.
37 | """
38 |
39 | mailbox: List[MailBox]
40 |
--------------------------------------------------------------------------------
/ptc/account_generation/config.yml:
--------------------------------------------------------------------------------
1 | database:
2 | database_name: klinklang
3 | host: monogdb
4 | password: mongoadmin
5 | username: mongodb
6 | domains:
7 | - domain_name: klinklang.de
8 | - domain_name: klinklang2.de
9 | accounts:
10 | save_to_file : true
11 | format: '{email}, {username}, {password}, {dob}'
12 | proxy_file: proxies.txt
13 | license: 088077b3-7e50-48b6-8791-dbf466951c3d8
14 | show_total_accounts: false
15 | names_generator : true
16 | random_subdomain: true
17 | subdomain_length: 10
18 | headless: false
19 | proxy_region : Germany
20 | proxy_cooldown: 1900
21 | #binary_location: '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
22 | additional_sleep_time : 10
23 | show_chart: true # Set to false to disable the chart
24 | max_accounts_per_domain: 500 # Set your max accounts per domain here
25 | network_blocks:
26 | - "*.png"
27 | - "*.ico"
28 | - "*.gvt1.com"
29 | - "*.woff"
30 | - "*.svg"
31 | - "*.browser-intake-datadoghq.com"
32 | - "*.googleapis.com"
33 | - "_Incapsula_Resource"
--------------------------------------------------------------------------------
/ptc/klinklang/__init__.py:
--------------------------------------------------------------------------------
1 | __version__ = "0.0.1"
2 |
3 | import datetime
4 |
5 |
6 | class bcolors:
7 | HEADER = "\033[95m"
8 | OKBLUE = "\033[94m"
9 | OKCYAN = "\033[96m"
10 | OKGREEN = "\033[92m"
11 | WARNING = "\033[93m"
12 | FAIL = "\033[91m"
13 | ENDC = "\033[0m"
14 | BOLD = "\033[1m"
15 | UNDERLINE = "\033[4m"
16 |
17 |
18 | class Logger:
19 | @staticmethod
20 | def now() -> str:
21 | return datetime.datetime.now(datetime.timezone.utc).isoformat()
22 |
23 | @staticmethod
24 | def info(message):
25 | print(f"{bcolors.OKGREEN}[INFO][{Logger.now()}] {message}")
26 |
27 | @staticmethod
28 | def info_cyan(message):
29 | print(f"{bcolors.OKCYAN}[INFO][{Logger.now()}] {message}")
30 |
31 | @staticmethod
32 | def warning(message):
33 | print(f"{bcolors.WARNING}[WARNING][{Logger.now()}] {message}")
34 |
35 | @staticmethod
36 | def error(message):
37 | print(f"{bcolors.FAIL}[ERROR][{Logger.now()}] {message}")
38 |
39 |
40 | logger = Logger
41 |
--------------------------------------------------------------------------------
/ptc/stats_collector/index.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import threading
3 | import time
4 |
5 | from klinklang import logger
6 | from klinklang.core.config import read_config
7 | from klinklang.core.db_return import db_return
8 |
9 | config = read_config()
10 | logger.info("Config loaded")
11 | database_client = config.database.client()
12 | logger.info("Connected to database")
13 |
14 |
15 | def collect_account_stats():
16 | account_table = database_client['accounts']
17 | stats_table = database_client['stats']
18 | while True:
19 | logger.info('Collecting Account stats')
20 | accounts = db_return(account_table.find())
21 | stats_table.insert_one({'time':int(time.time()), 'accounts':len(accounts), 'name':'generated_accounts'})
22 | logger.info(f'Generated Accounts: {datetime.datetime.now(datetime.timezone.utc).isoformat()} {len(accounts)}')
23 | time.sleep(60)
24 |
25 |
26 | if __name__ =="__main__":
27 | threading.Thread(target=collect_account_stats).start()
28 |
29 | while True:
30 | time.sleep(60000)
--------------------------------------------------------------------------------
/ptc/klinklang/core/models/klinklang_database_config.py:
--------------------------------------------------------------------------------
1 | from urllib.parse import quote_plus
2 |
3 | import pymongo
4 | from pydantic import BaseModel
5 |
6 |
7 | class DatabaseConfig(BaseModel):
8 | """
9 | Configuration for the database klinklang is using.
10 |
11 | Parameters
12 | ----------
13 | host : str
14 | The IP of the database.
15 | username : str
16 | The username of the database.
17 | password : str
18 | The password of the database.
19 | database_name : str
20 | The name of the database.
21 | default: "klinklang"
22 | """
23 |
24 | host: str
25 | username: str
26 | password: str
27 | database_name: str = "klinklang"
28 |
29 | @property
30 | def url(self):
31 | return "mongodb://%s:%s@%s" % (
32 | quote_plus(self.username),
33 | quote_plus(self.password),
34 | f"{self.host}/",
35 | )
36 |
37 | @property
38 | def database(self) -> pymongo.MongoClient:
39 | return pymongo.MongoClient(self.url)
40 |
41 | def client(self):
42 | return self.database[self.database_name]
43 |
--------------------------------------------------------------------------------
/google_oauth/login_test.py:
--------------------------------------------------------------------------------
1 | import base64
2 | import hashlib
3 | import os
4 | import re
5 |
6 | import requests
7 |
8 | code_verifier = base64.urlsafe_b64encode(os.urandom(40)).decode("utf-8")
9 | code_verifier = re.sub("[^a-zA-Z0-9]+", "", code_verifier)
10 | code_challenge = hashlib.sha256(code_verifier.encode("utf-8")).digest()
11 | code_challenge = base64.urlsafe_b64encode(code_challenge).decode("utf-8")
12 | code_challenge = code_challenge.replace("=", "")
13 | state = base64.urlsafe_b64encode(os.urandom(20)).decode("utf-8")
14 |
15 | url = f"https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?state={state}&scope=openid%20email%20profile&redirect_uri=com.googleusercontent.apps.848232511240-dmrj3gba506c9svge2p9gq35p1fg654p%3A%2Foauth2redirect&client_id=848232511240-dmrj3gba506c9svge2p9gq35p1fg654p.apps.googleusercontent.com&response_type=code&code_challenge={code_challenge}&code_challenge_method=S256&service=lso&o2v=2&ddm=0&flowName=GeneralOAuthFlow"
16 |
17 | r = requests.post(
18 | "http://localhost:8000/api/v1/login",
19 | json={
20 | "url": url,
21 | "username": "redeyesboltropes2a354prepoliti@gmail.com",
22 | "password": "lv0IM0yeBvaRW#A",
23 | },
24 | )
25 |
26 | print(r)
27 | print(r.text)
28 |
--------------------------------------------------------------------------------
/ptc/klinklang/core/ptc/get_country_for_proxy.py:
--------------------------------------------------------------------------------
1 | import os
2 | import random
3 |
4 | import requests
5 | from klinklang import logger
6 | from klinklang.core.ptc import POSSIBLE_REGIONS
7 |
8 |
9 | def get_country_for_proxy(proxy: str, region: str = None):
10 | if region and region in POSSIBLE_REGIONS:
11 | logger.info(f"{region=} was given through config file. Continuing.")
12 | return region
13 | if region and region not in POSSIBLE_REGIONS:
14 | logger.error(f"{region=} was given through config file but is invalid.")
15 | logger.info(f"{POSSIBLE_REGIONS=}")
16 |
17 | proxies = {
18 | "http": proxy,
19 | "https": proxy,
20 | }
21 |
22 | try:
23 | resp = requests.get(f"https://api.country.is", proxies=proxies)
24 | country_code = resp.json()["country"]
25 | found_countries = [
26 | country
27 | for country in POSSIBLE_REGIONS.keys()
28 | if POSSIBLE_REGIONS[country] == country_code
29 | ]
30 | if found_countries:
31 | country = found_countries[0]
32 | logger.info(f"Found {country=} for proxy {proxy}")
33 | return country
34 |
35 | logger.warning(
36 | f"Found {country_code=} for proxy {proxy}. This is not allowed. Choosing random region"
37 | )
38 | return random.choice(list(POSSIBLE_REGIONS.keys()))
39 | except:
40 | logger.warning(
41 | "Error occured while checking proxy region. Continuing with random region"
42 | )
43 | return random.choice(list(POSSIBLE_REGIONS.keys()))
44 |
--------------------------------------------------------------------------------
/ptc/klinklang/core/config.py:
--------------------------------------------------------------------------------
1 | from typing import Optional
2 |
3 | import yaml
4 | from pydantic import BaseModel
5 |
6 | from .models.account_export_config import AccountExportConfig
7 | from .models.klinklang_database_config import DatabaseConfig
8 | from .models.mail_reader_config import MailReaderConfig
9 | from .models.mail_server_config import MailServerConfig
10 |
11 |
12 | class Config(BaseModel):
13 | """
14 | Configuration for the klinklang service
15 |
16 | Parameters
17 | ----------
18 | database : DatabaseConfig
19 | The database configuration.
20 | mailserver : Optional[MailServerConfig]
21 | The mail server configuration.
22 | mailreader : Optional[MailReaderConfig]
23 | The mail reader configuration.
24 | domains : DomainConfig
25 | The domain configuration.
26 | export : Optional[AccountExportConfig]
27 | The account export configuration.
28 |
29 | """
30 |
31 | database: DatabaseConfig
32 | mailserver: Optional[MailServerConfig]
33 | mailreader: Optional[MailReaderConfig]
34 | export: Optional[AccountExportConfig]
35 |
36 |
37 | def read_config(filename: str = "config.yml") -> Config:
38 | """
39 | Reads the configuration from a file
40 |
41 | Parameters
42 | ----------
43 | filename : str
44 | The filename of the configuration file.
45 | default: "config.yml"
46 |
47 | Returns
48 | -------
49 | Config
50 | The configuration object.
51 | """
52 | with open(filename, "r") as config_file:
53 | config = yaml.safe_load(config_file)
54 | return Config(**config)
55 |
--------------------------------------------------------------------------------
/google/config.py:
--------------------------------------------------------------------------------
1 | import os
2 | from typing import List, Optional
3 |
4 | import yaml
5 | from klinklang import logger
6 | from pydantic import BaseModel, model_validator
7 | file_dir = os.path.dirname(os.path.abspath(__file__))
8 |
9 |
10 | class Proxy(BaseModel):
11 | proxy: str = None
12 | rotating: bool = False
13 |
14 |
15 | class Config(BaseModel):
16 | proxies: Optional[List[Proxy]] = []
17 | proxy_file: str = None
18 | sms_pool_api_key: str
19 | binary_location: Optional[str] = None
20 | headless: bool = True
21 | network_blocks: Optional[List[str]] = None
22 |
23 | @model_validator(mode="after")
24 | def load_proxie_file(self):
25 | proxie_file = self.proxy_file
26 | proxies: List[Proxy] = self.proxies
27 |
28 | if proxie_file:
29 | logger.info(f"Loading proxies from {os.path.join(file_dir, proxie_file)}")
30 | with open(os.path.join(file_dir, proxie_file), "r") as f:
31 | loaded_proxies = f.readlines()
32 |
33 | for proxy in loaded_proxies:
34 | proxy = proxy.strip()
35 | rotating = False
36 | if proxy.endswith("/rotating"):
37 | rotating = True
38 | proxy = proxy.replace("/rotating", "")
39 | if proxy:
40 | proxies.append(Proxy(proxy=proxy, rotating=rotating))
41 | self.proxies = proxies
42 | # return values
43 |
44 |
45 | def load_config():
46 | logger.info("Loading config...")
47 | with open(os.path.join(file_dir, "config.yml"), "r") as f:
48 | config = yaml.safe_load(f)
49 | logger.info("Loaded config")
50 | return Config(**config)
51 |
--------------------------------------------------------------------------------
/ptc/klinklang/core/models/account_export_config.py:
--------------------------------------------------------------------------------
1 | from typing import Literal
2 |
3 | from pydantic import BaseModel
4 |
5 |
6 | class AccountExportConfig(BaseModel):
7 | """
8 | Configuration for exporting accounts to an external database.
9 |
10 | Parameters
11 | ----------
12 | enabled : bool
13 | Whether the account export is enabled.
14 | default: False
15 | rate : int
16 | The rate in seconds at which accounts are exported.
17 | default: 3600
18 | destination : Literal["DRAGONITE", "RDM"]
19 | The destination table of the accounts, either DRAGONITE or RDM.
20 | discord : bool
21 | Whether to send messages to Discord with stats.
22 | default: False
23 | webhook : str
24 | The webhook URL to send messages to Discord.
25 | host : str
26 | The IP of the database where the accounts should be imported to.
27 | password : str
28 | The password of the database, where the accounts should be imported to.
29 | username : str
30 | The username of the database, where the accounts should be imported to.
31 | db_name : str
32 | The name of the database, where the accounts should be imported to.
33 | table_name : str
34 | The table name to be used, where the accounts should be imported to.
35 | port : int
36 | The port where the database for importing is running.
37 | default: 3306
38 | """
39 | rate: int = 3600
40 | destination: Literal["DRAGONITE", "RDM"]
41 | discord: bool = False
42 | webhook: str = None
43 | host: str
44 | password: str
45 | username: str
46 | db_name: str
47 | table_name: str
48 | port: int = 3306
49 |
--------------------------------------------------------------------------------
/ptc/mail_reader/index.py:
--------------------------------------------------------------------------------
1 | import re
2 | import time
3 | from itertools import cycle
4 |
5 | from imap_tools import MailBox, A
6 | from klinklang import logger
7 | from klinklang.core.config import read_config
8 | from klinklang.core.models.mail_reader_config import MailBox as MailConfig
9 |
10 | config = read_config()
11 | logger.info("Config loaded")
12 | database_client = config.database.client()
13 | logger.info("Connected to database")
14 |
15 |
16 | def check_emails(config: MailConfig):
17 | # get subjects of unseen emails from INBOX folder
18 | with MailBox(config.imap_server).login(config.username, config.password) as mailbox:
19 | messages = [msg for msg in mailbox.fetch(A(seen=False), mark_seen=True)]
20 |
21 | for message in messages:
22 | logger.info("Received a new message")
23 | code = re.search(r"
(\d{6})
", message.html)
24 | if code:
25 | code = code.group(1)
26 | for to in message.to:
27 | logger.info(f"Code found: {code} for {to=}")
28 | database_client["codes"].insert_one({"code": code, "email": to})
29 | logger.info(f"Code saved in database")
30 | if message.from_ == "no-reply@tmi.pokemon.com":
31 | mailbox.delete(uid_list=[message.uid])
32 | logger.info(f"Deleted message from Niantic")
33 |
34 |
35 | if __name__ == "__main__":
36 | import os
37 |
38 | mail_reader_config = config.mailreader
39 | if mail_reader_config is None:
40 | logger.info("Mail reader config not found. MailReader disabled.")
41 | while True:
42 | time.sleep(6000000)
43 |
44 | sleep_time = int(os.environ.get("SLEEP_TIME", 1))
45 | domains = config.mailreader.mailbox
46 | servers = cycle(domains)
47 | while True:
48 | server = next(servers)
49 | logger.info(f"Checking mails {server=}")
50 | check_emails(server)
51 |
52 | time.sleep(sleep_time)
53 |
--------------------------------------------------------------------------------
/ptc/pyproject.toml:
--------------------------------------------------------------------------------
1 | [build-system]
2 | requires = ["setuptools"]
3 | build-backend = "setuptools.build_meta"
4 |
5 | [project]
6 | name = "klinklang"
7 | version = "0.0.1"
8 | description = "The public components for klinklang"
9 | readme = "README.md"
10 | requires-python = ">=3.8"
11 | authors = [
12 | {name = "Christopher Müller", email = "christphermueller2@outlook.de"},
13 | {name = "James Wilson", email = "contact@james.baby"},
14 | ]
15 | dependencies = ["pymongo==4.6.3","PyYaml==6.0.1","pydantic==1.10.14",]
16 |
17 | [project.urls]
18 | Homepage = "https://github.com/SpielerNogard/klinklang-public"
19 |
20 | [tool.setuptools.packages.find]
21 | include = ["klinklang*"]
22 | exclude=["*.tests", "*.tests.*", "tests.*", "tests"]
23 |
24 | [tool.ruff]
25 | line-length = 88
26 | indent-width = 4
27 | target-version = "py38"
28 |
29 | [tool.ruff.lint]
30 | # for more rules: https://docs.astral.sh/ruff/rules/
31 | select = [
32 | "A", # prevent using keywords that clobber python builtins
33 | "E", # pycodestyle
34 | "F", # pyflakes
35 | "UP", # alert you when better syntax is available in your python version
36 | "I", # isort
37 | "N", # PEP8 naming
38 | "W" # Warnings
39 | ]
40 | ignore = ["A003","N805","A002"]
41 |
42 | [tool.ruff.format]
43 | # Like Black, use double quotes for strings.
44 | quote-style = "double"
45 | # Like Black, indent with spaces, rather than tabs.
46 | indent-style = "space"
47 | # Like Black, respect magic trailing commas.
48 | skip-magic-trailing-comma = false
49 | # Like Black, automatically detect the appropriate line ending.
50 | line-ending = "auto"
51 | # Enable reformatting of code snippets in docstrings.
52 | docstring-code-format = true
53 |
54 | [tool.commitizen]
55 | name = "cz_conventional_commits"
56 | tag_format = "$version"
57 | version_scheme = "semver"
58 | version_provider = "pep621"
59 | update_changelog_on_bump = true
60 | bump_message = "bump: $current_version → $new_version [skip-ci]"
61 | version_files = [
62 | "klinklang/__init__.py",
63 | ]
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [build-system]
2 | requires = ["setuptools"]
3 | build-backend = "setuptools.build_meta"
4 |
5 | [project]
6 | name = "klingklang_public"
7 | version = "0.0.1"
8 | description = "The public components for klinklang"
9 | readme = "README.md"
10 | requires-python = ">=3.8"
11 | authors = [
12 | {name = "Christopher Müller", email = "christphermueller2@outlook.de"},
13 | {name = "James Wilson", email = "contact@james.baby"},
14 | ]
15 | dependencies = ["pymongo==4.6.3","PyYaml==6.0.1","pika==1.3.2", "pydantic==1.10.14",]
16 |
17 | [project.urls]
18 | Homepage = "https://github.com/SpielerNogard/klinklang-public"
19 |
20 | #[project.optional-dependencies]
21 | #docs = ["PyYAML==6.0.1"]
22 |
23 | [tool.setuptools.packages.find]
24 | exclude=["*.tests", "*.tests.*", "tests.*", "tests"]
25 |
26 | [tool.ruff]
27 | exclude = ['**_pb2.py']
28 | line-length = 88
29 | indent-width = 4
30 | target-version = "py38"
31 |
32 | [tool.ruff.lint]
33 | # for more rules: https://docs.astral.sh/ruff/rules/
34 | select = [
35 | "A", # prevent using keywords that clobber python builtins
36 | "E", # pycodestyle
37 | "F", # pyflakes
38 | "UP", # alert you when better syntax is available in your python version
39 | "I", # isort
40 | "N", # PEP8 naming
41 | "W" # Warnings
42 | ]
43 | ignore = ["A003","N805","A002"]
44 |
45 | [tool.ruff.format]
46 | # Like Black, use double quotes for strings.
47 | quote-style = "double"
48 | # Like Black, indent with spaces, rather than tabs.
49 | indent-style = "space"
50 | # Like Black, respect magic trailing commas.
51 | skip-magic-trailing-comma = false
52 | # Like Black, automatically detect the appropriate line ending.
53 | line-ending = "auto"
54 | # Enable reformatting of code snippets in docstrings.
55 | docstring-code-format = true
56 |
57 | [tool.commitizen]
58 | name = "cz_conventional_commits"
59 | tag_format = "$version"
60 | version_scheme = "semver"
61 | version_provider = "pep621"
62 | update_changelog_on_bump = true
63 | bump_message = "bump: $current_version → $new_version [skip-ci]"
64 | version_files = [
65 | "klinklang/__init__.py",
66 | ]
--------------------------------------------------------------------------------
/ptc/klinklang/core/ptc/random_word_gen.py:
--------------------------------------------------------------------------------
1 | import os
2 | import random
3 | import re
4 | import string
5 | import uuid
6 |
7 | SPECIAL_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+']
8 | this_dir = os.path.dirname(__file__)
9 |
10 | class RandomWordGen:
11 |
12 | @staticmethod
13 | def is_normal_characters(s):
14 | if not s:
15 | return False
16 | pattern = re.compile(r"^[a-zA-Z0-9]+$")
17 | return bool(pattern.match(s))
18 |
19 | @staticmethod
20 | def generate_syllables(length=3):
21 | vowels = "aeiou"
22 | consonants = "bcdfghjklmnpqrstvwxyz"
23 | syllables = []
24 | for _ in range(length):
25 | syllable = random.choice(consonants) + random.choice(vowels)
26 | syllables.append(syllable)
27 | return "".join(syllables)
28 |
29 | @staticmethod
30 | def add_random_digits(name, num_digits=4):
31 | name_list = list(name)
32 | for _ in range(num_digits):
33 | digit = str(random.randint(0, 9))
34 | pos = random.randint(1, len(name_list) - 1)
35 | name_list.insert(pos, digit)
36 | return "".join(name_list)
37 |
38 | @staticmethod
39 | def generate_password(lower_limit=12, upper_limit=24):
40 | length = random.randint(lower_limit, upper_limit)
41 | all_chars = string.ascii_letters + string.digits + "".join(SPECIAL_CHARS)
42 |
43 |
44 | password = [
45 | random.choice(string.ascii_uppercase),
46 | random.choice(string.ascii_lowercase),
47 | random.choice(string.digits),
48 | random.choice(SPECIAL_CHARS)
49 | ]
50 |
51 | password += [random.choice(all_chars) for _ in range(length - 4)]
52 | random.shuffle(password)
53 | return "".join(password)
54 |
55 | @staticmethod
56 | def generate_username():
57 | num_syllables = random.randint(3, 6)
58 |
59 | base_name = "".join([RandomWordGen.generate_syllables() for _ in range(num_syllables)])
60 |
61 | random_digits_count = random.randint(1, 3)
62 | base_name = RandomWordGen.add_random_digits(base_name, random_digits_count)
63 |
64 | while len(base_name) < 10:
65 | base_name += random.choice(string.ascii_lowercase)
66 |
67 | if len(base_name) > 16:
68 | base_name = base_name[:16]
69 |
70 | return base_name
71 |
72 |
73 | if __name__ == "__main__":
74 | random_word_gen = RandomWordGen()
75 | username = random_word_gen.generate_username()
76 | password = random_word_gen.generate_password()
77 |
--------------------------------------------------------------------------------
/ptc/mail_server/index.py:
--------------------------------------------------------------------------------
1 | import asyncore
2 | import email
3 | import re
4 | import smtpd
5 | import time
6 |
7 | from klinklang import logger
8 | from klinklang.core.config import read_config
9 |
10 | config = read_config()
11 | logger.info("Config loaded")
12 | database_client = config.database.client()
13 | logger.info("Connected to database")
14 |
15 |
16 | class CustomSMTPServer(smtpd.SMTPServer):
17 | def process_message(
18 | self, peer, mailfrom, rcpttos, data, mail_options=None, rcpt_options=None
19 | ):
20 | logger.info("Received a new message")
21 |
22 | # Save the original body for processing
23 | body_original = data.decode("utf-8", errors="replace") # Replace invalid bytes
24 |
25 | # Create a lowercase version for keyword matching
26 | body_lower = body_original.lower()
27 |
28 | # Extract 6-digit code if present
29 | match = re.search(r"(\d{6})
", body_original)
30 | code = match.group(1) if match else None
31 |
32 | # Detect specific email types
33 | is_registered = "registration complete" in body_lower
34 | is_password = "password reset" in body_lower
35 | is_verification = "verify email" in body_lower
36 |
37 | # Gather all recipient email addresses
38 | parsed_mime_message = email.message_from_bytes(data)
39 | to = parsed_mime_message.get("To")
40 | emails = [to, *rcpttos]
41 |
42 | # Process and log based on email type
43 | for mail in emails:
44 | if mail: # Ensure the email address is valid
45 | if is_password:
46 | logger.info(f"email={mail} type=password code={code}")
47 | elif code: # Default to activation when code present
48 | logger.info(f"email={mail} type=activation code={code}")
49 | database_client["codes"].insert_one({"code": code, "email": mail})
50 | logger.info(f"email={mail} type=code_saved")
51 | elif is_registered:
52 | logger.info(f"email={mail} type=registered")
53 | else:
54 | logger.info(f"email={mail} type=other No code found")
55 |
56 | # Show whole email if verifying a relay destination address
57 | # Process after main paths. Raw email chars may be problematic
58 | if is_verification:
59 | try:
60 | logger.info(f"type=verification Full email body:\n{body_original}")
61 | except Exception as e:
62 | logger.error(f"type=verification_failed Could not log email body. Error: {e}")
63 |
64 |
65 | if __name__ == "__main__":
66 | mail_server_config = config.mailserver
67 | if mail_server_config is None:
68 | logger.info("Mail server config not found. MailServer disabled.")
69 | while True:
70 | time.sleep(6000000)
71 | server = CustomSMTPServer((mail_server_config.host, mail_server_config.port), None)
72 | logger.info(
73 | f"Server running on {mail_server_config.host}:{mail_server_config.port}"
74 | )
75 | asyncore.loop()
76 |
--------------------------------------------------------------------------------
/ptc/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | # Database, where all data is stored
3 | mongodb:
4 | container_name: klinklang-database
5 | environment:
6 | MONGO_INITDB_ROOT_PASSWORD: mongoadmin
7 | MONGO_INITDB_ROOT_USERNAME: mongodb
8 | image: mongo:6-jammy
9 | logging:
10 | driver: json-file
11 | options:
12 | max-file: '3'
13 | max-size: 1m
14 | networks:
15 | - klinklang_net
16 | ports:
17 | - 27017:27017
18 | restart: unless-stopped
19 | volumes:
20 | - ./database:/data/db
21 | # Service for exporting accounts to Dragonite/RDM database
22 | account_exporter:
23 | container_name: klingklang-account_exporter
24 | depends_on:
25 | - mongodb
26 | extra_hosts:
27 | - host.docker.internal:host-gateway
28 | build:
29 | context: .
30 | dockerfile: account_exporter/Dockerfile
31 | logging:
32 | driver: json-file
33 | options:
34 | max-file: '3'
35 | max-size: 1m
36 | networks:
37 | - klinklang_net
38 | restart: unless-stopped
39 | volumes:
40 | - ./config.yml:/app/config.yml
41 | # add mounts for live edits
42 | #- ./account_exporter/index.py:/app/index.py
43 | # service for collecting different stats about your generations
44 | stats_collector:
45 | container_name: klingklang-stats_collector
46 | depends_on:
47 | - mongodb
48 | extra_hosts:
49 | - host.docker.internal:host-gateway
50 | build:
51 | context: .
52 | dockerfile: stats_collector/Dockerfile
53 | logging:
54 | driver: json-file
55 | options:
56 | max-file: '3'
57 | max-size: 1m
58 | networks:
59 | - klinklang_net
60 | restart: unless-stopped
61 | volumes:
62 | - ./config.yml:/app/config.yml
63 |
64 | # Service for accepting emails and reading the code from them
65 | mail_server:
66 | container_name: klingklang-mail_server
67 | depends_on:
68 | - mongodb
69 | extra_hosts:
70 | - host.docker.internal:host-gateway
71 | build:
72 | context: .
73 | dockerfile: mail_server/Dockerfile
74 | logging:
75 | driver: json-file
76 | options:
77 | max-file: '3'
78 | max-size: 1m
79 | networks:
80 | - klinklang_net
81 | restart: unless-stopped
82 | volumes:
83 | - ./config.yml:/app/config.yml
84 | ports:
85 | - "25:25"
86 |
87 | # Service for logging into a mailbox and reading the emails
88 | mail_reader:
89 | container_name: klingklang-mail_reader
90 | depends_on:
91 | - mongodb
92 | extra_hosts:
93 | - host.docker.internal:host-gateway
94 | build:
95 | context: .
96 | dockerfile: mail_reader/Dockerfile
97 | logging:
98 | driver: json-file
99 | options:
100 | max-file: '3'
101 | max-size: 1m
102 | networks:
103 | - klinklang_net
104 | restart: unless-stopped
105 | volumes:
106 | - ./config.yml:/app/config.yml
107 |
108 | networks:
109 | klinklang_net:
110 | driver: bridge
111 |
--------------------------------------------------------------------------------
/ptc/account_generation/config.py:
--------------------------------------------------------------------------------
1 | import os
2 | from typing import List, Optional
3 | from urllib.parse import quote_plus
4 |
5 | import pymongo
6 | import yaml
7 | from klinklang import logger
8 | from pydantic import BaseModel, model_validator
9 |
10 | file_dir = os.path.dirname(os.path.abspath(__file__))
11 |
12 |
13 | class Database(BaseModel):
14 | database_name: str
15 | host: str
16 | password: str
17 | username: str
18 |
19 | @property
20 | def url(self):
21 | return "mongodb://%s:%s@%s" % (
22 | quote_plus(self.username),
23 | quote_plus(self.password),
24 | f"{self.host}/",
25 | )
26 |
27 | @property
28 | def database(self) -> pymongo.MongoClient:
29 | return pymongo.MongoClient(self.url)
30 |
31 | def client(self):
32 | return self.database[self.database_name]
33 |
34 |
35 | class Domain(BaseModel):
36 | domain_name: str
37 |
38 |
39 | class Proxy(BaseModel):
40 | proxy: str = None
41 | rotating: bool = False
42 |
43 |
44 | class AccountSaveConfig(BaseModel):
45 | save_to_file: bool = False
46 | format: str = "{email}, {username}, {password}, {dob}"
47 |
48 |
49 | class Config(BaseModel):
50 | database: Database
51 | domains: List[Domain]
52 | proxies: Optional[List[Proxy]] = []
53 | accounts: AccountSaveConfig = AccountSaveConfig()
54 | proxy_file: str = None
55 | show_total_accounts: bool = False
56 | show_chart: bool = True # New flag to control the domain account chart
57 | headless: bool = True
58 | names_generator: bool = False
59 | account_password: Optional[str] = None
60 | mail_prefix: Optional[str] = None
61 | proxy_region: Optional[str] = None
62 | random_subdomain: bool = False
63 | subdomain_length: int = 32
64 | proxy_cooldown: int = 1900
65 | binary_location: Optional[str] = None
66 | email_code_waiting_max: int = 180
67 | additional_sleep_time: int = 0
68 | webdriver_max_wait: int = 30
69 | network_blocks: Optional[List[str]] = None
70 | max_accounts_per_domain: Optional[int] = -1 # Default to -1 for unlimited accounts
71 |
72 | @model_validator(mode="after")
73 | def load_proxie_file(self):
74 | proxie_file = self.proxy_file
75 | proxies: List[Proxy] = self.proxies
76 |
77 | if proxie_file:
78 | logger.info(f"Loading proxies from {os.path.join(file_dir, proxie_file)}")
79 | with open(os.path.join(file_dir, proxie_file), "r") as f:
80 | loaded_proxies = f.readlines()
81 |
82 | for proxy in loaded_proxies:
83 | proxy = proxy.strip()
84 | rotating = False
85 | if proxy.endswith("/rotating"):
86 | rotating = True
87 | proxy = proxy.replace("/rotating", "")
88 | if proxy:
89 | proxies.append(Proxy(proxy=proxy, rotating=rotating))
90 | self.proxies = proxies
91 | if self.max_accounts_per_domain == -1:
92 | logger.info("No max_accounts_per_domain specified; defaulting to unlimited accounts.")
93 | else:
94 | logger.info(f"Max accounts per domain set to {self.max_accounts_per_domain}.")
95 |
96 |
97 | def load_config():
98 | logger.info("Loading config...")
99 | with open(os.path.join(file_dir, "config.yml"), "r") as f:
100 | config = yaml.safe_load(f)
101 | logger.info("Loaded config")
102 | return Config(**config)
103 |
--------------------------------------------------------------------------------
/google/smspool.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | import requests
4 | from pydantic import BaseModel
5 | from typing import List
6 |
7 | URL = "https://api.smspool.net"
8 |
9 |
10 | class Pool(BaseModel):
11 | ID: int
12 | name: str
13 |
14 |
15 | class Country(BaseModel):
16 | ID: int
17 | name: str
18 | short_name: str
19 | cc: str
20 | region: str
21 |
22 |
23 | class Service(BaseModel):
24 | ID: int
25 | name: str
26 | favourite: int
27 |
28 |
29 | class Pricing(BaseModel):
30 | service: int
31 | service_name: str
32 | country: int
33 | country_name: str
34 | short_name: str
35 | pool: int
36 | price: float
37 |
38 |
39 | class OrderResponse(BaseModel):
40 | success: int
41 | number: int
42 | cc: str
43 | phonenumber: str
44 | order_id: str
45 | orderid: str
46 | country: str
47 | service: str
48 | pool: int
49 | expires_in: int
50 | expiration: int
51 | message: str
52 | cost: str
53 | current_balance: str
54 |
55 |
56 | class SMSPool:
57 | def __init__(self, api_key: str, service_name: str):
58 | self.api_key = api_key
59 | self._headers = {"Authorization": f"Bearer {self.api_key}"}
60 |
61 | self._countries = self.country_list()
62 | self._service = Service(**{"ID": 395, "name": "Google/Gmail", "favourite": 0})
63 |
64 | def order_history(self, phone_number: str = None):
65 | url = f"{URL}/request/history"
66 | resp = requests.post(url, params={"key": self.api_key}, headers=self._headers)
67 | if phone_number:
68 | return [item for item in resp.json() if item["phonenumber"] == phone_number]
69 | return resp.json()
70 |
71 | def country_list(self) -> List[Country]:
72 | url = f"{URL}/country/retrieve_all"
73 | resp = requests.get(url, headers=self._headers)
74 | return [Country(**item) for item in resp.json()]
75 |
76 | def service_list(self) -> List[Service]:
77 | url = f"{URL}/service/retrieve_all"
78 | resp = requests.get(url, headers=self._headers)
79 | return [Service(**item) for item in resp.json()]
80 |
81 | def pool_list(self) -> List[Pool]:
82 | url = f"{URL}/pool/retrieve_all"
83 | resp = requests.post(url, headers=self._headers)
84 | return [Pool(**item) for item in resp.json()]
85 |
86 | def order_sms(
87 | self, service: Service, option: str = "cheapest", ignore_countries: list = None
88 | ) -> OrderResponse:
89 | ignore_countries = ignore_countries or []
90 | best_option = self.best_option(
91 | service=service, option=option, nr_of_options=100000
92 | )
93 |
94 | for option in best_option:
95 | if option.country_name in ignore_countries:
96 | print(f"{option=} skipped")
97 | continue
98 | if option.country in ignore_countries:
99 | print(f"{option=} skipped")
100 | continue
101 | resp = requests.post(
102 | f"{URL}/purchase/sms",
103 | headers=self._headers,
104 | params={
105 | "service": option.service,
106 | "country": option.country,
107 | "pool": option.pool,
108 | "pricing_option": 0,
109 | "quantity": 1,
110 | },
111 | )
112 | if resp.status_code != 200:
113 | print("Order failed")
114 | print(resp.content)
115 | continue
116 | print(resp.json())
117 | return OrderResponse(**resp.json())
118 |
119 | def request_pricing(self, service: Service) -> List[Pricing]:
120 | url = f"{URL}/request/pricing"
121 | resp = requests.post(url, headers=self._headers)
122 | pricings = [Pricing(**item) for item in resp.json()]
123 | return [pricing for pricing in pricings if pricing.service == service.ID]
124 |
125 | def best_option(
126 | self, service: Service, option: str = "cheapest", nr_of_options: int = 1
127 | ) -> List[Pricing]:
128 | if option == "cheapest":
129 | return sorted(self.request_pricing(service=service), key=lambda x: x.price)[
130 | :nr_of_options
131 | ]
132 | else:
133 | pass
134 |
135 | def refund(self, order_id: str):
136 | url = f"{URL}/sms/cancel"
137 | resp = requests.post(url, headers=self._headers, params={"orderid": order_id})
138 | print(resp.json())
139 | return resp.json()
140 |
--------------------------------------------------------------------------------
/ptc/klinklang/core/ptc/__init__.py:
--------------------------------------------------------------------------------
1 | POSSIBLE_REGIONS = {
2 | "United States": "US",
3 | "Canada": "CA",
4 | "Afghanistan": "AF",
5 | "Albania": "AL",
6 | "Algeria": "DZ",
7 | "Andorra": "AD",
8 | "Angola": "AO",
9 | "Anguilla": "AI",
10 | "Antigua and Barbuda": "AG",
11 | "Argentina": "AR",
12 | "Armenia": "AM",
13 | "Aruba": "AW",
14 | "Australia": "AU",
15 | "Austria": "AT",
16 | "Azerbaijan": "AZ",
17 | "Bahamas": "BS",
18 | "Bahrain": "BH",
19 | "Barbados": "BB",
20 | "Belarus": "BY",
21 | "Belgium": "BE",
22 | "Belize": "BZ",
23 | "Benin": "BJ",
24 | "Bolivia": "BO",
25 | "Bosnia and Herzegovina": "BA",
26 | "Botswana": "BW",
27 | "Brazil": "BR",
28 | "Brunei": "BN",
29 | "Bulgaria": "BG",
30 | "Burkina Faso": "BF",
31 | "Burundi": "BI",
32 | "Cameroon": "CM",
33 | "Cayman Islands": "KY",
34 | "Central African Republic": "CF",
35 | "Chad": "TD",
36 | "Chile": "CL",
37 | "China (PRC)": "CN",
38 | "Colombia": "CO",
39 | "Comoros": "KM",
40 | "Costa Rica": "CR",
41 | "Croatia": "HR",
42 | "Curaçao": "CW",
43 | "Cyprus": "CY",
44 | "Czech Republic": "CZ",
45 | "Denmark": "DK",
46 | "Djibouti": "DJ",
47 | "Dominica": "DM",
48 | "Dominican Republic": "DO",
49 | "Ecuador": "EC",
50 | "Egypt": "EG",
51 | "El Salvador": "SV",
52 | "Equatorial Guinea": "GQ",
53 | "Eritrea": "ER",
54 | "Estonia": "EE",
55 | "Eswatini": "SZ",
56 | "Ethiopia": "ET",
57 | "Finland": "FI",
58 | "France": "FR",
59 | "French Guiana": "GF",
60 | "Gabon": "GA",
61 | "Gambia": "GM",
62 | "Georgia": "GE",
63 | "Germany": "DE",
64 | "Ghana": "GH",
65 | "Gibraltar": "GI",
66 | "Greece": "GR",
67 | "Grenada": "GD",
68 | "Guadeloupe": "GP",
69 | "Guam": "GU",
70 | "Guatemala": "GT",
71 | "Guernsey": "GG",
72 | "Guinea-Bissau": "GW",
73 | "Guyana": "GY",
74 | "Haiti": "HT",
75 | "Honduras": "HN",
76 | "Hong Kong": "HK",
77 | "Hungary": "HU",
78 | "Iceland": "IS",
79 | "India": "IN",
80 | "Indonesia": "ID",
81 | "Ireland": "IE",
82 | "Isle of Man": "IM",
83 | "Israel": "IL",
84 | "Italy": "IT",
85 | "Jamaica": "JM",
86 | "Japan": "JP",
87 | "Jersey": "JE",
88 | "Jordan": "JO",
89 | "Kazakhstan": "KZ",
90 | "Kenya": "KE",
91 | "Kuwait": "KW",
92 | "Latvia": "LV",
93 | "Lebanon": "LB",
94 | "Lesotho": "LS",
95 | "Liechtenstein": "LI",
96 | "Lithuania": "LT",
97 | "Luxembourg": "LU",
98 | "Macao": "MO",
99 | "Madagascar": "MG",
100 | "Malawi": "MW",
101 | "Malaysia": "MY",
102 | "Mali": "ML",
103 | "Malta": "MT",
104 | "Martinique": "MQ",
105 | "Mauritania": "MR",
106 | "Mauritius": "MU",
107 | "Mexico": "MX",
108 | "Montenegro": "ME",
109 | "Montserrat": "MS",
110 | "Morocco": "MA",
111 | "Mozambique": "MZ",
112 | "Namibia": "NA",
113 | "Netherlands": "NL",
114 | "Netherlands Antilles": "AN",
115 | "New Zealand": "NZ",
116 | "Nicaragua": "NI",
117 | "Niger": "NE",
118 | "Nigeria": "NG",
119 | "Norway": "NO",
120 | "Oman": "OM",
121 | "Pakistan": "PK",
122 | "Panama": "PA",
123 | "Paraguay": "PY",
124 | "Peru": "PE",
125 | "Philippines": "PH",
126 | "Poland": "PL",
127 | "Portugal": "PT",
128 | "Qatar": "QA",
129 | "Romania": "RO",
130 | "Russian Federation": "RU",
131 | "Rwanda": "RW",
132 | "Saint Kitts and Nevis": "KN",
133 | "Saint Lucia": "LC",
134 | "Saint Vincent and the Grenadines": "VC",
135 | "San Marino": "SM",
136 | "Sao Tome and Principe": "ST",
137 | "Saudi Arabia": "SA",
138 | "Senegal": "SN",
139 | "Serbia": "RS",
140 | "Serbia and Kosovo": "XK",
141 | "Seychelles": "SC",
142 | "Sierra Leone": "SL",
143 | "Singapore": "SG",
144 | "Sint Maarten": "SX",
145 | "Slovakia (Slovak Republic)": "SK",
146 | "Slovenia": "SI",
147 | "Somalia": "SO",
148 | "South Africa": "ZA",
149 | "Spain": "ES",
150 | "Sudan": "SD",
151 | "Suriname": "SR",
152 | "Sweden": "SE",
153 | "Switzerland": "CH",
154 | "Taiwan": "TW",
155 | "Tajikistan": "TJ",
156 | "Togo": "TG",
157 | "Trinidad and Tobago": "TT",
158 | "Tunisia": "TN",
159 | "Turkey": "TR",
160 | "Turkmenistan": "TM",
161 | "Turks and Caicos Islands": "TC",
162 | "Uganda": "UG",
163 | "Ukraine": "UA",
164 | "United Arab Emirates": "AE",
165 | "United Kingdom (Great Britain)": "GB",
166 | "Uruguay": "UY",
167 | "Uzbekistan": "UZ",
168 | "Vatican City": "VA",
169 | "Venezuela": "VE",
170 | "Virgin Islands (British)": "VG",
171 | "Virgin Islands (U.S.)": "VI",
172 | "Yemen": "YE",
173 | "Zambia": "ZM",
174 | "Zimbabwe": "ZW",
175 | }
176 |
177 | PossibleMonths = [
178 | "January",
179 | "February",
180 | "March",
181 | "April",
182 | "May",
183 | "June",
184 | "July",
185 | "August",
186 | "September",
187 | "October",
188 | "November",
189 | "December",
190 | ]
191 |
--------------------------------------------------------------------------------
/google_oauth/helper.py:
--------------------------------------------------------------------------------
1 | from selenium.webdriver.common.by import By
2 | from selenium.webdriver.support import expected_conditions as EC
3 | from selenium.webdriver.support.ui import WebDriverWait
4 | from seleniumbase import Driver
5 | import time
6 |
7 | # 2captcha API key
8 | API_KEY = "cbad27ee8123a388a"
9 |
10 |
11 | def create_driver(counter: int = 0):
12 | try:
13 | kwargs = {}
14 | browser_name = "chrome"
15 | print(f"Starting {browser_name} Driver...")
16 | chromium_args = "--lang=en-us, --disable-features=OptimizationGuideModelDownloading,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationHints"
17 | kwargs["chromium_arg"] = chromium_args
18 | driver = Driver(uc=True, headless2=False, **kwargs)
19 | driver.delete_all_cookies()
20 |
21 | print("Refreshing cookies")
22 |
23 | # driver.get("https://www.google.com/recaptcha")
24 | # cookie = {
25 | # "name": "_GRECAPTCHA",
26 | # "value": "09AGteOyrvsastbYNXyN7iBK8ouEooHbQJ9mv92BXxuenaNGZgM_4ElN3az9FXYUiIEOSNPd5aUX98wu65zOsEeUU",
27 | # "domain": "www.google.com",
28 | # "path": "/recaptcha",
29 | # "expiry": int(time.time()) + 31536000, # 1 year from now,
30 | # }
31 | #
32 | # driver.add_cookie(cookie)
33 |
34 | return driver
35 | except Exception as exc:
36 | print(f"Failed to start driver ... Trying again. {exc}")
37 | if counter <= 10:
38 | return create_driver(counter=counter + 1)
39 | raise
40 |
41 |
42 | def input_email(driver, username):
43 | email_input = driver.find_element(By.CSS_SELECTOR, "input[type='email']")
44 | driver.execute_script(f"arguments[0].value = '{username}';", email_input)
45 | # email_input.uc_click()
46 | # driver.uc_gui_press_keys(username)
47 | time.sleep(5)
48 | next_button = driver.find_element(By.XPATH, "//button[contains(., 'Next')]")
49 | next_button.uc_click()
50 | time.sleep(5)
51 |
52 |
53 | def check_for_captcha(driver, counter: int = 0):
54 | # time.sleep(5)
55 | try:
56 | iframe = driver.find_element(
57 | By.XPATH, "//iframe[@title='recaptcha challenge expires in two minutes']"
58 | )
59 | print("Captcha found")
60 | except Exception as e:
61 | print(e)
62 | print("No Captcha found")
63 | return
64 |
65 | # # handle captcha
66 | time.sleep(2)
67 | if counter == 0:
68 | driver.uc_gui_click_rc()
69 | #span_element = driver.find_element(By.XPATH, "//div[contains(@class, 'rc-anchor-center-item')]")
70 | #span_element.click()
71 | #time.sleep(5)
72 | driver.switch_to.frame(iframe)
73 | print("sending to 2captcha")
74 | # iframe = driver.find_element(By.XPATH,
75 | # "//iframe[@title='recaptcha challenge expires in two minutes']")
76 |
77 | # Get the name of the iframe
78 | # iframe_name = iframe.get_attribute("name")
79 | # iframe_src = iframe.get_attribute("src")
80 | token_input = driver.find_element(By.XPATH, "//input[@id='recaptcha-token']")
81 | # Use JavaScript to make the element visible
82 | #driver.execute_script("arguments[0].style.display = 'block';", token_input)
83 |
84 | verify_button = driver.find_element(By.ID, "recaptcha-verify-button")
85 | errors = [
86 | driver.find_element(
87 | By.XPATH, "//div[@class='rc-imageselect-incorrect-response']"
88 | ),
89 | driver.find_element(
90 | By.XPATH, "//div[@class='rc-imageselect-error-select-more']"
91 | ),
92 | driver.find_element(
93 | By.XPATH, "//div[@class='rc-imageselect-error-dynamic-more']"
94 | ),
95 | driver.find_element(
96 | By.XPATH, "//div[@class='rc-imageselect-error-select-something']"
97 | ), # driver.find_element(By.XPATH, "//div[@class='rc-anchor-error-msg-container']")
98 | ]
99 | print(driver.current_url)
100 | print("Found token input")
101 | from twocaptcha import TwoCaptcha
102 |
103 | solver = TwoCaptcha(API_KEY)
104 | result = solver.recaptcha(
105 | sitekey="6LdD2OMZAAAAAAv2xVpeCk8yMtBtY3EhDWldrBbh", # sitekey
106 | url=driver.current_url,
107 | )
108 | print(result)
109 | result_code = result["code"]
110 | print(result_code)
111 | time.sleep(100)
112 | driver.execute_script(f"arguments[0].value = '{result_code}';", token_input)
113 | try:
114 | verify_button.click()
115 | except:
116 | print("Failed to click verify button")
117 | driver.switch_to.default_content()
118 | check_for_captcha(driver, 0)
119 |
120 | for error in errors:
121 | print(error.get_attribute("style"))
122 | if error.get_attribute("style") != "display: none;":
123 | print(f"Captcha error: {error.text}")
124 | solver.report(result["captchaId"], False)
125 |
126 | # button = driver.find_element(By.XPATH, "//button[@id='recaptcha-reload-button']")
127 | # button.click()
128 | # print('reloaded captcha')
129 | driver.switch_to.default_content()
130 | return check_for_captcha(driver, counter + 1)
131 | driver.switch_to.default_content()
132 | print("Captcha handled")
133 | check_for_captcha(driver, counter + 1)
134 |
135 |
136 | def handle_login(login_url, username, password):
137 | driver = create_driver()
138 | driver.uc_open_with_reconnect(login_url, 4)
139 | print(driver.current_url)
140 | input_email(driver, username)
141 | check_for_captcha(driver)
142 | time.sleep(30)
143 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Klinklang
3 |
4 | A new, super-fast PTC account generator
5 |
6 |
7 | ## Setup
8 | The Klinklang stack consists of a MongoDB database, a Stats collector, a mail reader/server, and the account_generation Python script. The account_generation script gets run outside of Docker while the rest of the components are separated into their own Docker containers.
9 |
10 | ### Requirements
11 | The Docker containers and the account_generation script can run on separate hosts or on the same host. Each host has its own requirements, if using one host for all components you must meet all requirements:
12 | 1. Linux (x86/ARM), Mac OS (x86/ARM), or Windows (x86) are supported
13 | - The Docker containers can run headless
14 | - The account_generation script requires a desktop environment despite running headless
15 | 2. Host running account_generation script:
16 | - Google Chrome installed on host OS
17 | - Python 3.11
18 | - pip
19 | - PyYAML (`pip install pyYaml`)
20 | 3. Host running Docker containers:
21 | - Docker, with Docker components
22 | 4. Klinklang license (`$help` in any channel in the Klinklang Discord server)
23 | 5. *Optional:* Proxies (Basic Auth and IP Auth supported, see [FAQ](#can-i-use-basicauth-for-my-proxies))
24 |
25 | ### Initial Setup
26 | 1. Install additional requirements for account_generation script host: `pip install -r account_generation/requirements.txt`
27 | 2. Create and customize configurations: `python configgenerator.py`
28 | - Answer all questions, it will create your configs based on your answers
29 | 3. Create config for account_generation script: `cp account_generation/config.example.yml account_generation/config.yml`
30 | 4. Edit config.yml from the previous step according to your needs (see [AccountGeneration Config](#accountgeneration-config) for more info)
31 | 5. Start Docker containers if not started (`docker compose up -d`). Start Account Generation script (`python account_generation/account_generator.py`)
32 |
33 | ## AccountGeneration Config
34 | Example config.yml with default values:
35 | ```yaml
36 | database:
37 | database_name: klinklang
38 | host: databasehost
39 | password: mongoadmin
40 | username: mongodb
41 | domains:
42 | - domain_name: mail.i-love-imperva.de
43 | proxies:
44 | - proxy: 123.123.123
45 | rotating: false
46 | - proxy: 123.123.124
47 | accounts:
48 | save_to_file : true
49 | format: '{email}, {username}, {password}, {dob}'
50 | proxy_file: proxies.txt
51 | license: my_fancy_license
52 | show_total_accounts: false
53 | headless : true
54 | account_password : 'MYFancyPassword99#'
55 | mail_prefix: my_fancy_prefix
56 | proxy_region: Germany
57 | random_subdomain: true
58 | subdomain_length: 32
59 | proxy_cooldown : 1900
60 | binary_location: ''
61 | ```
62 | #### Details: (* = *required*)
63 |
64 | 1. *`database`: Configuration for your Database Connection
65 | - `database_name`: the name of your database
66 | - `host`: the host of your database (can be ip or hostname)
67 | - `password`: the password of your database
68 | - `username`: the username of your database
69 |
70 | 2. *`domains`: Configuration for the domains, which should be used for account generation, this is a list
71 | - `domain_name`: the domain used for emails, example: `mail.i-love-imperva.de` would generate emails with format `{account_name}@mail.i-love-imperva.de`
72 |
73 | 3. *`proxies`: List of proxies to use. Not required if using proxy_file or if not using proxies at all
74 | - `proxy`: The ip and port of your proxy example `https://123.123.123.3:9000`
75 | - `rotating`: default `False`, if `True` the proxy will not have any cooldown between usages, your proxy provider will handle the rotation
76 |
77 | 4. *`accounts`: Configuration for storing your generated accounts to files
78 | - `save_to_file`: if `True` the accounts will be saved to a file
79 | - `format`: The format in which the accounts should be stored in the file. `{email}` will be replace with the account email, `{username}` with the username, `password` with the password, `{dob}` with the date of birth, `{region}` will be replaced with the region
80 |
81 | 5. *`proxy_file`: The name of the file containing a list of proxies to use. Not required if using proxies list in config or not using proxies at all
82 | - format is `ip:port` or `user:pass@host:port`. If you add a `/rotating` behind the proxy it will be marked as rotating, for example: `ip:port/rotating`
83 |
84 | 6. *`license`: Your license key, if not given the program will give you a prompt
85 |
86 | 7. `show_total_accounts`: if set to true, will display the total count of generated accounts after each generation attempt
87 |
88 | 8. `headless`: `true` is the default, set it to `false` if you want to see the browser window, nice for debugging
89 |
90 | 9. `account_password`: if set all accounts will have the same password, if not a new random password will be generated
91 |
92 | 10. `mail_prefix`: if set klinklang will generate accounts using the plus technique. This will generate emails like `{prefix}+{username}@{domain}`
93 |
94 | 11. `proxy_region`: if set klinklang will not attempt to auto-detect the region of the proxy, it will use the defined region for account information
95 |
96 | 12. `random_subdomain`: if set to true, klinklang will generate random subdomains for every account, for this your domain should support a catch all (e.g. `true` results in `randomsubdomain.i-love-imperva.de`)
97 |
98 | 13. `subdomain_length`: set a custom length for random subdomains, if enabled
99 |
100 | 14. `proxy_cooldown`: default 1900, the cooldown between the usage of the proxies in seconds. Decreasing this will increase the risk of your proxies getting blocked but increases the potential speed at which you can create accounts.
101 |
102 | 15. `binary_location`: if set the defined binary will be used instead of the installed chrome version. For example if you have both Google Chrome and Brave installed on your mac (Chrome as default browser) and you want to use Brave you would add to your config `binary_location: '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'`
103 |
104 | 16. `email_code_waiting_max`: set the max attempts for waiting for the code from the email, default is 180
105 | ## FAQ
106 |
107 | #### What is the difference between MailReader and MailServer?
108 | MailServer is an IMAP server (mailserver) that you host yourself. For it to function properly you need to add all needed MX-Records to your domain so that the server can get emails. You can send a test email to your domain, and test if the message appears in the logs. If the received message contains a verification code from PTC, the code will be added to the database for later usage in account activation.
109 |
110 | MailReader is a service which can be used to read emails from a provider, e.g. if your domain provider already provides you with a mail server. It will login using the provided username and password to your mail account and will read all messages. If the message contains a verification code it will be saved to the database for later usage in account activation. Messages from niantic will be deleted after they are read.
111 |
112 | You need one or the other, *not both*.
113 |
114 | #### Do I need to host a database just for Klinklang?
115 | No. One of the included Docker containers is a MongoDB container which is already set up as needed - just customize your configuration files and start it up.
116 |
117 | #### What should I set for account_workers and cookie_workers?
118 | These settings can be ignored, they are left over from previous code and are not used.
119 |
120 | #### What proxy provider should I use?
121 | This is something that is generally kept secret as higher usage increases the chance of the proxy being banned. Based on user reports in Discord, Webshare is generally banned. Residential proxies are often considered "better" when it comes to not being banned already however this is anecdotal.
122 |
123 | #### Can I use BasicAuth for my proxies?
124 | While technically supported most users report this does not work for them. If you want to try using BasicAuth make sure you use the format `USER:PASS@IP:PORT`
125 |
126 | #### Can I run the account_generation script in PM2?
127 | Yes. It is suggested you set your license in your config, then you can `pm2 start` as normal. If you need to specify your Python interpreter / if using venv just include the `--interpreter` flag.
128 |
129 | Example: `pm2 start path/account_generator.py --name klinklang --interpreter /path/to/venv/bin/python`
130 |
131 |
132 | ## Common Issues
133 |
134 | #### Python error mentioning `undefined symbol`
135 | Wrong Python version in use, make sure you are using Python 3.11
136 |
137 | #### Python error `ModuleNotFoundError`
138 | Reinstall requirements: `pip install -r account_generation/requirements.txt`
139 |
140 |
--------------------------------------------------------------------------------
/ptc/account_exporter/index.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import time
3 |
4 | import mysql.connector
5 | import requests
6 | from klinklang.core.config import read_config, AccountExportConfig
7 |
8 | from klinklang import logger
9 | from klinklang.core.db_return import db_return
10 |
11 | # Load configuration
12 | config = read_config()
13 | logger.info("Config loaded")
14 | database_client = config.database.client()
15 | account_table = database_client["accounts"]
16 | stats_table = database_client["stats"]
17 | already_exported_accounts_table = database_client["exported_accounts"]
18 |
19 | # Function to fetch accounts from MongoDB
20 | def get_klinklang_accounts():
21 | return db_return(account_table.find())
22 |
23 | # Function to fetch already exported accounts
24 | def get_exported_klinklang_accounts():
25 | return db_return(already_exported_accounts_table.find())
26 |
27 |
28 | # Function to get existing accounts from MariaDB
29 | def get_existing_accounts_from_db(export_config: AccountExportConfig) -> set:
30 | db_connection = mysql.connector.connect(
31 | host=export_config.host,
32 | user=export_config.username,
33 | password=export_config.password,
34 | database=export_config.db_name,
35 | port=export_config.port,
36 | )
37 | cursor = db_connection.cursor()
38 |
39 | # Query existing accounts from the specified table
40 | cursor.execute(f"SELECT username FROM {export_config.table_name}")
41 | existing_usernames = {row[0] for row in cursor.fetchall()}
42 |
43 | cursor.close()
44 | db_connection.close()
45 | return existing_usernames
46 |
47 |
48 | # Function to insert accounts into MariaDB
49 | def insert_to_db(export_config, export_candidates):
50 | logger.info(f"Got {len(export_candidates)} export candidates")
51 |
52 | insert_query = (
53 | #f"INSERT INTO {export_config.table_name} (username, password, last_released) "
54 | #f"VALUES (%s, %s, %s)"
55 | f"INSERT INTO {export_config.table_name} (username, password) "
56 | f"VALUES (%s, %s)"
57 | )
58 |
59 | db_connection = mysql.connector.connect(
60 | host=export_config.host,
61 | user=export_config.username,
62 | password=export_config.password,
63 | database=export_config.db_name,
64 | port=export_config.port,
65 | )
66 | cursor = db_connection.cursor()
67 |
68 | # Insert the export candidates
69 | cursor.executemany(
70 | insert_query,
71 | #[(account["username"], account["password"], 1) for account in export_candidates],
72 | [(account["username"], account["password"]) for account in export_candidates],
73 | )
74 | db_connection.commit()
75 | cursor.close()
76 | db_connection.close()
77 | logger.info("Export done")
78 |
79 |
80 | # Function to get the number of accounts generated in the last hour
81 | def get_account_generated_last_hour():
82 | now = int(time.time())
83 | stats = db_return(stats_table.find({"name": "generated_accounts"}))
84 | if not stats:
85 | logger.info("No stats found for 'generated_accounts'. Returning 0.")
86 | return 0
87 |
88 | usable_stats = sorted(
89 | [stat for stat in stats if stat["time"] >= (now - 3600)],
90 | key=lambda x: x["time"],
91 | reverse=True,
92 | )
93 |
94 | if len(usable_stats) < 2:
95 | logger.info("Not enough stats to calculate accounts generated in the last hour. Returning 0.")
96 | return 0
97 |
98 | return usable_stats[0]["accounts"] - usable_stats[-1]["accounts"]
99 |
100 |
101 | # Function to send a Discord notification
102 | def send_discord_message(exported_accounts: int, export_config: AccountExportConfig):
103 | generated_count = get_account_generated_last_hour()
104 |
105 | if generated_count == 0:
106 | color = 0xFF0000
107 | elif generated_count >= 100:
108 | color = 0x00FF00
109 | else:
110 | color = 0xFFFF00
111 |
112 | # Build the Discord message payload
113 | data = {
114 | "content": "",
115 | "username": "Klinklang",
116 | "avatar_url": "https://github.com/GhostTalker/icons/blob/main/PoGo/klingKlang_favicon.png?raw=true",
117 | "embeds": [
118 | {
119 | "title": "Klinklang Status Report",
120 | "color": color,
121 | "thumbnail": {
122 | "url": "https://github.com/GhostTalker/icons/blob/main/PoGo/dbsync2.png?raw=true"
123 | },
124 | "fields": [
125 | {
126 | "name": "Created Acc via KlingKlang",
127 | "value": str(generated_count),
128 | "inline": True,
129 | },
130 | {
131 | "name": f"Synced with {export_config.destination}",
132 | "value": str(exported_accounts),
133 | "inline": True,
134 | },
135 | ],
136 | "description": f"Hourly sync from Klinklang to {export_config.destination} completed successfully.",
137 | "timestamp": str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")),
138 | }
139 | ],
140 | }
141 |
142 | # Send the payload to Discord
143 | headers = {"Content-Type": "application/json"}
144 | response = requests.post(export_config.webhook, json=data, headers=headers)
145 | logger.info(f"Discord notification status: {response.status_code}")
146 |
147 | # Function to export accounts from MongoDB to MariaDB
148 | def export_accounts(export_config: AccountExportConfig, limit=None, dry_run=False):
149 | """
150 | Export accounts from MongoDB to MariaDB.
151 |
152 | Args:
153 | export_config (AccountExportConfig): Configuration for database export.
154 | limit (int, optional): Limit on the number of accounts to process. Default is None (all accounts).
155 | dry_run (bool): If True, simulate the export without writing to any database. Default is False.
156 | """
157 | logger.info(f"Starting account exporter. Config: {export_config}, dry run: {dry_run}")
158 |
159 | if export_config is None:
160 | logger.info("No export config found. Export disabled")
161 | return
162 |
163 | # Step 1: Retrieve accounts
164 | klinklang_accounts = list(get_klinklang_accounts())
165 | if limit:
166 | klinklang_accounts = klinklang_accounts[:limit]
167 | logger.info(f"Fetched {len(klinklang_accounts)} accounts from Klinklang")
168 |
169 | # Step 2: Retrieve already-exported and existing accounts
170 | exported_accounts = {
171 | doc["username"] for doc in db_return(already_exported_accounts_table.find())
172 | }
173 | logger.info(f"Fetched {len(exported_accounts)} already-exported accounts from MongoDB")
174 |
175 | db_accounts = get_existing_accounts_from_db(export_config=export_config)
176 | logger.info(f"Fetched {len(db_accounts)} accounts from MariaDB")
177 |
178 | # Step 3: Identify export candidates
179 | export_candidates = [
180 | account for account in klinklang_accounts
181 | if account["username"] not in exported_accounts and account["username"] not in db_accounts
182 | ]
183 | logger.info(f"Identified {len(export_candidates)} export candidates")
184 |
185 | if dry_run:
186 | # Dry run: Log candidates and return
187 | logger.info(f"Sample export candidates: {export_candidates[:5]}")
188 | else:
189 | # Real export: Write to databases
190 | if export_candidates:
191 | insert_to_db(export_config, export_candidates)
192 | already_exported_accounts_table.insert_many(
193 | [{"username": account["username"]} for account in export_candidates]
194 | )
195 | logger.info("Export completed successfully")
196 | else:
197 | logger.info("No candidates to export. Skipping database writes.")
198 |
199 | # Always send a Discord notification
200 | logger.info("Sending Discord message")
201 | send_discord_message(
202 | exported_accounts=len(export_candidates), export_config=export_config
203 | )
204 |
205 | return
206 |
207 |
208 | if __name__ == "__main__":
209 | logger.info(f"Starting account exporter. Used config: {config.export}")
210 |
211 | send = False
212 | while True:
213 | now = datetime.datetime.now(datetime.timezone.utc)
214 | if now.minute == 0:
215 | if not send:
216 | export_accounts(export_config=config.export)
217 | #dev_export_accounts(export_config=config.export)
218 | send = True
219 | else:
220 | send = False
221 | time.sleep(1)
222 |
--------------------------------------------------------------------------------
/ptc/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Klinklang
3 |
4 | A new, super-fast PTC account generator
5 |
6 |
7 | ## Setup
8 | The Klinklang stack consists of a MongoDB database, a Stats collector, a mail reader/server, and the account_generation Python script. The account_generation script gets run outside of Docker while the rest of the components are separated into their own Docker containers.
9 |
10 | ### Requirements
11 | The Docker containers and the account_generation script can run on separate hosts or on the same host. Each host has its own requirements, if using one host for all components you must meet all requirements:
12 | 1. Linux (x86/ARM), Mac OS (x86/ARM), or Windows (x86) are supported
13 | - The Docker containers can run headless
14 | - The account_generation script requires a desktop environment despite running headless
15 | 2. Host running account_generation script:
16 | - Google Chrome installed on host OS
17 | - Python 3.11
18 | - pip
19 | 3. Host running Docker containers:
20 | - Docker, with Docker components
21 | 4*Optional:* Proxies (Basic Auth and IP Auth supported, see [FAQ](#can-i-use-basicauth-for-my-proxies))
22 |
23 | ### Initial Setup
24 |
25 | #### Server Preparation
26 | 1. Edit the config.yml file in this directory according to your needs (see [KlinklangStack Config](#KlinklangStack Config) for more info)
27 | 2. Start the docker containers with `docker compose up -d`
28 | #### Account Generation Preparation
29 | 1. install klinklang package: `pip install .` (inside this directory)
30 | 2. Install additional requirements for account_generation script host: `pip install -r account_generation/requirements.txt`
31 | 3. Edit the config.yml file in the account_generation directory according to your needs (see [AccountGeneration Config](#accountgeneration-config) for more info)
32 | 4. Run the account_generation script with `python account_generation/index.py`
33 |
34 | ## KlinklangStack Config
35 | Example config.yml with default values:
36 | ```yaml
37 | database:
38 | database_name: klinklang
39 | host: mongodb
40 | password: mongoadmin
41 | username: mongodb
42 | mailreader:
43 | mailbox:
44 | - imap_server: imap.strato.de
45 | password: test
46 | username: test
47 | mailserver:
48 | port: '25'
49 | exporter:
50 | rate: 3600
51 | destination: DRAGONITE
52 | discord: false
53 | webhook: 'https://my-discord-webhook-url'
54 | host: my-dragonite_host
55 | password: my-dragonite_password
56 | username: my-dragonite_username
57 | db_name: my-dragonite_db
58 | table_name: my-dragonite_table
59 | port: 3306
60 | ```
61 | #### Details: (* = *required*)
62 | 1. *`database`: Configuration for your Database Connection (the mongo db one)
63 | - `database_name`: the name of your database
64 | - `host`: the host of your database (can be ip or hostname)
65 | - `password`: the password of your database
66 | - `username`: the username of your database
67 | 2. `mailreader`: Configuration for the mail reader service, if not given the service is disabled
68 | - `mailbox`: a list of mail boxes to which the reader should connect
69 | - `imap_server`: the imap server of your mail provider
70 | - `password`: the password of your mail account
71 | - `username`: the username of your mail account
72 | 3. `mailserver`: Configuration for the mailserver service, if not given the service is disabled
73 | - `port`: the port inside the container on which the mailserver should listen
74 | - `host`: the host inside the container on which the mailserver should listen
75 | 4. `exporter`: Configuration for the service, which exports all accounts to either Dragonite or RDM. if not given the service is disabled
76 | - `rate`: the rate at which the exporter should export the accounts
77 | - `destination`: the destination of the accounts, either `DRAGONITE` or `RDM`
78 | - `discord`: if set to true the exporter will send a message to a discord webhook
79 | - `webhook`: the discord webhook to which the exporter should send the message
80 | - `host`: the host of the database to which the exporter should connect
81 | - `password`: the password of the database to which the exporter should connect
82 | - `username`: the username of the database to which the exporter should connect
83 | - `db_name`: the name of the database to which the exporter should connect
84 | - `table_name`: the name of the table to which the exporter should connect
85 | - `port`: the port of the database to which the exporter should connect
86 | ## AccountGeneration Config
87 | Example config.yml with default values:
88 | ```yaml
89 | database:
90 | database_name: klinklang
91 | host: databasehost
92 | password: mongoadmin
93 | username: mongodb
94 | domains:
95 | - domain_name: mail.i-love-imperva.de
96 | proxies:
97 | - proxy: 123.123.123
98 | rotating: false
99 | - proxy: 123.123.124
100 | accounts:
101 | save_to_file : true
102 | format: '{email}, {username}, {password}, {dob}'
103 | proxy_file: proxies.txt
104 | show_total_accounts: false
105 | headless : true
106 | account_password : 'MYFancyPassword99#'
107 | mail_prefix: my_fancy_prefix
108 | proxy_region: Germany
109 | random_subdomain: true
110 | subdomain_length: 32
111 | proxy_cooldown : 1900
112 | binary_location: ''
113 | ```
114 | #### Details: (* = *required*)
115 |
116 | 1. *`database`: Configuration for your Database Connection
117 | - `database_name`: the name of your database
118 | - `host`: the host of your database (can be ip or hostname)
119 | - `password`: the password of your database
120 | - `username`: the username of your database
121 |
122 | 2. *`domains`: Configuration for the domains, which should be used for account generation, this is a list
123 | - `domain_name`: the domain used for emails, example: `mail.i-love-imperva.de` would generate emails with format `{account_name}@mail.i-love-imperva.de`
124 |
125 | 3. *`proxies`: List of proxies to use. Not required if using proxy_file or if not using proxies at all
126 | - `proxy`: The ip and port of your proxy example `https://123.123.123.3:9000`
127 | - `rotating`: default `False`, if `True` the proxy will not have any cooldown between usages, your proxy provider will handle the rotation
128 |
129 | 4. *`accounts`: Configuration for storing your generated accounts to files
130 | - `save_to_file`: if `True` the accounts will be saved to a file
131 | - `format`: The format in which the accounts should be stored in the file. `{email}` will be replace with the account email, `{username}` with the username, `password` with the password, `{dob}` with the date of birth, `{region}` will be replaced with the region
132 |
133 | 5. *`proxy_file`: The name of the file containing a list of proxies to use. Not required if using proxies list in config or not using proxies at all
134 | - format is `ip:port` or `user:pass@host:port`. If you add a `/rotating` behind the proxy it will be marked as rotating, for example: `ip:port/rotating`
135 |
136 | 6. `show_total_accounts`: if set to true, will display the total count of generated accounts after each generation attempt
137 |
138 | 7. `headless`: `true` is the default, set it to `false` if you want to see the browser window, nice for debugging
139 |
140 | 8. `account_password`: if set all accounts will have the same password, if not a new random password will be generated
141 |
142 | 9. `mail_prefix`: if set klinklang will generate accounts using the plus technique. This will generate emails like `{prefix}+{username}@{domain}`
143 |
144 | 10. `proxy_region`: if set klinklang will not attempt to auto-detect the region of the proxy, it will use the defined region for account information
145 |
146 | 11. `random_subdomain`: if set to true, klinklang will generate random subdomains for every account, for this your domain should support a catch all (e.g. `true` results in `randomsubdomain.i-love-imperva.de`)
147 |
148 | 12. `subdomain_length`: set a custom length for random subdomains, if enabled
149 |
150 | 13. `proxy_cooldown`: default 1900, the cooldown between the usage of the proxies in seconds. Decreasing this will increase the risk of your proxies getting blocked but increases the potential speed at which you can create accounts.
151 |
152 | 14. `binary_location`: if set the defined binary will be used instead of the installed chrome version. For example if you have both Google Chrome and Brave installed on your mac (Chrome as default browser) and you want to use Brave you would add to your config `binary_location: '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'`
153 |
154 | 15. `email_code_waiting_max`: set the max attempts for waiting for the code from the email, default is 180
155 | ## FAQ
156 |
157 | #### What is the difference between MailReader and MailServer?
158 | MailServer is an IMAP server (mailserver) that you host yourself. For it to function properly you need to add all needed MX-Records to your domain so that the server can get emails. You can send a test email to your domain, and test if the message appears in the logs. If the received message contains a verification code from PTC, the code will be added to the database for later usage in account activation.
159 |
160 | MailReader is a service which can be used to read emails from a provider, e.g. if your domain provider already provides you with a mail server. It will login using the provided username and password to your mail account and will read all messages. If the message contains a verification code it will be saved to the database for later usage in account activation. Messages from niantic will be deleted after they are read.
161 |
162 | You need one or the other, *not both*.
163 |
164 | #### Do I need to host a database just for Klinklang?
165 | No. One of the included Docker containers is a MongoDB container which is already set up as needed - just customize your configuration files and start it up.
166 |
167 | #### What should I set for account_workers and cookie_workers?
168 | These settings can be ignored, they are left over from previous code and are not used.
169 |
170 | #### What proxy provider should I use?
171 | This is something that is generally kept secret as higher usage increases the chance of the proxy being banned. Based on user reports in Discord, Webshare is generally banned. Residential proxies are often considered "better" when it comes to not being banned already however this is anecdotal.
172 |
173 | #### Can I use BasicAuth for my proxies?
174 | While technically supported most users report this does not work for them. If you want to try using BasicAuth make sure you use the format `USER:PASS@IP:PORT`
175 |
176 | #### Can I run the account_generation script in PM2?
177 | Yes. It is suggested you set your license in your config, then you can `pm2 start` as normal. If you need to specify your Python interpreter / if using venv just include the `--interpreter` flag.
178 |
179 | Example: `pm2 start path/account_generator.py --name klinklang --interpreter /path/to/venv/bin/python`
180 |
181 |
182 | ## Common Issues
183 |
184 | #### Python error mentioning `undefined symbol`
185 | Wrong Python version in use, make sure you are using Python 3.11
186 |
187 | #### Python error `ModuleNotFoundError`
188 | Reinstall requirements: `pip install -r account_generation/requirements.txt`
189 |
190 |
--------------------------------------------------------------------------------
/google/index.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import os
3 | import random
4 | import time
5 | from itertools import cycle
6 | from pprint import pprint
7 |
8 |
9 | from smspool import SMSPool
10 |
11 | from config import Config, load_config
12 | from klinklang import logger
13 | from klinklang.core.ptc.random_word_gen import RandomWordGen
14 | from selenium.webdriver.common.keys import Keys
15 | from selenium.webdriver.support.select import Select
16 | from seleniumbase import Driver
17 |
18 | word_gen = RandomWordGen()
19 | gen_config = load_config()
20 |
21 |
22 | class GoogleAccountGenerator:
23 | def __init__(self):
24 | self.ignore_countries = []
25 |
26 |
27 | obj = GoogleAccountGenerator()
28 | sms_pool = SMSPool(api_key=gen_config.sms_pool_api_key, service_name="Google/Gmail")
29 |
30 |
31 | def create_driver(config: Config, proxy: str = None, counter: int = 0):
32 | try:
33 | kwargs = {}
34 | if proxy:
35 | kwargs["proxy"] = proxy
36 |
37 | if config.binary_location:
38 | kwargs["binary_location"] = config.binary_location
39 | # kwargs['binary_location'] = '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
40 | browser_name = "chrome"
41 | logger.info(f"Starting {browser_name} Driver...")
42 | chromium_args = "--lang=en-us, --disable-features=OptimizationGuideModelDownloading,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationHints"
43 | kwargs["chromium_arg"] = chromium_args
44 | driver = Driver(uc=True, headless2=config.headless, **kwargs)
45 |
46 | # stealth(driver, languages=["en-US", "en"], vendor="Google Inc.",
47 | # webgl_vendor="Intel Inc.",
48 | # renderer="Intel Iris OpenGL Engine", fix_hairline=True, )
49 | # driver.maximize_window()
50 | driver.delete_all_cookies()
51 |
52 | if config.network_blocks:
53 | logger.info(f"Enabling network blocks: {config.network_blocks}")
54 | driver.execute_cdp_cmd(
55 | "Network.setBlockedURLs",
56 | {
57 | "urls": config.network_blocks,
58 | },
59 | )
60 | driver.execute_cdp_cmd("Network.enable", {})
61 | driver.refresh()
62 |
63 | logger.info("Refreshing cookies")
64 | return driver
65 | except:
66 | logger.error("Failed to start driver ... Trying again.")
67 | if counter <= 10:
68 | return create_driver(proxy=proxy, counter=counter + 1, config=config)
69 | raise
70 |
71 |
72 | def check_correct_page(
73 | driver, page_text: str, counter: int = 0, allow_skip: bool = False
74 | ):
75 | try:
76 | driver.find_element("xpath", f"//span[text()='{page_text}']")
77 | print(f"Entered correct page: {page_text}")
78 | time.sleep(1)
79 | return True
80 | except:
81 | if counter <= 10:
82 | time.sleep(1)
83 | return check_correct_page(
84 | driver=driver,
85 | page_text=page_text,
86 | counter=counter + 1,
87 | allow_skip=allow_skip,
88 | )
89 | else:
90 | if allow_skip:
91 | print(f"skipped page: {page_text}")
92 | time.sleep(1)
93 | return False
94 | raise Exception(f"Could not find correct page {page_text=}")
95 |
96 |
97 | def next_page(driver):
98 | next_button = driver.find_element("xpath", "//span[text()='Next']")
99 | next_button.click()
100 |
101 |
102 | def page_one(driver):
103 | check_correct_page(driver, "Create a Google Account")
104 | first_name = driver.find_element("xpath", "//input[@name='firstName']")
105 | last_name = driver.find_element("xpath", "//input[@name='lastName']")
106 |
107 | first_name.send_keys(word_gen.generate_username(upper_limit=10, only_chars=True))
108 | last_name.send_keys(word_gen.generate_username(upper_limit=10, only_chars=True))
109 |
110 | next_page(driver)
111 |
112 |
113 | def page_two(driver):
114 | check_correct_page(driver, "Basic information")
115 |
116 | day = driver.find_element("xpath", "//input[@id='day']")
117 | month_element = driver.find_element("xpath", "//select[@id='month']")
118 | month = Select(month_element)
119 | year = driver.find_element("xpath", "//input[@id='year']")
120 |
121 | day.send_keys(random.randint(1, 28))
122 | month.select_by_index(random.randint(1, 12))
123 | current_year = datetime.datetime.now().year
124 | year.send_keys(random.randint(current_year - 30, current_year - 19))
125 | time.sleep(2)
126 |
127 | gender_element = driver.find_element("xpath", "//select[@id='gender']")
128 | gender = Select(gender_element)
129 | gender.select_by_index(random.randint(1, 3))
130 |
131 | next_page(driver)
132 |
133 |
134 | def page_three(driver):
135 | check_correct_page(driver, "Choose how you’ll sign in", allow_skip=True)
136 | try:
137 | gmail_adress = driver.find_element(
138 | "xpath", "//div[@data-value='1' and @role='radio']"
139 | )
140 | gmail_adress.click()
141 | time.sleep(1)
142 |
143 | next_page(driver)
144 | except:
145 | print("Google has skipped third page")
146 |
147 |
148 | def page_four(driver):
149 | check_correct_page(driver, "Choose your Gmail address", allow_skip=True)
150 | time.sleep(3)
151 |
152 | def find_and_add_username():
153 | username = driver.find_element("xpath", "//input[@name='Username']")
154 | random_username = word_gen.generate_username(upper_limit=30)
155 | username.send_keys(random_username)
156 | print(f"inserted username: {random_username}")
157 | return random_username
158 |
159 | try:
160 | selector = driver.find_element(
161 | "xpath", "//div[@aria-posinset='3' and @role='radio']"
162 | )
163 | selector.click()
164 | print("Gmail is giving me mail adresses")
165 | username = find_and_add_username()
166 | except:
167 | username = find_and_add_username()
168 |
169 | next_page(driver)
170 | return username
171 |
172 |
173 | def page_five(driver):
174 | check_correct_page(driver, "Create a strong password")
175 | generated_password = word_gen.generate_password()
176 | password = driver.find_element("xpath", "//input[@name='Passwd']")
177 | password_again = driver.find_element("xpath", "//input[@name='PasswdAgain']")
178 | password.send_keys(generated_password)
179 | password_again.send_keys(generated_password)
180 | print(f"Inserted password: {generated_password}")
181 |
182 | next_page(driver)
183 | return generated_password
184 |
185 |
186 | def page_six(driver, ignore_countries: list = None, counter: int = 0):
187 | time.sleep(4)
188 | phone_number = driver.find_element("xpath", "//input[@id='phoneNumberId']")
189 | print("Entered correct page: Confirm you're not a robot")
190 | # check_correct_page("Confirm you're not a robot", allow_skip=True)
191 | ignore_countries = obj.ignore_countries
192 |
193 | def check_for_errors():
194 | ERRORS = [
195 | "This phone number cannot be used for verification.",
196 | "This phone number format is not recognized. Please check the country and number.",
197 | "This phone number has been used too many times",
198 | "There was a problem verifying your phone number",
199 | ]
200 | for error in ERRORS:
201 | try:
202 | driver.find_element("xpath", f"//div[text()='{error}']")
203 | print(f"Error found: {error}")
204 | return error
205 | except:
206 | pass
207 | print("No Error found")
208 | return None
209 |
210 | found = check_correct_page(driver, "Error", allow_skip=True)
211 | if found:
212 | print("Rate limit reached")
213 | driver.quit()
214 | raise Exception("Rate limit reached")
215 |
216 | order = sms_pool.order_sms(
217 | service=sms_pool._service, ignore_countries=ignore_countries
218 | )
219 | for a in range(50):
220 | phone_number.send_keys(Keys.BACK_SPACE)
221 | phone_number.send_keys(f"+{order.cc} {order.phonenumber}")
222 | # for a in range(len(str(order.number)) + 2):
223 | # phone_number.send_keys(Keys.BACK_SPACE)
224 | # phone_number.send_keys(f"{order.phonenumber}")
225 | time.sleep(10)
226 | next_button = driver.find_element("xpath", "//span[text()='Next']")
227 | next_button.click()
228 | time.sleep(4)
229 | error = check_for_errors()
230 | if error:
231 | # print('Refunding SMS')
232 | # sms_pool.refund(order_id=order.order_id)
233 | if error != "This phone number has been used too many times":
234 | obj.ignore_countries.append(order.country)
235 | print(f"Error found: {error}")
236 | if counter <= 1000:
237 | return page_six(
238 | driver=driver, ignore_countries=ignore_countries, counter=counter + 1
239 | )
240 |
241 | print("Error found")
242 | driver.quit()
243 | raise Exception("Error found")
244 | return f"{order.number}"
245 |
246 |
247 | def page_seven(driver, phone_number: str):
248 | def get_code(phone_number):
249 | resp = sms_pool.order_history(phone_number=phone_number)
250 | for item in resp:
251 | status = item["status"]
252 |
253 | if status == "pending":
254 | time_left = item["time_left"]
255 | order_id = item["order_code"]
256 |
257 | time.sleep(2)
258 | print(item)
259 | return get_code(phone_number=phone_number)
260 | # resend code
261 | # resend_button = driver.find_element("xpath", "//span[text()='Get new code']")
262 | # resend_button.click()
263 | # time.sleep(1)
264 | # phone_number = page_six(driver=driver)
265 | # return page_seven(driver=driver, phone_number=phone_number)
266 | elif status == "completed":
267 | print(item)
268 | return item["code"]
269 | else:
270 | print(item)
271 |
272 | check_correct_page(driver, "Enter the code")
273 | code_input = driver.find_element("xpath", "//input[@name='code']")
274 | sms_code = get_code(phone_number)
275 |
276 | code_input.send_keys(sms_code)
277 |
278 | next_page(driver)
279 |
280 |
281 | def page_eight(driver):
282 | check_correct_page(driver, "Add recovery email", allow_skip=True)
283 | next_button = driver.find_element("xpath", "//span[text()='Skip']")
284 | next_button.click()
285 | time.sleep(4)
286 |
287 |
288 | def page_nine(driver):
289 | found = check_correct_page(driver, "Add phone number", allow_skip=True)
290 | if found:
291 | next_button = driver.find_element("xpath", "//span[text()='Skip']")
292 | next_button.click()
293 | time.sleep(4)
294 |
295 |
296 | def page_ten(driver):
297 | found = check_correct_page(driver, "Review your account info", allow_skip=True)
298 | if found:
299 | next_button = driver.find_element("xpath", "//span[text()='Next']")
300 | next_button.click()
301 | time.sleep(4)
302 |
303 |
304 | def page_eleven(driver):
305 | found = check_correct_page(driver, "Choose your settings", allow_skip=True)
306 | if found:
307 | selector = driver.find_element(
308 | "xpath", "//div[@aria-posinset='1' and @role='radio']"
309 | )
310 | selector.click()
311 | print("Gmail is giving me mail adresses")
312 |
313 | next_button = driver.find_element("xpath", "//span[text()='Next']")
314 | next_button.click()
315 | time.sleep(4)
316 |
317 |
318 | def page_eleven2(driver):
319 | found = check_correct_page(driver, "Choose your settings", allow_skip=True)
320 | if found:
321 | next_button = driver.find_element("xpath", "//span[text()='Accept all']")
322 | next_button.click()
323 | time.sleep(4)
324 |
325 |
326 | def page_twelve(driver):
327 | found = check_correct_page(driver, "Confirm your settings", allow_skip=True)
328 | if found:
329 | next_button = driver.find_element("xpath", "//span[text()='Confirm']")
330 | next_button.click()
331 | time.sleep(4)
332 |
333 |
334 | def page_thirteen(driver):
335 | check_correct_page(driver, "Privacy and Terms", allow_skip=True)
336 | next_button = driver.find_element("xpath", "//span[text()='I agree']")
337 | next_button.click()
338 | time.sleep(4)
339 |
340 | try:
341 | driver.find_element("xpath", "//span[text()='Confirm']").click()
342 | time.sleep(4)
343 | except:
344 | pass
345 |
346 |
347 | def page_fourteen(driver, username: str, password: str):
348 | # check_correct_page("Privacy and Terms", allow_skip=True)
349 | time.sleep(10)
350 | try:
351 | driver.find_element("xpath", "//div[text()='Home']")
352 | print("Account created successfully")
353 | driver.quit()
354 | except:
355 | print("Could not find home page")
356 | time.sleep(200)
357 | this_dir = os.path.dirname(__file__)
358 | with open(os.path.join(this_dir, "gmail_accounts.txt"), "a") as file:
359 | file.write(f"{username}, {password}\n")
360 | print("Account saved")
361 |
362 |
363 | def generate_google_account(config: Config, proxy: str = None):
364 | driver = create_driver(config, proxy=proxy)
365 | url = "https://accounts.google.com/signup"
366 | driver.get(url)
367 | print("Opened google signup page")
368 |
369 | page_one(driver)
370 | page_two(driver)
371 | page_three(driver)
372 | username = page_four(driver)
373 | password = page_five(driver)
374 | phone_number = page_six(driver)
375 | page_seven(driver=driver, phone_number=phone_number)
376 | page_eight(driver)
377 | page_nine(driver)
378 | page_ten(driver)
379 | page_eleven(driver)
380 | page_eleven2(driver)
381 | page_twelve(driver)
382 | page_thirteen(driver)
383 | page_fourteen(driver=driver, username=username, password=password)
384 |
385 |
386 | if __name__ == "__main__":
387 | pprint(gen_config.dict())
388 | proxies = cycle(gen_config.proxies)
389 | while True:
390 | proxy=None
391 | if gen_config.proxies:
392 | proxy = next(proxies).proxy
393 | print(f"Using proxy: {proxy=}")
394 |
395 |
396 | try:
397 | print(f"{obj.ignore_countries=}")
398 | generate_google_account(config=gen_config, proxy=proxy)
399 | except Exception as exc:
400 | print(exc)
401 |
--------------------------------------------------------------------------------
/ptc/account_generation/index.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import hashlib
3 | import json
4 | import os
5 | import random
6 | import string
7 | import sys
8 | import time
9 | import traceback
10 | from itertools import cycle
11 | from pprint import pprint
12 | from typing import Union, List
13 | from typing import Optional
14 |
15 | import pymongo
16 | import requests
17 | from config import Config, Proxy, load_config
18 | from klinklang import logger
19 | from klinklang.core.db_return import db_return
20 | from klinklang.core.ptc import PossibleMonths
21 | from klinklang.core.ptc.get_country_for_proxy import get_country_for_proxy
22 | from klinklang.core.ptc.get_random_dob import get_random_dob
23 | from klinklang.core.ptc.random_word_gen import RandomWordGen
24 | from klinklang.core.ptc.timeout import timeout
25 | from selenium.webdriver.common.by import By
26 | from selenium.webdriver.support import expected_conditions as EC
27 | from selenium.webdriver.support.ui import WebDriverWait
28 | from seleniumbase import Driver
29 |
30 | # Create Screenshots directory if it does not exist
31 | file_dir = os.path.dirname(os.path.abspath(__file__))
32 | screenshot_dir = os.path.join(file_dir, "screenshots")
33 | if not os.path.exists(screenshot_dir):
34 | os.mkdir(screenshot_dir)
35 |
36 | word_gen = RandomWordGen()
37 | config = load_config()
38 | SLEEPTIME = config.proxy_cooldown
39 | ADDITIONAL_SLEEP = config.additional_sleep_time
40 | WEBDRIVER_MAX_WAIT = config.webdriver_max_wait
41 |
42 |
43 | def get_proxies(config: Config):
44 | """
45 | Get all proxies from the config
46 | """
47 | if not config.proxies:
48 | logger.warning("No proxies found, using your IP")
49 | return [Proxy()]
50 | return config.proxies
51 |
52 |
53 | @timeout(seconds=60 * 5)
54 | def get_code_for_email(
55 | email: str,
56 | collection: pymongo.collection.Collection,
57 | counter: int = 0,
58 | max_counter: int = 180,
59 | ) -> str:
60 | """
61 | Search the database for the code for the email
62 |
63 | Parameters
64 | ----------
65 | email : str
66 | The email for which the code should be searched
67 | collection : pymongo.collection.Collection
68 | The collection in which the code should be searched
69 | counter : int, optional
70 | current counter, used for recursion
71 | max_counter : int, optional
72 | maximum number of tries before timeout
73 | """
74 | code = db_return(collection.find({"email": email}))
75 | if not code:
76 | if counter <= max_counter:
77 | time.sleep(1)
78 | return get_code_for_email(
79 | email, collection, counter=counter + 1, max_counter=max_counter
80 | )
81 | logger.error(
82 | f"Max attempts exceeded for {email}. Aboarding account generation."
83 | )
84 | raise TimeoutError(f"Max attempts exceeded for {email}")
85 | else:
86 | return code[0]["code"]
87 |
88 | def check_domain_account_limit(domain: str, max_accounts: Optional[int], collection: pymongo.collection.Collection) -> bool:
89 | """
90 | Check if the domain has reached the maximum allowed accounts and log the count.
91 |
92 | Parameters
93 | ----------
94 | domain : str
95 | The domain to check.
96 | max_accounts : Optional[int]
97 | The maximum number of accounts allowed for the domain. -1 means unlimited.
98 | collection : pymongo.collection.Collection
99 | The database collection containing accounts.
100 |
101 | Returns
102 | -------
103 | bool
104 | True if the limit is not exceeded, False otherwise.
105 | """
106 | domain_count = collection.count_documents({"email": {"$regex": f"@{domain}$"}})
107 | if max_accounts == -1: # Unlimited accounts
108 | logger.info(f"Unlimited accounts allowed for domain '{domain}'. Current count: {domain_count}.")
109 | return True
110 |
111 | result = domain_count < max_accounts
112 | logger.info(f"Domain '{domain}' has {domain_count} accounts. Limit: {max_accounts}. Within limit: {result}.")
113 | return result
114 |
115 | def generate_account(
116 | domain: str,
117 | password: str = None,
118 | prefix: str = None,
119 | proxy: str = None,
120 | proxy_region: str = None,
121 | random_subdomain: bool = False,
122 | subdomain_length: int = 32,
123 | ) -> dict:
124 | """
125 | Generate credentials for an account
126 |
127 | Parameters
128 | ----------
129 | domain : str
130 | The domain for the account
131 | password : str, optional
132 | The password for the account
133 | prefix : str, optional
134 | The prefix for the email
135 | proxy : str, optional
136 | The proxy for the account
137 | proxy_region : str, optional
138 | The region for the proxy
139 | random_subdomain : bool, optional
140 | If the subdomain should be random
141 | subdomain_length : int, optional
142 | The length of the subdomain
143 | """
144 | username = word_gen.generate_username()
145 | if random_subdomain:
146 | subdomain = word_gen.generate_username().replace("_", "")
147 | while len(subdomain) < subdomain_length:
148 | subdomain = subdomain + word_gen.generate_username().replace("_", "")
149 | subdomain = subdomain[:subdomain_length]
150 | subdomain = subdomain.lower()
151 | domain = ".".join([subdomain, domain])
152 | logger.info(f"Random subdomain: {domain}")
153 |
154 | region = get_country_for_proxy(proxy=proxy, region=proxy_region)
155 | year_, month_, day_ = get_random_dob()
156 |
157 | day_of_birth = f"{year_}-{PossibleMonths.index(month_)+1}-{day_}"
158 | mail = "@".join([username, domain])
159 | if prefix:
160 | mail = "@".join(["+".join([prefix, username]), domain])
161 |
162 | account = {
163 | "email": mail,
164 | "username": username,
165 | "screenname": f"{username}"[:15],
166 | "password": password or word_gen.generate_password(),
167 | "dob": day_of_birth,
168 | "dob_year": year_,
169 | "dob_month": month_,
170 | "dob_day": day_,
171 | "region": region,
172 | }
173 | return account
174 |
175 |
176 | def get_own_ip():
177 | """
178 | Get the own IP address
179 | """
180 | return requests.get("https://checkip.amazonaws.com").text.strip()
181 |
182 |
183 | def insert_usage(proxy: str = None, rotating: bool = False):
184 | if not proxy:
185 | proxy = get_own_ip()
186 | if rotating is True:
187 | return
188 |
189 | db = config.database.client()["ips"]
190 | db.delete_many({"ip": proxy})
191 | db.insert_one(
192 | {"ip": proxy, "ts": datetime.datetime.now(datetime.timezone.utc).isoformat()}
193 | )
194 |
195 |
196 | def generate_secret():
197 | random_string = "".join(random.choices(string.ascii_letters + string.digits, k=30))
198 | hash_object = hashlib.md5(random_string.encode())
199 | random_hash = hash_object.hexdigest()
200 | return random_hash
201 |
202 |
203 | def get_total_number_of_accounts() -> int:
204 | database_client = config.database.client()
205 | accounts = db_return(database_client["accounts"].find())
206 | return len(accounts)
207 |
208 |
209 | def save_account(account: dict):
210 | database_client = config.database.client()
211 | database_client["accounts"].insert_one(account)
212 | logger.info("Account saved")
213 |
214 |
215 | def create_driver(config: Config, proxy: str = None, counter: int = 0):
216 | try:
217 | kwargs = {}
218 | if proxy:
219 | kwargs["proxy"] = proxy
220 |
221 | if config.binary_location:
222 | kwargs["binary_location"] = config.binary_location
223 | # kwargs['binary_location'] = '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
224 | browser_name = "chrome"
225 | logger.info(f"Starting {browser_name} Driver...")
226 | chromium_args = "--lang=en-us, --disable-features=OptimizationGuideModelDownloading,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationHints"
227 | kwargs["chromium_arg"] = chromium_args
228 | driver = Driver(uc=True, headless2=config.headless, **kwargs)
229 |
230 | # stealth(driver, languages=["en-US", "en"], vendor="Google Inc.",
231 | # webgl_vendor="Intel Inc.",
232 | # renderer="Intel Iris OpenGL Engine", fix_hairline=True, )
233 | # driver.maximize_window()
234 | driver.delete_all_cookies()
235 |
236 | if config.network_blocks:
237 | logger.info(f"Enabling network blocks: {config.network_blocks}")
238 | driver.execute_cdp_cmd(
239 | "Network.setBlockedURLs",
240 | {
241 | "urls": config.network_blocks,
242 | },
243 | )
244 | driver.execute_cdp_cmd("Network.enable", {})
245 | driver.refresh()
246 |
247 | logger.info("Refreshing cookies")
248 | return driver
249 | except:
250 | logger.error("Failed to start driver ... Trying again.")
251 | if counter <= 10:
252 | return create_driver(proxy=proxy, counter=counter + 1, config=config)
253 | raise
254 |
255 |
256 | def access_ptc_site(driver):
257 | logger.info("Starting Access PTC site...")
258 | # driver.uc_open_with_disconnect("https://join.pokemon.com/", 2.2)
259 | # time.sleep(200)
260 | driver.get("https://join.pokemon.com/")
261 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
262 | EC.presence_of_element_located((By.CSS_SELECTOR, "body"))
263 | )
264 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
265 | lambda driver: driver.execute_script("return document.readyState") == "complete"
266 | )
267 | driver.save_screenshot(os.path.join(screenshot_dir, "access-ptc.png"))
268 |
269 | # driver.add_cookie(
270 | # {"name": "dob", "value": "183855600000", "domain": "join.pokemon.com",
271 | # "path": "/"})
272 | # driver.add_cookie(
273 | # {"name": "country", "value": "AU", "domain": "join.pokemon.com", "path": "/"})
274 | # driver.refresh()
275 | # time.sleep(1200000)
276 |
277 |
278 | def submit_account_details(driver: Driver, account: dict):
279 | logger.info("Submitting details about my person, yes i am indeed a person")
280 | try:
281 | submit_button = WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
282 | EC.presence_of_element_located((By.ID, "ageGateSubmit"))
283 | )
284 | logger.info("Found submit button.")
285 | driver.save_screenshot(os.path.join(screenshot_dir, "submit_button.png"))
286 | except:
287 | logger.info("Not Found submit button.")
288 | driver.save_screenshot(os.path.join(screenshot_dir, "submit_button.png"))
289 | return False
290 |
291 | try:
292 | driver.find_element(
293 | "xpath",
294 | "//h1[contains(text(), 'Enter your country or region and your birthdate')]",
295 | )
296 | except:
297 | logger.error("Failed to find header")
298 | driver.save_screenshot(os.path.join(screenshot_dir, "header.png"))
299 | return False
300 |
301 | country = driver.find_element(by=By.ID, value="country-select")
302 | year = driver.find_element(by=By.ID, value="year-select")
303 | month = driver.find_element(by=By.ID, value="month-select")
304 | day = driver.find_element(by=By.ID, value="day-select")
305 |
306 | country.send_keys(account["region"])
307 | year.send_keys(f"{account['dob_year']}")
308 | month.send_keys(f"{account['dob_month']}")
309 | day.send_keys(f"{account['dob_day']}")
310 |
311 | submit_button.click()
312 | driver.save_screenshot(os.path.join(screenshot_dir, "account_details.png"))
313 | return True
314 |
315 |
316 | def bypass_imperva(driver: Driver, account: dict):
317 | logger.info("Hello imperva, lets fight")
318 | driver.save_screenshot(os.path.join(screenshot_dir, "imperva.png"))
319 | try:
320 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
321 | lambda driver: driver.find_element(
322 | "xpath", "//button[contains(text(), 'I Am Sure')]"
323 | )
324 | )
325 | driver.find_element("xpath", "//button[contains(text(), 'I Am Sure')]").click()
326 | except:
327 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
328 | lambda driver: driver.find_element(
329 | "xpath", "//button[contains(text(), 'Yes, it is')]"
330 | )
331 | )
332 | driver.find_element("xpath", "//button[contains(text(), 'Yes, it is')]").click()
333 |
334 | email = driver.find_element(by=By.ID, value="email-text-input")
335 | confirm_email = driver.find_element(by=By.ID, value="confirm-text-input")
336 |
337 | email.send_keys(account["email"])
338 | confirm_email.send_keys(account["email"])
339 |
340 | driver.find_element("xpath", "//button[contains(text(), 'Continue')]").click()
341 | try:
342 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
343 | lambda driver: driver.find_element(
344 | "xpath",
345 | "//div[contains(text(), 'Please review and accept the Terms of Use')]",
346 | )
347 | )
348 | except:
349 | logger.info("Failed to bypass Imperva Bot Detection. Aborting and retrying...")
350 | return False
351 | logger.info("Bypassed!")
352 | return True
353 |
354 |
355 | def enter_username_and_password(driver: Driver, account: dict):
356 | logger.info("Entering username and password.")
357 | driver.find_element("xpath", "//button[contains(text(), 'Accept')]").click()
358 | time.sleep(1)
359 | driver.find_element("xpath", "//button[contains(text(), 'Accept')]").click()
360 | logger.info("Accepted data protection")
361 |
362 | #driver.find_element("xpath", "//button[contains(text(), 'Skip')]").click()
363 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
364 | lambda driver: driver.find_element(
365 | "xpath", "//h1[contains(text(), 'Enter the username and password')]"
366 | )
367 | )
368 | username_input = driver.find_element(by=By.ID, value="Username-text-input")
369 | # username_input.click()
370 | # driver.uc_gui_press_keys(list(account["username"]))
371 | try:
372 | password_input = driver.find_element(by=By.ID, value="password-text-input")
373 | except:
374 | password_input = driver.find_element(by=By.ID, value="password-text-input-test")
375 |
376 | username_input.send_keys(account["username"])
377 | password_input.send_keys(account["password"])
378 |
379 | driver.find_element("xpath", "//button[contains(text(), 'Create Account')]").click()
380 | logger.info("Inserted account data")
381 |
382 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
383 | lambda driver: driver.find_element(
384 | "xpath", "//button[contains(text(), 'I Am Sure')]"
385 | )
386 | )
387 |
388 | driver.find_element("xpath", "//button[contains(text(), 'I Am Sure')]").click()
389 | return True
390 |
391 |
392 | def send_code(driver, account: dict):
393 | try:
394 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
395 | lambda driver: driver.find_element(by=By.ID, value="code-text-input")
396 | )
397 | logger.info("Code input field is existing")
398 | driver.save_screenshot(os.path.join(screenshot_dir, "code_input.png"))
399 | except:
400 | logger.info(
401 | "No Code input field found. Stop your fuckery imperva. Accept the loose"
402 | )
403 | driver.save_screenshot(os.path.join(screenshot_dir, "code_input.png"))
404 | return False
405 |
406 | logger.info("Waiting for code from email")
407 | code = get_code_for_email(
408 | email=account["email"],
409 | collection=config.database.client()["codes"],
410 | max_counter=config.email_code_waiting_max,
411 | )
412 | codeinput = driver.find_element(by=By.ID, value="code-text-input")
413 | logger.info(f"Inserting {code=} for {account['email']}")
414 | codeinput.send_keys(code)
415 | driver.find_element("xpath", "//button[contains(text(), 'Continue')]").click()
416 | logger.info("Waiting for verification from server...")
417 | try:
418 | WebDriverWait(driver, WEBDRIVER_MAX_WAIT).until(
419 | lambda driver: driver.find_element(
420 | "xpath", "//h1[contains(text(), 'Success')]"
421 | )
422 | )
423 | driver.save_screenshot(os.path.join(screenshot_dir, "verify.png"))
424 | return True
425 | except:
426 | logger.info("Failed to verify account. Aborting and retrying...")
427 | driver.save_screenshot(os.path.join(screenshot_dir, "verify.png"))
428 | return False
429 |
430 |
431 | def save_account_to_file(account: dict, format: str):
432 | file_name = f"{datetime.datetime.now(datetime.timezone.utc).date().isoformat()}.txt"
433 | format = (
434 | format.replace("{email}", f'{account["email"]}')
435 | .replace("{username}", f'{account["username"]}')
436 | .replace("{password}", f"{account['password']}")
437 | .replace("{dob}", f'{account["dob"]}')
438 | .replace("{region}", f'{account["region"]}')
439 | )
440 | if not os.path.exists(os.path.join(file_dir, "accounts")):
441 | os.mkdir(os.path.join(file_dir, "accounts"))
442 | with open(os.path.join(file_dir, "accounts", file_name), "a") as f:
443 | f.write(f"{format}\n")
444 |
445 | def display_domain_account_chart(collection: pymongo.collection.Collection):
446 | """
447 | Display an ASCII chart showing the number of accounts for each domain in descending order.
448 |
449 | Parameters
450 | ----------
451 | collection : pymongo.collection.Collection
452 | The database collection containing accounts.
453 | """
454 | # Aggregate and count accounts for each domain
455 | domain_counts = collection.aggregate([
456 | {"$group": {"_id": {"$arrayElemAt": [{"$split": ["$email", "@"]}, 1]}, "count": {"$sum": 1}}},
457 | {"$sort": {"count": -1}}
458 | ])
459 |
460 | # Prepare data for display
461 | chart_data = [{"Domain": item["_id"], "Accounts": item["count"]} for item in domain_counts]
462 |
463 | # Generate ASCII chart
464 | print("\nDomain Account Counts:")
465 | print("=" * 40)
466 | print(f"{'Domain':<25} {'Accounts':>10}")
467 | print("=" * 40)
468 | for row in chart_data:
469 | print(f"{row['Domain']:<25} {row['Accounts']:>10}")
470 | print("=" * 40)
471 |
472 |
473 | def generate(
474 | domain: str,
475 | config: Config,
476 | proxy: str = None,
477 | save_to_file: bool = False,
478 | format: str = "{email}, {username}, {password}, {dob}",
479 | ):
480 | # Always initialize accounts_collection
481 | database_client = config.database.client()
482 | accounts_collection = database_client["accounts"]
483 |
484 | # Display the domain account chart if the config option is True
485 | if config.show_chart:
486 | display_domain_account_chart(accounts_collection)
487 |
488 | # Check domain account limit
489 | max_accounts = config.max_accounts_per_domain
490 | if not check_domain_account_limit(domain, max_accounts, accounts_collection):
491 | logger.error(f"Domain '{domain}' has reached the maximum allowed accounts ({max_accounts}). No account will be created.")
492 | return False
493 |
494 | # Proceed with account generation
495 | generated = False
496 | start = time.time()
497 | account = generate_account(
498 | domain=domain,
499 | password=config.account_password,
500 | prefix=config.mail_prefix,
501 | proxy=proxy or get_own_ip(),
502 | proxy_region=config.proxy_region,
503 | random_subdomain=config.random_subdomain,
504 | subdomain_length=config.subdomain_length,
505 | )
506 | logger.info(f"Starting account creation: {account=}")
507 | logger.info(f'{"*" * 10} {proxy or get_own_ip()} {"*" * 10}')
508 | driver = create_driver(proxy=proxy, config=config)
509 | time.sleep(ADDITIONAL_SLEEP)
510 | try:
511 | access_ptc_site(driver)
512 | time.sleep(ADDITIONAL_SLEEP)
513 | if submit_account_details(driver, account=account):
514 | time.sleep(ADDITIONAL_SLEEP)
515 | if bypass_imperva(driver, account):
516 | time.sleep(ADDITIONAL_SLEEP)
517 | enter_username_and_password(driver, account)
518 | time.sleep(ADDITIONAL_SLEEP)
519 | if send_code(driver, account):
520 | logger.info("Account was successfully activated. Saving to DB")
521 | save_account(account)
522 | time_needed = time.time() - start
523 | logger.info(f"Account generated in {time_needed} seconds")
524 | if save_to_file is True:
525 | save_account_to_file(account=account, format=format)
526 |
527 | generated = True
528 | else:
529 | logger.error("Blocked by imperva")
530 | else:
531 | logger.error("Blocked by website")
532 | except Exception as e:
533 | logger.error("Account generation failed.")
534 | logger.error(f"{traceback.format_exc()}")
535 | driver.save_screenshot(os.path.join(screenshot_dir, "error.png"))
536 | driver.save_screenshot(os.path.join(screenshot_dir, "success.png"))
537 | driver.quit()
538 | return generated
539 |
540 |
541 |
542 | def get_success_full_proxies(proxy_stats: dict, number: int = 10, success: bool = True):
543 | stats = []
544 | for proxy, used in proxy_stats.items():
545 | success_ = used.count(True)
546 | failed = used.count(False)
547 | stats.append(
548 | {"name": proxy, "success": success_, "failed": failed, "total": len(used)}
549 | )
550 | key = "failed"
551 | if success:
552 | key = "success"
553 | sorted_stats = sorted(stats, key=lambda x: x[key], reverse=True)
554 | for stat in sorted_stats[:number]:
555 | logger.info_cyan(stat)
556 |
557 |
558 | def find_last_used_for_proxy(
559 | proxy: str, config: Config, usage_data: List[dict]
560 | ) -> datetime.datetime:
561 | used = [datapoint for datapoint in usage_data if datapoint["ip"] == proxy]
562 |
563 | last_used = datetime.datetime.fromtimestamp(1, tz=datetime.timezone.utc)
564 | for item in used:
565 | found_time = datetime.datetime.fromisoformat(item["ts"])
566 | if found_time > last_used:
567 | last_used = found_time
568 |
569 | return last_used
570 |
571 |
572 | def find_oldest_proxy(
573 | config: Config, proxies: List[Proxy]
574 | ) -> Union[Proxy, datetime.datetime]:
575 | rotating_proxies = [proxy for proxy in proxies if proxy.rotating]
576 | if rotating_proxies:
577 | return random.choice(rotating_proxies)
578 |
579 | db = config.database.client()["ips"]
580 | used = db_return(db.find())
581 |
582 | used_for_proxies = []
583 | for proxy in proxies:
584 | last_used = find_last_used_for_proxy(
585 | proxy.proxy or get_own_ip(), config=config, usage_data=used
586 | )
587 | used_for_proxies.append({"proxy": proxy.proxy, "last_used": last_used})
588 |
589 | sorted_used = sorted(used_for_proxies, key=lambda x: x["last_used"])
590 | for proxy in sorted_used:
591 | last_used = proxy["last_used"]
592 | if last_used + datetime.timedelta(seconds=SLEEPTIME) < datetime.datetime.now(
593 | datetime.timezone.utc
594 | ):
595 | logger.info(f'{proxy["proxy"]} is the oldest proxy. {last_used=}')
596 | if proxy["proxy"] is None:
597 | return Proxy()
598 | return Proxy(proxy=proxy["proxy"])
599 | logger.warning("No proxy is usable")
600 | logger.info(f"Oldest proxy is {sorted_used[0]}")
601 | return sorted_used[0]["last_used"]
602 |
603 |
604 | def _add_to_proxy_stats(proxy: str, success: bool = True):
605 | try:
606 | if not os.path.exists(os.path.join(file_dir, "stats")):
607 | os.mkdir(os.path.join(file_dir, "stats"))
608 |
609 | if os.path.exists(os.path.join(file_dir, "stats", "proxies.json")):
610 | with open(os.path.join(file_dir, "stats", "proxies.json"), "r") as in_file:
611 | proxy_stats = json.load(in_file)
612 | else:
613 | proxy_stats = []
614 |
615 | except:
616 | proxy_stats = []
617 |
618 | proxy_stats.append(
619 | {
620 | "proxy": proxy,
621 | "success": success,
622 | "ts": datetime.datetime.now(datetime.timezone.utc).isoformat(),
623 | }
624 | )
625 |
626 | with open(os.path.join(file_dir, "stats", "proxies.json"), "w") as f:
627 | json.dump(proxy_stats, f)
628 |
629 |
630 | def _add_to_domain_stats(domain: str, success: bool = True):
631 | try:
632 | if not os.path.exists(os.path.join(file_dir, "stats")):
633 | os.mkdir(os.path.join(file_dir, "stats"))
634 |
635 | if os.path.exists(os.path.join(file_dir, "stats", "domains.json")):
636 | with open(os.path.join(file_dir, "stats", "domains.json"), "r") as in_file:
637 | domain_stats = json.load(in_file)
638 | else:
639 | domain_stats = []
640 | except:
641 | domain_stats = []
642 |
643 | domain_stats.append(
644 | {
645 | "domain": domain,
646 | "success": success,
647 | "ts": datetime.datetime.now(datetime.timezone.utc).isoformat(),
648 | }
649 | )
650 |
651 | with open(os.path.join(file_dir, "stats", "domains.json"), "w") as f:
652 | json.dump(domain_stats, f)
653 |
654 |
655 | if __name__ == "__main__":
656 | config = load_config()
657 | pprint(config.dict())
658 |
659 | proxy_stats = {}
660 | domain_stats = {}
661 |
662 | usable_proxies = get_proxies(config)
663 | domains = cycle(config.domains)
664 | account_save_config = config.accounts
665 |
666 | counter = 0
667 | send = False
668 | current_proxy = None # Keep track of the current proxy
669 |
670 | while True:
671 | try:
672 | # Check if all domains have reached their limits
673 | all_domains_maxed = True
674 | for domain in config.domains:
675 | max_accounts = config.max_accounts_per_domain
676 | accounts_collection = config.database.client()["accounts"]
677 | if check_domain_account_limit(domain.domain_name, max_accounts, accounts_collection):
678 | all_domains_maxed = False
679 | break
680 |
681 | if all_domains_maxed:
682 | logger.info("All domains have reached their maximum allowed accounts. Stopping script.")
683 | sys.exit(0)
684 |
685 | # Check for valid domains
686 | valid_domain_found = False
687 | domain = next(domains)
688 |
689 | if not current_proxy: # Rotate proxy if not set or after a loop
690 | current_proxy = find_oldest_proxy(config, usable_proxies)
691 | if isinstance(current_proxy, Proxy):
692 | insert_usage(current_proxy.proxy, current_proxy.rotating)
693 | else:
694 | logger.warning("No valid proxy found. Retrying...")
695 | continue
696 |
697 | # Check if the domain has reached its account limit
698 | max_accounts = config.max_accounts_per_domain
699 | if not check_domain_account_limit(domain.domain_name, max_accounts, accounts_collection):
700 | logger.error(f"Domain '{domain.domain_name}' has reached its maximum allowed accounts ({max_accounts}).")
701 | continue # Skip to the next domain without rotating the proxy
702 |
703 | valid_domain_found = True
704 |
705 | # Generate an account
706 | generated = generate(
707 | domain=domain.domain_name,
708 | proxy=current_proxy.proxy,
709 | save_to_file=account_save_config.save_to_file,
710 | format=account_save_config.format,
711 | config=config,
712 | )
713 |
714 | if generated:
715 | counter += 1
716 | # Update proxy stats
717 | _add_to_proxy_stats(current_proxy.proxy or get_own_ip(), success=True)
718 | # Update domain stats
719 | _add_to_domain_stats(domain.domain_name, success=True)
720 | # Rotate proxy after successful generation
721 | logger.info("Rotating proxy after successful account creation.")
722 | current_proxy = None # Force rotation in the next iteration
723 | else:
724 | logger.error(f"Account generation failed for domain: {domain.domain_name}. Rotating proxy.")
725 | # Update proxy stats
726 | _add_to_proxy_stats(current_proxy.proxy or get_own_ip(), success=False)
727 | # Update domain stats
728 | _add_to_domain_stats(domain.domain_name, success=False)
729 | current_proxy = None # Rotate proxy after failure
730 |
731 | except Exception as e:
732 | logger.error("An error occurred during account generation.")
733 | logger.error(traceback.format_exc())
734 | current_proxy = None # Rotate proxy after an unhandled error
735 | continue
736 |
737 | # Rotate proxy if no valid domain was found
738 | if not valid_domain_found:
739 | logger.info("Rotating proxy because no valid domain was found.")
740 | current_proxy = None
741 |
742 | # Display session stats
743 | if counter % 10 == 0 and counter != 0 and not send:
744 | send = True
745 | else:
746 | logger.info_cyan(f"Generated accounts in this session: {counter}")
747 | if config.show_total_accounts:
748 | logger.info_cyan(
749 | f"Total generated accounts with klinklang: {get_total_number_of_accounts()}"
750 | )
751 | send = False
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
--------------------------------------------------------------------------------