├── docs └── gt3237.gif ├── requirements.txt ├── src ├── __init__.py ├── armour │ ├── __init__.py │ ├── apis.py │ └── core.py └── config.py ├── README.md ├── examples ├── __init__.py ├── demo.py └── _base.py ├── main.py ├── .gitignore └── LICENSE /docs/gt3237.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QIN2DIM/armour-email/HEAD/docs/gt3237.gif -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | selenium~=4.1.0 2 | loguru~=0.5.3 3 | requests~=2.26.0 4 | urllib3==1.25.11 -------------------------------------------------------------------------------- /src/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Time : 2021/12/16 16:08 3 | # Author : QIN2DIM 4 | # Github : https://github.com/QIN2DIM 5 | # Description: 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [返回首页](https://github.com/QIN2DIM/V2RayCloudSpider/issues/53#:~:text=u.r%2Ddev.x-,Armour,-armour%20%E6%98%AF%E4%B8%80%E7%B3%BB%E5%88%97) :point_left: 2 | # armour-email 3 | 4 | ![gt3237](docs/gt3237.gif) 5 | -------------------------------------------------------------------------------- /examples/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Time : 2021/12/16 16:08 3 | # Author : QIN2DIM 4 | # Github : https://github.com/QIN2DIM 5 | # Description: 6 | from .demo import demo_email2walk 7 | 8 | __all__ = ["demo_email2walk"] 9 | -------------------------------------------------------------------------------- /src/armour/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Time : 2021/12/16 16:25 3 | # Author : QIN2DIM 4 | # Github : https://github.com/QIN2DIM 5 | # Description: 6 | 7 | from .apis import get_verification_code, get_email_context 8 | 9 | __all__ = ["get_verification_code", "get_email_context"] 10 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Time : 2021/12/16 16:28 3 | # Author : QIN2DIM 4 | # Github : https://github.com/QIN2DIM 5 | # Description: SSPanel-Uim 邮箱验证案例 6 | 7 | # ============================================== 8 | # TODO [√]用于项目演示的运行实例,(也许)需要使用代理 9 | # ============================================== 10 | # - `anti_email` 表示需要邮箱验证 11 | # - 无标记实例为对照组 12 | ActionNiuBiCloud = { 13 | "register_url": "https://niubi.cyou/auth/register", 14 | } 15 | 16 | ActionFreeDogCloud = { 17 | "register_url": "https://www.freedog.pw/auth/register", 18 | "anti_email": True 19 | } 20 | ActionSavierCloud = { 21 | "register_url": "https://savier.xyz/auth/register", 22 | "anti_email": True 23 | } 24 | # ============================================== 25 | # TODO [√]运行前请检查 chromedriver 配置 26 | # ============================================== 27 | from examples import demo_email2walk 28 | 29 | if __name__ == '__main__': 30 | demo_email2walk( 31 | # 无验证对照组 32 | # atomic=ActionNiuBiCloud, 33 | 34 | # 邮箱验证实验组 35 | atomic=ActionSavierCloud, 36 | ) 37 | -------------------------------------------------------------------------------- /examples/demo.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Time : 2021/12/16 16:29 3 | # Author : QIN2DIM 4 | # Github : https://github.com/QIN2DIM 5 | # Description: 6 | import time 7 | 8 | from src.config import logger 9 | from ._base import CatWalk 10 | 11 | 12 | class Email2Walk(CatWalk): 13 | def __init__(self, register_url: str, silence: bool = False, 14 | anti_email: bool = False): 15 | super(Email2Walk, self).__init__(register_url, silence=silence, anti_email=anti_email) 16 | 17 | def go(self): 18 | # 检测实例状态 19 | if not self.check_heartbeat(): 20 | return 21 | 22 | # 获取任务设置 23 | api = self.set_spider_option() 24 | try: 25 | # 弹性访问 26 | self.get_html_handle(api, url=self.register_url) 27 | # 注册账号 28 | self.sign_up(api) 29 | finally: 30 | logger.success("实例运行完毕,3s后退出程序。") 31 | time.sleep(3) 32 | api.quit() 33 | 34 | 35 | @logger.catch() 36 | def demo_email2walk(atomic: dict, silence=False): 37 | logger.info("加载运行实例 - atomic={}".format(atomic)) 38 | 39 | e2w = Email2Walk( 40 | register_url=atomic["register_url"], 41 | silence=silence, 42 | anti_email=atomic.get("anti_email") 43 | ) 44 | 45 | e2w.go() 46 | -------------------------------------------------------------------------------- /src/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | from os.path import dirname, join, exists 3 | 4 | from loguru import logger 5 | 6 | __all__ = ["PATH_CHROMEDRIVER", "logger", "PROJECT_DATABASE"] 7 | # --------------------------------------------------- 8 | # TODO [√] 项目索引路径定位 9 | # --------------------------------------------------- 10 | # 定位工程根目录 SERVER_DIR_PROJECT 11 | PROJECT_ROOT = dirname(__file__) 12 | 13 | # 文件数据库 目录根 14 | PROJECT_DATABASE = join(PROJECT_ROOT, "database") 15 | 16 | # chromedriver 可执行文件路径 17 | PATH_CHROMEDRIVER = join(PROJECT_ROOT, "chromedriver.exe") 18 | 19 | # --------------------------------------------------- 20 | # TODO [√] 运行日志配置 21 | # --------------------------------------------------- 22 | # 运行日志路径 23 | PATH_LOGGER = join(PROJECT_DATABASE, "logs") 24 | # 运行日志 25 | logger.add( 26 | sink=join(PATH_LOGGER, "error.log"), 27 | level="ERROR", 28 | rotation="1 week", 29 | encoding="utf8", 30 | ) 31 | 32 | logger.add( 33 | sink=join(PATH_LOGGER, "runtime.log"), 34 | level="DEBUG", 35 | rotation="1 day", 36 | retention="20 days", 37 | encoding="utf8", 38 | ) 39 | 40 | # --------------------------------------------------- 41 | # TODO [*] 自动调整 42 | # --------------------------------------------------- 43 | # 若chromedriver不在CHROMEDRIVER_PATH指定的路径下 尝试从环境变量中查找路径' 44 | if not exists(PATH_CHROMEDRIVER): 45 | CHROMEDRIVER_PATH = None 46 | 47 | # 目录补全 48 | for _pending in [PROJECT_DATABASE, ]: 49 | if not exists(_pending): 50 | os.mkdir(_pending) 51 | -------------------------------------------------------------------------------- /src/armour/apis.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Time : 2021/12/16 16:10 3 | # Author : QIN2DIM 4 | # Github : https://github.com/QIN2DIM 5 | # Description: 6 | 7 | from .core import EmailRelay, Chrome 8 | 9 | 10 | def get_verification_code( 11 | link: str, 12 | chromedriver_path: str = None, 13 | driver: Chrome = None, 14 | silence: bool = True 15 | ) -> str: 16 | """ 17 | 监听来件并识别验证码,返回邮箱验证码。 18 | 19 | 需要先调用 apis_get_email_context() 获得邮箱账号 20 | 21 | :param driver: 22 | :param chromedriver_path: 23 | :param silence: 24 | :param link: 邮箱指纹链接,被封装在 apis_get_email_context() 的返回值中 25 | :return: 26 | """ 27 | chromedriver_path = "chromedriver" if chromedriver_path is None else chromedriver_path 28 | 29 | er = EmailRelay( 30 | url=link, 31 | chromedriver_path=chromedriver_path, 32 | silence=silence 33 | ) 34 | api = er.set_spider_option() if driver is None else driver 35 | 36 | try: 37 | # 站点映射转移 38 | er.get_html_handle(api, er.register_url) 39 | 40 | # 监听新邮件 41 | er.check_receive(api) 42 | 43 | # 切换到邮件正文页面 44 | er.switch_to_mail(api) 45 | 46 | # 清洗出验证码 47 | verification_code = er.get_number(api) 48 | 49 | return verification_code 50 | finally: 51 | api.quit() 52 | 53 | 54 | def get_email_context( 55 | chromedriver_path: str = None, 56 | silence: bool = True 57 | ) -> dict: 58 | """ 59 | 生产具备指纹特性的邮箱 60 | 61 | :param chromedriver_path: 62 | :param silence: 63 | :return: 返回 context 上下文对象,包含 `email` `id` `link` 键值对 64 | """ 65 | chromedriver_path = "chromedriver" if chromedriver_path is None else chromedriver_path 66 | 67 | er = EmailRelay( 68 | chromedriver_path=chromedriver_path, 69 | silence=silence 70 | ) 71 | api = er.set_spider_option() 72 | 73 | try: 74 | # 站点映射转移 75 | er.get_html_handle(api, er.register_url) 76 | 77 | # 获取随机指纹邮箱 78 | er.get_temp_email(api) 79 | 80 | # 使用 context 封装上下文运行环境 81 | context = { 82 | "email": er.email_driver, 83 | "id": er.email_id, 84 | "link": er.mailbox_link.format(er.email_id), 85 | } 86 | 87 | return context 88 | finally: 89 | api.quit() 90 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | .idea 131 | chromedriver.exe 132 | *.png -------------------------------------------------------------------------------- /src/armour/core.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Time : 2021/12/14 21:20 3 | # Author : QIN2DIM 4 | # Github : https://github.com/QIN2DIM 5 | # Description: 6 | import random 7 | import time 8 | 9 | # from undetected_chromedriver.v2 import Chrome, ChromeOptions 10 | # 可以使用 undetected_chromedriver 替代 selenium-Chrome 隐藏指纹特征 11 | from selenium.webdriver import Chrome, ChromeOptions 12 | from selenium.webdriver.common.by import By 13 | from selenium.webdriver.support.expected_conditions import presence_of_element_located 14 | from selenium.webdriver.support.wait import WebDriverWait 15 | 16 | 17 | class EmailRelay: 18 | def __init__(self, url: str = "https://www.linshiyouxiang.net/", 19 | chromedriver_path: str = "chromedriver", silence: bool = True): 20 | self.register_url = url 21 | self.chromedriver_path = chromedriver_path 22 | 23 | self.silence = silence 24 | self.pending_domains = ["@bytetutorials.net", "@iffygame.com", "@maileven.com", 25 | "@smuggroup.com", "@chapedia.net", "@worldzipcodes.net", 26 | "@chapedia.org"] 27 | self.mailbox_link = "https://www.linshiyouxiang.net/mailbox/{}" 28 | self.email_driver = "admin@rookie.it" 29 | self.email_id = "admin" 30 | 31 | def set_spider_option(self) -> Chrome: 32 | """ 33 | 配置 Chrome 启动属性 34 | :return: 35 | """ 36 | options = ChromeOptions() 37 | 38 | # 静默启动 39 | if self.silence is True: 40 | options.add_argument("--headless") 41 | options.add_argument("--disable-gpu") 42 | options.add_argument("--disable-software-rasterizer") 43 | 44 | return Chrome(options=options, executable_path=self.chromedriver_path) 45 | 46 | @staticmethod 47 | def get_html_handle(api: Chrome, url, wait_seconds: int = 15): 48 | """ 49 | 站点映射转移,封装 get() 函数,增强模块鲁棒性 50 | :param api: 51 | :param url: 52 | :param wait_seconds: 53 | :return: 54 | """ 55 | api.set_page_load_timeout(time_to_wait=wait_seconds) 56 | api.get(url) 57 | 58 | def get_temp_email(self, api: Chrome, timeout: int = 10) -> str: 59 | """ 60 | 获取随机指纹邮箱 61 | :param api: 62 | :param timeout: 63 | :return: 64 | """ 65 | time.sleep(1) 66 | 67 | activate_email: str = WebDriverWait(api, timeout).until(presence_of_element_located(( 68 | By.TAG_NAME, "input" 69 | ))).get_attribute("data-clipboard-text") 70 | 71 | self.email_id = activate_email.split("@")[0] 72 | 73 | self.email_driver = self.email_id + random.choice(self.pending_domains) 74 | 75 | return self.email_driver 76 | 77 | @staticmethod 78 | def check_receive(api: Chrome) -> bool: 79 | """ 80 | 监听新邮件 81 | :param api: 82 | :return: 83 | """ 84 | while True: 85 | checker_tag: str = api.find_elements(By.XPATH, "//tbody//td[@class='text-center']") 86 | if checker_tag.__len__() != 1: 87 | return True 88 | time.sleep(2) 89 | 90 | @staticmethod 91 | def switch_to_mail(api: Chrome) -> bool: 92 | """ 93 | 跳转到邮件正文页面 94 | :param api: 95 | :return: 96 | """ 97 | while True: 98 | details_tag = api.find_elements(By.XPATH, "//tbody//td[@class='text-center']//a") 99 | if details_tag: 100 | details_tag[0].click() 101 | return True 102 | time.sleep(1) 103 | 104 | @staticmethod 105 | def get_number(api: Chrome) -> str: 106 | """ 107 | 获取验证码 108 | :param api: 109 | :return: 110 | """ 111 | while True: 112 | content_box = api.find_elements(By.XPATH, "//td[@valign='top']//span") 113 | if content_box: 114 | for i in content_box: 115 | pending_str: str = i.text 116 | if pending_str.isdigit(): 117 | return pending_str 118 | time.sleep(1) 119 | -------------------------------------------------------------------------------- /examples/_base.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Time : 2021/12/16 16:27 3 | # Author : QIN2DIM 4 | # Github : https://github.com/QIN2DIM 5 | # Description: 用于运行实例的调度框架 6 | import random 7 | import time 8 | from string import printable 9 | 10 | import requests 11 | from requests.exceptions import ( 12 | ConnectionError, 13 | SSLError, 14 | HTTPError, 15 | Timeout, 16 | ProxyError 17 | ) 18 | from selenium.common.exceptions import ( 19 | WebDriverException, 20 | ElementNotInteractableException, 21 | NoSuchElementException 22 | ) 23 | from selenium.webdriver import Chrome, ChromeOptions 24 | from selenium.webdriver.common.by import By 25 | from selenium.webdriver.support.expected_conditions import ( 26 | presence_of_element_located, 27 | element_to_be_clickable 28 | ) 29 | from selenium.webdriver.support.wait import WebDriverWait 30 | 31 | from src.config import logger 32 | 33 | 34 | class CatWalk: 35 | def __init__( 36 | self, register_url: str, silence: bool = False, anti_email: bool = False, 37 | usr_email: bool = None, chromedriver_path: str = None, action_name: str = None 38 | ): 39 | self.register_url = register_url 40 | self.silence = silence 41 | self.anti_email = anti_email 42 | self.usr_email = usr_email 43 | self.email_object_context = {} 44 | self.chromedriver_path = "chromedriver" if chromedriver_path is None else chromedriver_path 45 | self.action_name = "CatWalk" if action_name is None else action_name 46 | 47 | self.username, self.password, self.email = "", "", "" 48 | self.beat_dance = 0 49 | self.timeout_retry_time = 3 50 | 51 | def set_spider_option(self): 52 | options = ChromeOptions() 53 | 54 | # 静默启动 55 | if self.silence is True: 56 | options.add_argument("--headless") 57 | options.add_argument("--disable-gpu") 58 | options.add_argument("--disable-software-rasterizer") 59 | 60 | try: 61 | return Chrome(options=options) 62 | except WebDriverException as e: 63 | if "chromedriver" in str(e): 64 | print(f">>> CHROMEDRIVER_PATH 路径下指定目录下缺少(对应浏览器版本的)chromedriver。") 65 | print(f">>> 默认情况下,您需要将(对应浏览器版本的)chromedriver 放置于 main.py 同级目录下。") 66 | print(f">>> 请参考 ./src/config.py 的相关注释配置CHROMEDRIVER_PATH," 67 | f"此外,您还可以访问本项目技术文档寻找答案:\n" 68 | f"https://github.com/QIN2DIM/sspanel-email") 69 | print(f">>> 若以上方式无法帮助到您,请于本项目 issue 提交您的报错信息:\n" 70 | f"https://github.com/QIN2DIM/armour-email/issues") 71 | exit() 72 | 73 | def check_heartbeat(self): 74 | url = self.register_url 75 | session = requests.session() 76 | try: 77 | response = session.get(url, timeout=5) 78 | if response.status_code > 400: 79 | logger.error(f"站点异常 - url={url} status_code={response.status_code} ") 80 | return False 81 | return True 82 | # 站点被动行为,流量无法过墙 83 | except ConnectionError: 84 | logger.error(f"流量阻断 - url={url}") 85 | return False 86 | # 站点主动行为,拒绝国内IP访问 87 | except (SSLError, HTTPError, ProxyError): 88 | logger.warning(f"代理异常 - url={url}") 89 | return False 90 | # 站点负载紊乱或主要服务器已瘫痪 91 | except Timeout: 92 | logger.error(f"响应超时 - url={url}") 93 | return False 94 | 95 | @staticmethod 96 | def get_html_handle(api: Chrome, url, wait_seconds: int = 15): 97 | api.set_page_load_timeout(time_to_wait=wait_seconds) 98 | api.get(url) 99 | 100 | def generate_account(self, email_class: str = "@qq.com"): 101 | # 账号信息 102 | username = "".join( 103 | [random.choice(printable[: printable.index("!")]) for _ in range(9)] 104 | ) 105 | password = "".join( 106 | [random.choice(printable[: printable.index(" ")]) for _ in range(15)] 107 | ) 108 | 109 | # 根据实例特性生成 faker email object 110 | # 若不要求验证邮箱,使用随机字节码,否则使用备用方案生成可接受验证码的邮箱对象 111 | if not self.anti_email: 112 | if not self.usr_email: 113 | email = username 114 | else: 115 | email = username + email_class 116 | else: 117 | self.utils_email(method="email") 118 | email = self.email_object_context.get("email") 119 | return username, password, email 120 | 121 | def utils_email(self, method="email"): 122 | if method == "email": 123 | from src.armour import get_email_context 124 | self.email_object_context = get_email_context(self.chromedriver_path, silence=True) 125 | elif method == "code": 126 | from src.armour import get_verification_code 127 | link = self.email_object_context.get("link", "") 128 | if link.startswith("https://"): 129 | driver = self.email_object_context.get("driver") 130 | email_code = get_verification_code( 131 | link=link, 132 | chromedriver_path=self.chromedriver_path, 133 | driver=driver, 134 | silence=True 135 | ) 136 | self.email_object_context["code"] = email_code 137 | 138 | def sign_up(self, api: Chrome): 139 | self.username, self.password, self.email = self.generate_account() 140 | 141 | while True: 142 | # ====================================== 143 | # 填充注册数据 144 | # ====================================== 145 | time.sleep(0.5 + self.beat_dance) 146 | try: 147 | WebDriverWait(api, 20).until( 148 | presence_of_element_located((By.ID, "name")) 149 | ).send_keys(self.username) 150 | 151 | email_ = api.find_element(By.ID, "email") 152 | passwd_ = api.find_element(By.ID, "passwd") 153 | repasswd_ = api.find_element(By.ID, "repasswd") 154 | email_.clear() 155 | email_.send_keys(self.email) 156 | passwd_.clear() 157 | passwd_.send_keys(self.password) 158 | repasswd_.clear() 159 | repasswd_.send_keys(self.password) 160 | except (ElementNotInteractableException, WebDriverException): 161 | time.sleep(0.5 + self.beat_dance) 162 | continue 163 | 164 | # ====================================== 165 | # 依据实体抽象特征,选择相应的解决方案 166 | # ====================================== 167 | if self.anti_email: 168 | # 发送邮箱验证码 169 | api.find_element(By.ID, "email_verify").click() 170 | # 确认发送邮箱验证码 171 | time.sleep(0.5 + self.beat_dance) 172 | WebDriverWait(api, 10).until(element_to_be_clickable(( 173 | By.XPATH, "//button[@class='swal2-confirm swal2-styled']" 174 | ))).click() 175 | # 监听并接受邮箱验证码 176 | self.utils_email(method="code") 177 | verification_code = self.email_object_context.get("code") 178 | # 填写邮箱验证码 179 | email_code = api.find_element(By.ID, "email_code") 180 | email_code.clear() 181 | email_code.send_keys(verification_code) 182 | # ====================================== 183 | # 提交注册数据,完成注册任务 184 | # ====================================== 185 | # 点击注册按键 186 | time.sleep(0.5) 187 | for _ in range(3): 188 | try: 189 | api.find_element(By.ID, "register-confirm").click() 190 | except (ElementNotInteractableException, WebDriverException): 191 | print(f"正在同步集群节拍 | " 192 | f"action={self.action_name} " 193 | f"hold={1.5 + self.beat_dance}s " 194 | f"session_id={api.session_id} " 195 | f"event=`register-pending`") 196 | time.sleep(self.timeout_retry_time + self.beat_dance) 197 | continue 198 | 199 | time.sleep(0.5) 200 | for _ in range(3): 201 | try: 202 | api.find_element(By.XPATH, "//button[contains(@class,'confirm')]").click() 203 | return True 204 | except NoSuchElementException: 205 | time.sleep(self.timeout_retry_time + self.beat_dance) 206 | continue 207 | else: 208 | api.refresh() 209 | self.sign_up(api) 210 | 211 | def go(self): 212 | """ 213 | 214 | :return: 215 | """ 216 | raise ImportError 217 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------