[
  {
    "path": ".env-example",
    "content": "API_ID=\nAPI_HASH=\n\nREF_LINK=\nAUTO_TASK=\nAUTO_PLAY_GAME=\nDELAY_EACH_ACCOUNT=\n\nMORE_ACCURATE_CAPTCHA_SOLVER=\n\nUSE_PROXY_FROM_FILE=\n"
  },
  {
    "path": ".gitignore",
    "content": ".env\nsessions\ndata.txt\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "## Recommendation before use\n\n# Join the bot [here](https://t.me/Binance_Moonbix_bot/start?startApp=ref_6624523270&startapp=ref_6624523270&utm_medium=web_share_copy)\n\n> [!WARNING]\n> ⚠️ I do my best to avoid detection of bots, but using bots is forbidden in all airdrops. i cannot guarantee that you will not be detected as a bot. Use at your own risk. I am not responsible for any consequences of using this software.\n\n# 🔥🔥 MUST USE PYTHON 3.11.5 (CAPTCHA VERSION ISN'T WORK ON TERMUX)🔥🔥\n\n## Features  \n| Feature                                                     | Supported  |\n|---------------------------------------------------------------|:----------------:|\n| Multithreading                                                |        ✅        |\n| Proxy binding to session                                      |        ✅        |\n| Auto ref                                                      |        ✅        |\n| Auto checkin                                                  |        ✅        |\n| Auto play game                                                |        ✅        |\n| Auto solve captcha                                             |        ✅        |\n| Support for pyrogram .session                                 |        ✅        |\nAuto get maxium points each game        |        ✅        |\n## [Settings](https://github.com/vanhbakaa/moonbix-bot/blob/main/.env-example)\n| Settings | Description |\n|----------------------------|:-------------------------------------------------------------------------------------------------------------:|\n| **API_ID / API_HASH**      | Platform data from which to run the Telegram session (default - android)                                      |       \n| **REF_LINK**               | Put your ref link here (default: my ref link)                                                                 |\n| **AUTO_TASK**              | Auto do task (default: True)                                                                                  |\n| **AUTO_PLAY_GAME**         | AUTO PLAY GAME (default: True)                                                                                |\n| **MORE_ACCURATE_CAPTCHA_SOLVER**         | Option to use more accurate solver (it will slower) (default: False)                                                                                |\n| **DELAY_EACH_ACCOUNT**         | SLEEP between each account (default: [15,25])                                                                                |\n| **USE_PROXY_FROM_FILE**    | Whether to use a proxy from the bot/config/proxies.txt file (True / False)                                    |\n\n\n## Quick Start 📚\n\nTo install libraries and run bot - open run.bat on Windows\n\n## Prerequisites\nBefore you begin, make sure you have the following installed:\n- [Python](https://www.python.org/downloads/) **version 3.11.5**\n\n## Obtaining API Keys\n1. Go to my.telegram.org and log in using your phone number.\n2. Select \"API development tools\" and fill out the form to register a new application.\n3. Record the API_ID and API_HASH provided after registering your application in the .env file.\n\n## Installation\nYou can download the [**repository**](https://github.com/vanhbakaa/Kaia-bot/) by cloning it to your system and installing the necessary dependencies:\n```shell\ngit clone https://github.com/vanhbakaa/moonbix-bot.git\ncd moonbix-bot\n```\n\nThen you can do automatic installation by typing:\n\nWindows:\n```shell\nrun.bat\n```\n\nLinux:\n```shell\nrun.sh\n```\n\n# Linux manual installation\n```shell\npython3 -m venv venv\nsource venv/bin/activate\npip3 install -r requirements.txt\ncp .env-example .env\nnano .env  # Here you must specify your API_ID and API_HASH, the rest is taken by default\npython3 main.py\n```\n\nYou can also use arguments for quick start, for example:\n```shell\n~/moonbix-bot >>> python3 main.py --action (1/2)\n# Or\n~/moonbix-bot >>> python3 main.py -a (1/2)\n\n# 1 - Run clicker\n# 2 - Creates a session\n```\n\n# Windows manual installation\n```shell\npython -m venv venv\nvenv\\Scripts\\activate\npip install -r requirements.txt\ncopy .env-example .env\n# Here you must specify your API_ID and API_HASH, the rest is taken by default\npython main.py\n```\nYou can also use arguments for quick start, for example:\n```shell\n~/moonbix-bot >>> python main.py --action (1/2)\n# Or\n~/moonbix-bot >>> python main.py -a (1/2)\n\n# 1 - Run clicker\n# 2 - Creates a session\n```\n\n# Termux manual installation\n```\n> pkg update && pkg upgrade -y\n> pkg install python rust git -y\n> git clone https://github.com/vanhbakaa/moonbix-bot.git\n> cd moonbix-bot\n> pip install -r requirements.txt\n> python main.py\n```\n\nYou can also use arguments for quick start, for example:\n```termux\n~/moonbix-bot > python main.py --action (1/2)\n# Or\n~/moonbix-bot > python main.py -a (1/2)\n\n# 1 - Run clicker\n# 2 - Creates a session \n```\n# Support This Project\n\nIf you'd like to support the development of this project, please consider making a donation. Every little bit helps!\n\n👉 **[Click here to view donation options](https://github.com/vanhbakaa/Donation/blob/main/README.md)** 👈\n\nYour support allows us to keep improving the project and bring more features!\n\nThank you for your generosity! 🙌\n\n### Contacts\n\nFor support or questions, you can contact me [![Static Badge](https://img.shields.io/badge/Telegram-Channel-Link?style=for-the-badge&logo=Telegram&logoColor=white&logoSize=auto&color=blue)](https://t.me/airdrop_tool_vanh)\n"
  },
  {
    "path": "bot/__init__.py",
    "content": "__version__ = '1.0'\n"
  },
  {
    "path": "bot/config/__init__.py",
    "content": "from .config import settings\n"
  },
  {
    "path": "bot/config/config.py",
    "content": "from pydantic_settings import BaseSettings, SettingsConfigDict\n\n\nclass Settings(BaseSettings):\n    model_config = SettingsConfigDict(env_file=\".env\", env_ignore_empty=True)\n\n    API_ID: int\n    API_HASH: str\n\n\n    REF_LINK: str = \"https://t.me/Binance_Moonbix_bot/start?startApp=ref_6624523270&startapp=ref_6624523270&utm_medium=web_share_copy\"\n    AUTO_TASK: bool = True\n    AUTO_PLAY_GAME: bool = True\n    DELAY_EACH_ACCOUNT: list[int] = [60, 120]\n\n    MORE_ACCURATE_CAPTCHA_SOLVER: bool = False\n\n    USE_PROXY_FROM_FILE: bool = False\n\n\nsettings = Settings()\n\n"
  },
  {
    "path": "bot/config/proxies.txt",
    "content": "http://38.154.227.167:5868:vanhbaka:Vanhdayyyy\r\nhttp://45.127.248.127:5128:vanhbaka:Vanhdayyyy\r\nhttp://207.244.217.165:6712:vanhbaka:Vanhdayyyy\r\n"
  },
  {
    "path": "bot/core/__init__.py",
    "content": "__version__ = '1.0'"
  },
  {
    "path": "bot/core/agents.py",
    "content": "import random\n\n\ndef generate_random_user_agent(device_type='android', browser_type='chrome'):\n    chrome_versions = list(range(110, 127))\n    firefox_versions = list(range(90, 100))\n\n    if browser_type == 'chrome':\n        major_version = random.choice(chrome_versions)\n        minor_version = random.randint(0, 9)\n        build_version = random.randint(1000, 9999)\n        patch_version = random.randint(0, 99)\n        browser_version = f\"{major_version}.{minor_version}.{build_version}.{patch_version}\"\n    elif browser_type == 'firefox':\n        browser_version = random.choice(firefox_versions)\n\n    if device_type == 'android':\n        android_versions = ['10.0', '11.0', '12.0', '13.0']\n        android_device = random.choice([\n            'SM-G960F', 'Pixel 5', 'SM-A505F', 'Pixel 4a', 'Pixel 6 Pro', 'SM-N975F',\n            'SM-G973F', 'Pixel 3', 'SM-G980F', 'Pixel 5a', 'SM-G998B', 'Pixel 4',\n            'SM-G991B', 'SM-G996B', 'SM-F711B', 'SM-F916B', 'SM-G781B', 'SM-N986B',\n            'SM-N981B', 'Pixel 2', 'Pixel 2 XL', 'Pixel 3 XL', 'Pixel 4 XL',\n            'Pixel 5 XL', 'Pixel 6', 'Pixel 6 XL', 'Pixel 6a', 'Pixel 7', 'Pixel 7 Pro',\n            'OnePlus 8', 'OnePlus 8 Pro', 'OnePlus 9', 'OnePlus 9 Pro', 'OnePlus Nord', 'OnePlus Nord 2',\n            'OnePlus Nord CE', 'OnePlus 10', 'OnePlus 10 Pro', 'OnePlus 10T', 'OnePlus 10T Pro',\n            'Xiaomi Mi 9', 'Xiaomi Mi 10', 'Xiaomi Mi 11', 'Xiaomi Redmi Note 8', 'Xiaomi Redmi Note 9',\n            'Huawei P30', 'Huawei P40', 'Huawei Mate 30', 'Huawei Mate 40', 'Sony Xperia 1',\n            'Sony Xperia 5', 'LG G8', 'LG V50', 'LG V60', 'Nokia 8.3', 'Nokia 9 PureView'\n        ])\n        android_version = random.choice(android_versions)\n        if browser_type == 'chrome':\n            return (f\"Mozilla/5.0 (Linux; Android {android_version}; {android_device}) AppleWebKit/537.36 \"\n                    f\"(KHTML, like Gecko) Chrome/{browser_version} Mobile Safari/537.36\")\n        elif browser_type == 'firefox':\n            return (f\"Mozilla/5.0 (Android {android_version}; Mobile; rv:{browser_version}.0) \"\n                    f\"Gecko/{browser_version}.0 Firefox/{browser_version}.0\")\n\n    elif device_type == 'ios':\n        ios_versions = ['13.0', '14.0', '15.0', '16.0']\n        ios_version = random.choice(ios_versions)\n        if browser_type == 'chrome':\n            return (f\"Mozilla/5.0 (iPhone; CPU iPhone OS {ios_version.replace('.', '_')} like Mac OS X) \"\n                    f\"AppleWebKit/537.36 (KHTML, like Gecko) CriOS/{browser_version} Mobile/15E148 Safari/604.1\")\n        elif browser_type == 'firefox':\n            return (f\"Mozilla/5.0 (iPhone; CPU iPhone OS {ios_version.replace('.', '_')} like Mac OS X) \"\n                    f\"AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/{browser_version}.0 Mobile/15E148 Safari/605.1.15\")\n\n    elif device_type == 'windows':\n        windows_versions = ['10.0', '11.0']\n        windows_version = random.choice(windows_versions)\n        if browser_type == 'chrome':\n            return (f\"Mozilla/5.0 (Windows NT {windows_version}; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) \"\n                    f\"Chrome/{browser_version} Safari/537.36\")\n        elif browser_type == 'firefox':\n            return (f\"Mozilla/5.0 (Windows NT {windows_version}; Win64; x64; rv:{browser_version}.0) \"\n                    f\"Gecko/{browser_version}.0 Firefox/{browser_version}.0\")\n\n    elif device_type == 'ubuntu':\n        if browser_type == 'chrome':\n            return (f\"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) AppleWebKit/537.36 (KHTML, like Gecko) \"\n                    f\"Chrome/{browser_version} Safari/537.36\")\n        elif browser_type == 'firefox':\n            return (f\"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:{browser_version}.0) Gecko/{browser_version}.0 \"\n                    f\"Firefox/{browser_version}.0\")\n\n    return None\n"
  },
  {
    "path": "bot/core/headers.py",
    "content": "headers = {\n    'Accept': '*/*',\n    'Accept-Language': 'en-US',\n    \"Bnc-Uuid\": \"\",\n    'Clienttype': \"web\",\n    'Content-Type': 'application/json',\n    'Csrftoken': 'd41d8cd98f00b204e9800998ecf8427e',\n    'Device-Info': \"\",\n    \"Priority\": \"u=1, i\",\n    \"Fvideo-Id\": \"33bda003f0aea1fa919ee400b6e9f40775ff584a\",\n    \"Fvideo-Token\": \"\",\n    \"Lang\": \"en\",\n    'Origin': 'https://www.binance.com',\n    'Referer': 'https://www.binance.com/en/game/tg/moon-bix',\n    'Sec-Fetch-Dest': 'empty',\n    'Sec-Fetch-Mode': 'cors',\n    'Sec-Fetch-Site': 'same-origin',\n    'User-Agent': 'Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.165 Mobile Safari/537.36',\n    \"X-Growth-Token\": \"\"\n}"
  },
  {
    "path": "bot/core/query.py",
    "content": "import asyncio\r\nimport json\r\nimport random\r\nimport traceback\r\nfrom itertools import cycle\r\nfrom time import time\r\nfrom urllib.parse import unquote, quote\r\nfrom Crypto.Cipher import AES\r\nfrom Crypto.Util.Padding import pad\r\nfrom Crypto.Random import get_random_bytes\r\nimport base64\r\n\r\nimport aiohttp\r\nfrom aiocfscrape import CloudflareScraper\r\nfrom aiohttp_proxy import ProxyConnector\r\nfrom better_proxy import Proxy\r\nfrom pyrogram import Client\r\nfrom pyrogram.errors import Unauthorized, UserDeactivated, AuthKeyUnregistered, FloodWait\r\nfrom pyrogram.raw.types import InputBotAppShortName\r\nfrom pyrogram.raw.functions.messages import RequestAppWebView\r\nfrom soupsieve.util import lower\r\n\r\nfrom bot.core.agents import generate_random_user_agent\r\nfrom bot.config import settings\r\nimport cloudscraper\r\nfrom math import sqrt\r\n\r\nfrom bot.utils import logger\r\nfrom bot.exceptions import InvalidSession\r\nfrom .headers import headers\r\nfrom random import randint, choices, choice, uniform\r\nimport secrets\r\nimport uuid\r\nfrom faker import Faker\r\nimport string\r\n\r\n\r\nfake = Faker()\r\nmin_length = 256\r\nmax_length = 1024\r\n\r\n\r\ndef base64_encode(data):\r\n    return base64.b64encode(data).decode('utf-8')\r\n\r\n\r\nclass Tapper:\r\n    def __init__(self, query: str, accname: str):\r\n        self.query = query\r\n        self.session_name = accname\r\n        self.first_name = ''\r\n        self.last_name = ''\r\n        temp_query = unquote(query)\r\n        self.user_id = temp_query.split('\"id\":')[1].split(',\"first_name\"')[0]\r\n        # print(self.user_id)\r\n        self.user = ''\r\n        self.auth_token = \"\"\r\n        self.last_claim = None\r\n        self.last_checkin = None\r\n        self.balace = 0\r\n        self.access_token = None\r\n        self.game_response = None\r\n        self.game = None\r\n        self.rs = 1000\r\n        self.curr_time = None\r\n\r\n    def random_fingerprint(self, lengths=32):\r\n        return ''.join(choices('0123456789abcdef', k=lengths))\r\n\r\n    def generate_Fvideo_token(self, length):\r\n\r\n        characters = string.ascii_letters + string.digits + \"+/\"\r\n        digits = string.digits\r\n        characters1 = string.ascii_letters + digits\r\n\r\n        random_string = ''.join(choice(characters) for _ in range(length - 3))\r\n\r\n        random_string += '='\r\n        random_string += choice(digits)\r\n        random_string += choice(characters1)\r\n\r\n        return random_string\r\n\r\n    fake = Faker()\r\n\r\n    def get_random_resolution(self):\r\n        width = randint(720, 1920)\r\n        height = randint(720, 1080)\r\n        return f\"{width},{height}\"\r\n\r\n    def get_random_timezone(self):\r\n        timezones = [\r\n            \"GMT+07:00\", \"GMT+05:30\", \"GMT-08:00\", \"GMT+00:00\", \"GMT+03:00\"\r\n        ]\r\n        return choice(timezones)\r\n\r\n    def get_random_timezone_offset(self, timezone):\r\n        # Extract the offset from the timezone format \"GMT+07:00\"\r\n        sign = 1 if \"+\" in timezone else -1\r\n        hours = int(timezone.split(\"GMT\")[1].split(\":\")[0])\r\n        return sign * hours * 60\r\n\r\n    def get_random_plugins(self):\r\n        plugins = [\r\n            \"PDF Viewer,Chrome PDF Viewer,Chromium PDF Viewer,Microsoft Edge PDF Viewer,WebKit built-in PDF\",\r\n            \"Flash,Java,Silverlight,QuickTime\",\r\n            \"Chrome PDF Viewer,Widevine Content Decryption Module\",\r\n        ]\r\n        return choice(plugins)\r\n\r\n    def get_random_canvas_code(self):\r\n        return ''.join(choices(lower(string.hexdigits), k=8))\r\n\r\n    def get_random_fingerprint(self):\r\n        return ''.join(choices(lower(string.hexdigits), k=32))\r\n\r\n    def generate_random_data(self, user_agent):\r\n        timezone = self.get_random_timezone()\r\n        sol = self.get_random_resolution()\r\n        data = {\r\n            \"screen_resolution\": sol,\r\n            \"available_screen_resolution\": sol,\r\n            \"system_version\": fake.random_element([\"Windows 10\", \"Windows 11\", \"Ubuntu 20.04\"]),\r\n            \"brand_model\": fake.random_element([\"unknown\", \"Dell XPS 13\", \"HP Spectre\"]),\r\n            \"system_lang\": \"en-EN\",\r\n            \"timezone\": timezone,\r\n            \"timezoneOffset\": self.get_random_timezone_offset(timezone),\r\n            \"user_agent\": user_agent,\r\n            \"list_plugin\": self.get_random_plugins(),\r\n            \"canvas_code\": self.get_random_canvas_code(),\r\n            \"webgl_vendor\": fake.company(),\r\n            \"webgl_renderer\": f\"ANGLE ({fake.company()}, {fake.company()} Graphics)\",\r\n            \"audio\": str(uniform(100, 130)),\r\n            \"platform\": fake.random_element([\"Win32\", \"Win64\"]),\r\n            \"web_timezone\": fake.timezone(),\r\n            \"device_name\": f\"{fake.user_agent()} ({fake.random_element(['Windows'])})\",\r\n            \"fingerprint\": self.get_random_fingerprint(),\r\n            \"device_id\": \"\",\r\n            \"related_device_ids\": \"\"\r\n        }\r\n        return data\r\n\r\n    async def check_proxy(self, http_client: aiohttp.ClientSession, proxy: Proxy):\r\n        try:\r\n            response = await http_client.get(url='https://httpbin.org/ip', timeout=aiohttp.ClientTimeout(5), ssl=False)\r\n            ip = (await response.json()).get('origin')\r\n            logger.info(f\"{self.session_name} | Proxy IP: {ip}\")\r\n            return True\r\n        except Exception as error:\r\n            logger.error(f\"{self.session_name} | Proxy: {proxy} | Error: {error}\")\r\n            return False\r\n\r\n    def setup_session(self, session: cloudscraper.CloudScraper):\r\n        payload = {\r\n            \"queryString\": self.auth_token,\r\n            \"socialType\": \"telegram\"\r\n        }\r\n        response = session.post(\r\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/third-party/access/accessToken\",\r\n            headers=headers, json=payload)\r\n        data_ = response.json()\r\n        if data_['code'] == '000000':\r\n            logger.success(f\"{self.session_name} | <green>Get access token sucessfully</green>\")\r\n            self.access_token = data_['data']['accessToken']\r\n        else:\r\n            logger.warning(f\"{self.session_name} | <red>Get access token failed: {data_}</red>\")\r\n\r\n    def random_data_type(self, type, end_time, item_size, item_pts, pos_y: float):\r\n        # I WOKED HARD TO FIND OUT THIS.SO IF U COPY PLEASE CREDIT ME !\r\n\r\n        # end_time = int(end_time)\r\n        if type == 1:\r\n            pick_time = self.curr_time + self.rs\r\n            if pick_time >= end_time:\r\n                pick_time = end_time - 1000\r\n                return None\r\n\r\n            hook_pos_x = \"{:.3f}\".format(round(uniform(75, 230), 3))\r\n            hook_pos_y = \"{:.3f}\".format(round(uniform(199, 230), 3))\r\n            hook_hit_x = \"{:.3f}\".format(round(uniform(100, 400), 3))\r\n            hook_hit_y = \"{:.3f}\".format(pos_y)\r\n\r\n            multi = (float(hook_hit_x) - float(hook_pos_x)) * (float(hook_hit_x) - float(hook_pos_x))\r\n            mult2i = (float(hook_hit_y) - float(hook_pos_y)) * (float(hook_hit_y) - float(hook_pos_y))\r\n            cal_angle = (float(hook_pos_x) - float(hook_hit_x)) / (sqrt(multi + mult2i))\r\n            hook_shot_angle = \"{:.3f}\".format(cal_angle)\r\n\r\n            item_type = 1\r\n            item_s = item_size\r\n            point = randint(1, 200)\r\n\r\n        elif type == 2:\r\n            pick_time = self.curr_time + self.rs\r\n            if pick_time >= end_time:\r\n                pick_time = end_time - 1000\r\n                return None\r\n\r\n            hook_pos_x = \"{:.3f}\".format(round(uniform(75, 230), 3))\r\n            hook_pos_y = \"{:.3f}\".format(round(uniform(199, 230), 3))\r\n            #  hook_shot_angle = \"{:.3f}\".format(round(uniform(-1, 1), 3))\r\n            hook_hit_x = \"{:.3f}\".format(round(uniform(100, 400), 3))\r\n            hook_hit_y = \"{:.3f}\".format(pos_y)\r\n            multi = (float(hook_hit_x) - float(hook_pos_x)) * (float(hook_hit_x) - float(hook_pos_x))\r\n            mult2i = (float(hook_hit_y) - float(hook_pos_y)) * (float(hook_hit_y) - float(hook_pos_y))\r\n            cal_angle = (float(hook_pos_x) - float(hook_hit_x)) / (sqrt(multi + mult2i))\r\n            hook_shot_angle = \"{:.3f}\".format(cal_angle)\r\n            item_type = 2\r\n            item_s = item_size\r\n            point = int(item_size) + int(item_pts)\r\n\r\n        elif type == 0:\r\n            pick_time = self.curr_time + self.rs\r\n            if pick_time >= end_time:\r\n                pick_time = end_time - 1000\r\n                return None\r\n\r\n            hook_pos_x = \"{:.3f}\".format(round(uniform(75, 230), 3))\r\n            hook_pos_y = \"{:.3f}\".format(round(uniform(199, 230), 3))\r\n            # hook_shot_angle = \"{:.3f}\".format(round(uniform(-1, 1), 3))\r\n            hook_hit_x = \"{:.3f}\".format(round(uniform(100, 400), 3))\r\n            hook_hit_y = \"{:.3f}\".format(pos_y)\r\n            multi = (float(hook_hit_x) - float(hook_pos_x)) * (float(hook_hit_x) - float(hook_pos_x))\r\n            mult2i = (float(hook_hit_y) - float(hook_pos_y)) * (float(hook_hit_y) - float(hook_pos_y))\r\n\r\n            cal_angle = (float(hook_pos_x) - float(hook_hit_x)) / (sqrt(multi + mult2i))\r\n\r\n            hook_shot_angle = \"{:.3f}\".format(cal_angle)\r\n\r\n            item_type = 0\r\n            item_s = item_size\r\n            point = randint(1, 200)\r\n        else:\r\n            pick_time = self.curr_time + self.rs\r\n            if pick_time >= end_time:\r\n                pick_time = end_time - 1000\r\n                return None\r\n\r\n            hook_pos_x = \"{:.3f}\".format(round(uniform(75, 230), 3))\r\n            hook_pos_y = \"{:.3f}\".format(round(uniform(199, 230), 3))\r\n            hook_shot_angle = \"{:.3f}\".format(round(uniform(-1, 1), 3))\r\n            hook_hit_x = 0\r\n            hook_hit_y = 0\r\n            item_type = randint(0, 2)\r\n            item_s = randint(1, 100)\r\n            point = randint(1, 200)\r\n\r\n        # 1727080937255|272.705|208.070|-0.944|0|0|2|38|12;1727080938339|224.985|241.018|-0.432|249.685|294.600|1|70|182;1727080941172|124.175|241.530|0.420|0|0|2|57|186;1727080943373|77.580|210.808|0.910|0|0|2|7|140;1727080944891|181.929|250.277|-0.066|189.091|359.041|2|60|90;1727080948123|269.666|211.426|-0.902|0|0|2|92|11;1727080949024|279.568|199.250|-1.047|0|0|2|60|34;1727080950908|162.174|250.020|0.096|144.951|428.190|0|30|191;1727080953975|78.758|212.055|0.895|0|0|0|1|151;1727080955243|133.916|244.791|0.334|103.100|333.596|1|30|15;1727080957193|278.835|200.291|-1.035|0|0|1|5|150;1727080959444|209.788|245.932|-0.298|303.593|550.828|1|70|72;1727080965178|87.635|220.354|0.786|0|0|1|85|73;1727080967129|168.297|250.390|0.046|156.376|509.116|1|50|110;1727080971647|188.297|249.779|-0.118|209.403|427.530|1|30|30;1727080974548|145.269|252.269|0.237|105.591|416.545|1|30|92;1727080978299|172.753|252.036|0.010|168.866|661.017|1|50|13\r\n        data = f\"{pick_time}|{hook_pos_x}|{hook_pos_y}|{hook_shot_angle}|{hook_hit_x}|{hook_hit_y}|{item_type}|{item_s}|{point}\"\r\n        return data\r\n\r\n    def encrypt(self, text, key):\r\n        iv = get_random_bytes(12)\r\n        iv_base64 = base64_encode(iv)\r\n        # print(iv_base64[:16].encode('utf-8'))\r\n        cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv_base64[:16].encode('utf-8'))\r\n        ciphertext = cipher.encrypt(pad(text.encode('utf-8'), AES.block_size))\r\n        ciphertext_base64 = base64_encode(ciphertext)\r\n        return iv_base64 + ciphertext_base64\r\n\r\n    def get_game_data(self):\r\n        # I WOKED HARD TO FIND OUT THIS.SO IF U COPY PLEASE CREDIT ME !\r\n        try:\r\n            end_time = int((time() + 45) * 1000)\r\n            # print(end_time)\r\n            random_pick_time = randint(8, 15)\r\n            total_obj = 0\r\n            key_for_game = self.game_response['data']['gameTag']\r\n            obj_type = {\r\n                \"coin\": {},\r\n                \"trap\": {},\r\n                \"bonus\": \"\"\r\n            }\r\n            for obj in self.game_response['data']['cryptoMinerConfig']['itemSettingList']:\r\n                total_obj += obj['quantity']\r\n                if obj['type'] == \"BONUS\":\r\n                    obj_type['bonus'] = f\"{obj['rewardValueList'][0]},{obj['size']}\"\r\n                else:\r\n                    for reward in obj['rewardValueList']:\r\n                        if int(reward) > 0:\r\n                            obj_type['coin'].update({reward: f\"{obj['size']},{obj['quantity']}\"})\r\n                        else:\r\n                            obj_type['trap'].update({abs(int(reward)): f\"{obj['size']},{obj['quantity']}\"})\r\n\r\n            limit = min(total_obj, random_pick_time)\r\n            random_pick_sth_times = randint(1, limit)\r\n            picked_bonus = False\r\n            picked = 0\r\n            logger.info(f\"{self.session_name} | Playing game!\")\r\n            game_data_payload = []\r\n            score = 0\r\n            # print(obj_type)\r\n\r\n            pos_y = []\r\n            for i in range(random_pick_sth_times + 5):\r\n                pos_y.append(uniform(250, 550))\r\n\r\n            sorted_pos_y = sorted(pos_y)\r\n            for i in range(1, len(sorted_pos_y)):\r\n                if sorted_pos_y[i] - sorted_pos_y[i - 1] < 40:\r\n                    sorted_pos_y[i] += randint(40, 55)\r\n\r\n            Total_tap = 0\r\n\r\n            while end_time > self.curr_time and picked < random_pick_sth_times:\r\n                self.rs = randint(2500, 4000)\r\n                random_reward = randint(1, 100)\r\n                if random_reward <= 20:\r\n                    if len(list(obj_type['trap'].keys())) > 0:\r\n                        picked += 1\r\n                        reward_d = choice(list(obj_type['trap'].keys()))\r\n                        quantity = obj_type['trap'][reward_d].split(',')[1]\r\n                        item_size = obj_type['trap'][reward_d].split(',')[0]\r\n                        if int(quantity) > 0:\r\n                            data_ = self.random_data_type(end_time=end_time,\r\n                                                          type=0,\r\n                                                          item_size=int(item_size),\r\n                                                          item_pts=0,\r\n                                                          pos_y=sorted_pos_y[Total_tap])\r\n                            if data_ is not None:\r\n                                Total_tap += 1\r\n                                score = max(0, score - int(reward_d))\r\n                                game_data_payload.append(data_)\r\n                                if int(quantity) - 1 > 0:\r\n                                    obj_type['trap'].update({reward_d: f\"{item_size},{int(quantity) - 1}\"})\r\n\r\n                                else:\r\n                                    obj_type[\"trap\"].pop(reward_d)\r\n                            else:\r\n                                break\r\n                elif random_reward > 20 and random_reward <= 70:\r\n                    if len(list(obj_type['coin'].keys())) > 0:\r\n                        picked += 1\r\n                        reward_d = choice(list(obj_type['coin'].keys()))\r\n                        quantity = obj_type['coin'][reward_d].split(',')[1]\r\n                        item_size = obj_type['coin'][reward_d].split(',')[0]\r\n                        if int(quantity) > 0:\r\n\r\n                            data_ = self.random_data_type(end_time=end_time,\r\n                                                          type=1,\r\n                                                          item_size=item_size,\r\n                                                          item_pts=0,\r\n                                                          pos_y=sorted_pos_y[Total_tap])\r\n                            if data_ is not None:\r\n                                Total_tap += 1\r\n                                score += int(reward_d)\r\n                                game_data_payload.append(data_)\r\n                                if int(quantity) - 1 > 0:\r\n                                    obj_type['coin'].update({reward_d: f\"{item_size},{int(quantity) - 1}\"})\r\n                                else:\r\n                                    obj_type[\"coin\"].pop(reward_d)\r\n                            else:\r\n                                break\r\n                elif random_reward > 70 and random_reward <= 100 and picked_bonus is False:\r\n                    picked += 1\r\n                    size = obj_type['bonus'].split(',')[1]\r\n                    pts = obj_type['bonus'].split(',')[0]\r\n                    data_ = self.random_data_type(end_time=end_time,\r\n                                                  type=2,\r\n                                                  item_size=size,\r\n                                                  item_pts=pts,\r\n                                                  pos_y=sorted_pos_y[Total_tap])\r\n                    if data_ is not None:\r\n                        Total_tap += 1\r\n                        picked_bonus = True\r\n                        score += int(pts)\r\n                        game_data_payload.append(data_)\r\n\r\n                self.curr_time += self.rs\r\n\r\n            if len(game_data_payload) > 0:\r\n\r\n                data_pl = ';'.join(game_data_payload)\r\n                # print(data_pl)\r\n                game_payload = self.encrypt(data_pl, key_for_game)\r\n                self.game = {\r\n                    \"payload\": game_payload,\r\n                    \"log\": score,\r\n                    \"debug\": data_pl\r\n                }\r\n                # print(self.game)\r\n                return True\r\n            else:\r\n                logger.warning(f\"{self.session_name} | <yellow>Failed to play game, reason: Time out</yellow>\")\r\n                return False\r\n        except Exception as error:\r\n            traceback.print_exc()\r\n            logger.error(f\"{self.session_name} | <red>Unknown error while trying to get game data: {str(error)}</red>\")\r\n            return False\r\n\r\n    def setup_account(self, session: cloudscraper.CloudScraper):\r\n        ref_id = settings.REF_LINK.split(\"=\")[1].split('&')[0].split('_')[1]\r\n        payload = {\r\n            \"agentId\": str(ref_id),\r\n            \"resourceId\": 2056\r\n        }\r\n        res = session.post(\r\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/referral\",\r\n            headers=headers,\r\n            json=payload)\r\n        json_d = res.json()\r\n        if json_d['success']:\r\n            res = session.post(\r\n                \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/game/participated\",\r\n                headers=headers, json=payload)\r\n            json_d = res.json()\r\n            if json_d['success']:\r\n                logger.success(f\"{self.session_name} | <green>Successfully set up account !</green>\")\r\n                login_task = {\r\n                    \"resourceId\": 2057\r\n                }\r\n                complete = self.complete_task(session, login_task)\r\n                if complete == \"done\":\r\n                    logger.success(f\"{self.session_name} | <green>Successfully checkin for the first time !</green>\")\r\n\r\n        else:\r\n            logger.warning(\r\n                f\"{self.session_name} | <yellow>Unknown error while tryng to init account: {json_d}</yellow>\")\r\n\r\n    async def get_user_info(self, session: cloudscraper.CloudScraper):\r\n        payload = {\r\n            \"resourceId\": 2056\r\n        }\r\n        response = session.post(\r\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/user/user-info\",\r\n            headers=headers, json=payload)\r\n        data_ = response.json()\r\n        # print(data_)\r\n        if data_['code'] == '000000':\r\n            # print(data_)\r\n            data__ = data_['data']\r\n            if data__['participated'] is False:\r\n                logger.info(f\"{self.session_name} | Attempt to set up account...\")\r\n                self.setup_account(session)\r\n                await asyncio.sleep(uniform(3, 5))\r\n                await self.get_user_info(session)\r\n            else:\r\n                logger.info(f\"{self.session_name} | <cyan>Logged in</cyan>\")\r\n                logger.info(\r\n                    f\"{self.session_name} | Total point: <yellow>{data__['metaInfo']['totalGrade']}</yellow> | <white>Risk Passed: <red>{data__['riskPassed']}</red> | Qualified: <red>{data__['qualified']}</red></white>\")\r\n\r\n        else:\r\n            logger.warning(f\"{self.session_name} | <red>Get user data failed: {data_}</red>\")\r\n\r\n    def get_user_info1(self, session: cloudscraper.CloudScraper):\r\n        payload = {\r\n            \"resourceId\": 2056\r\n        }\r\n        response = session.post(\r\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/user/user-info\",\r\n            headers=headers, json=payload)\r\n        data_ = response.json()\r\n        if data_['code'] == '000000':\r\n            # print(data_)\r\n            data__ = data_['data']\r\n            return data__\r\n        else:\r\n            logger.warning(f\"{self.session_name} | <red>Get ticket data failed: {data_}</red>\")\r\n\r\n    def get_task_list(self, session: cloudscraper.CloudScraper):\r\n        payload = {\r\n            \"resourceId\": 2056\r\n        }\r\n        response = session.post(\r\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/task/list\",\r\n            headers=headers, json=payload)\r\n        data_ = response.json()\r\n        # print(data_)\r\n        if data_['code'] == '000000':\r\n            task_list = data_['data']['data'][0]['taskList']['data']  # bruh what are they doing ????\r\n            tasks = []\r\n            for task in task_list:\r\n                # print(task)\r\n                if task['type'] == \"THIRD_PARTY_BIND\":\r\n                    continue\r\n                elif task['status'] == \"COMPLETED\":\r\n                    continue\r\n                elif task['status'] == \"IN_PROGRESS\":\r\n                    tasks.append(task)\r\n            return tasks\r\n        else:\r\n            logger.warning(f\"{self.session_name} | <red>Get tasks list failed: {data_}</red>\")\r\n            return None\r\n\r\n    def complete_task(self, session: cloudscraper.CloudScraper, task: dict):\r\n        task_ids = [task['resourceId']]\r\n        payload = {\r\n            \"referralCode\": \"null\",\r\n            \"resourceIdList\": task_ids\r\n        }\r\n        response = session.post(\r\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/task/complete\",\r\n            headers=headers, json=payload)\r\n        data_ = response.json()\r\n        # print(data_)\r\n        if data_['success']:\r\n            return \"done\"\r\n        else:\r\n            return data_['messageDetail']\r\n\r\n    def complete_game(self, session: cloudscraper.CloudScraper):\r\n        string_payload = self.game['payload']\r\n        payload = {\r\n            \"log\": self.game['log'],\r\n            \"payload\": string_payload,\r\n            \"resourceId\": 2056\r\n        }\r\n        # print(payload)\r\n        response = session.post(\r\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/game/complete\",\r\n            headers=headers, json=payload)\r\n        data_ = response.json()\r\n\r\n        if data_['success']:\r\n            logger.success(\r\n                f\"{self.session_name} | <green>Sucessfully earned: <yellow>{self.game['log']}</yellow> from game !</green>\")\r\n        else:\r\n            logger.warning(\r\n                f\"{self.session_name} | <yellow>Failed to complete game | {self.game['log']}: {data_}</yellow>\")\r\n\r\n    def auto_update_ticket(self, session: cloudscraper.CloudScraper):\r\n        ticket_data = self.get_user_info1(session)\r\n        return ticket_data['metaInfo']['totalAttempts'] - ticket_data['metaInfo']['consumedAttempts']\r\n\r\n    async def play_game(self, session: cloudscraper.CloudScraper):\r\n        ticket_data = self.get_user_info1(session)\r\n        if ticket_data['metaInfo']['totalAttempts'] == ticket_data['metaInfo']['consumedAttempts']:\r\n            logger.warning(f\"{self.session_name} | No Attempt left to play game...\")\r\n            return\r\n        attempt_left = ticket_data['metaInfo']['totalAttempts'] - ticket_data['metaInfo']['consumedAttempts']\r\n        logger.info(f\"{self.session_name} | Starting to play game...\")\r\n        while attempt_left > 0:\r\n            # await asyncio.sleep(1000)\r\n            logger.info(f\"{self.session_name} | Attempts left: <cyan>{attempt_left}</cyan>\")\r\n            payload = {\r\n                \"resourceId\": 2056\r\n            }\r\n            headers['Fvideo-Token'] = self.generate_Fvideo_token(196)\r\n            # print(headers)\r\n            response = session.post(\r\n                \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/game/start\",\r\n                headers=headers, json=payload)\r\n            if response.status_code == 200:\r\n                data_ = response.json()\r\n                # print(data_)\r\n                if 'sessionId' in data_['data']:\r\n                    # print(\"ok\")\r\n                    sessionId = data_['data']['sessionId']\r\n\r\n                    captcha_data = f\"bizId=tg_mini_game_play&sv=20220812&lang=en&securityCheckResponseValidateId={data_['data']['securityCheckValidateId']}&clientType=web\"\r\n\r\n                    captcha_header = {\r\n                        \"accept-encoding\": \"gzip, deflate, br\",\r\n                        \"accept-language\": \"en-US,en;q=0.9\",\r\n                        \"content-type\": \"text/plain; charset=UTF-8\",\r\n                        \"bnc-uuid\": \"xxx\",\r\n                        \"captcha-sdk-version\": \"1.0.0\",\r\n                        \"clienttype\": \"web\",\r\n                        \"device-info\": headers['Device-Info'],\r\n                        \"fvideo-id\": \"xxx\",\r\n                        \"origin\": \"https://www.binance.com\",\r\n                        \"referer\": \"https://www.binance.com/\",\r\n                        'sec-fetch-dest': 'empty',\r\n                        'sec-fetch-mode': 'cors',\r\n                        'sec-fetch-site': 'same-origin',\r\n                        \"user-agent\": headers[\"User-Agent\"],\r\n                        \"x-captcha-se\": \"true\"\r\n                    }\r\n\r\n                    cap_res = session.post(\"https://api.commonservice.io/gateway-api/v1/public/antibot/getCaptcha\",\r\n                                           headers=captcha_header, data=captcha_data)\r\n                    if cap_res.status_code == 200:\r\n                        # print(cap_res.text)\r\n                        captcha_data_ = cap_res.json()['data']\r\n                        cap_type = captcha_data_['captchaType']\r\n                        bizId = captcha_data\r\n                        sig = captcha_data_['sig']\r\n                        salt = captcha_data_['salt']\r\n                        tag = captcha_data_['tag']\r\n                        path2 = captcha_data_['path2']\r\n                        ek = captcha_data_['ek']\r\n                        logger.info(f\"{self.session_name} | Attempt to solve captcha ({tag})...\")\r\n\r\n                        captcha_data = {\r\n                            \"sig\": sig,\r\n                            \"salt\": salt,\r\n                            \"path2\": path2,\r\n                            \"ek\": ek,\r\n                            \"captchaType\": cap_type,\r\n                            \"tag\": tag\r\n                        }\r\n\r\n                        # dat = {\r\n                        #     \"mode\": \"VANHBAKA\",\r\n                        #     \"bizId\": bizId,\r\n                        #     \"captchaData\": {\r\n                        #             \"sig\": sig,\r\n                        #             \"salt\": salt,\r\n                        #             \"path2\": path2,\r\n                        #             \"ek\": ek,\r\n                        #             \"captchaType\": cap_type,\r\n                        #             \"tag\": tag\r\n                        #     }\r\n                        # }\r\n                        # head = {\r\n                        #     \"user_id\": self.user_id\r\n                        # }\r\n                        #\r\n                        # solve = session.post(\"http://127.0.0.1:5000/captcha/solve\", json=dat, headers=head)\r\n                        # solve1 = solve.json()\r\n                        # print(solve1)\r\n\r\n                        # print(payload)\r\n                        from bot.core.solver.captcha_solver import solve_captcha\r\n\r\n                        solve = await solve_captcha(bizId, captcha_data)\r\n                        # print(solve)\r\n                        await asyncio.sleep(random.uniform(2,4))\r\n                        if solve['ok']:\r\n                            sol = solve['solution']\r\n                            # print(sol)\r\n                            vaild_captcha = f\"{bizId}&data={sol['payload']}&s={sol['s']}&sig={sig}\"\r\n                            # print(vaild_captcha)\r\n\r\n                            solver = session.post(\r\n                                \"https://api.commonservice.io/gateway-api/v1/public/antibot/validateCaptcha\",\r\n                                data=vaild_captcha, headers=captcha_header)\r\n                            if solver.status_code == 200:\r\n                                # print(solver.json())\r\n\r\n                                captcha_token = solver.json()['data']['token']\r\n                                if captcha_token == \"\":\r\n                                    logger.warning(\r\n                                        f\"{self.session_name} | <yellow>Failed to solve captcha. Try again next round...</yellow>\")\r\n                                    sleep_ = uniform(10, 15)\r\n                                    logger.info(f\"{self.session_name} | Sleep {sleep_}s...\")\r\n                                    await asyncio.sleep(sleep_)\r\n                                    continue\r\n                                logger.success(f\"{self.session_name} | <green>Solved captcha successfully | Solve time: <cyan>{solve['solveTime']}s</cyan></green>\")\r\n                                headers['Fvideo-Token'] = self.generate_Fvideo_token(196)\r\n                                start_game_header = headers.copy()\r\n                                start_game_header['X-Captcha-Challenge'] = sig\r\n                                start_game_header['X-Captcha-Session-Id'] = sessionId\r\n                                start_game_header['X-Captcha-Token'] = captcha_token\r\n                                payload = {\r\n                                    \"resourceId\": 2056\r\n                                }\r\n                                # print(start_game_header)\r\n                                res_d = session.post(\r\n                                    \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/game/start\",\r\n                                    headers=start_game_header, json=payload)\r\n                                data_ = res_d.json()\r\n                            # print(data_)\r\n                attempt_left = self.auto_update_ticket(session)\r\n                if data_['success']:\r\n                    logger.success(\r\n                        f\"{self.session_name} | <green>Game <cyan>{data_['data']['gameTag']}</cyan> started successful</green>\")\r\n                    self.game_response = data_\r\n                    # print(data_)\r\n                    sleep_ = uniform(45, 45.05)\r\n                    self.curr_time = int((time() * 1000))\r\n                    check = self.get_game_data()\r\n                    if check:\r\n                        logger.info(\r\n                            f\"{self.session_name} | Wait <white>{sleep_}s</white> to complete the game...\")\r\n                        await asyncio.sleep(sleep_)\r\n\r\n                        self.complete_game(session)\r\n            else:\r\n                print(response.text)\r\n                logger.warning(f\"Start game failed: {response.status_code}\")\r\n\r\n            sleep_ = uniform(20, 25)\r\n\r\n            logger.info(f\"{self.session_name} | Sleep {sleep_}s...\")\r\n\r\n            await asyncio.sleep(sleep_)\r\n\r\n    async def run(self, proxy: str | None) -> None:\r\n        access_token_created_time = 0\r\n        proxy_conn = ProxyConnector().from_url(proxy) if proxy else None\r\n\r\n        headers[\"User-Agent\"] = generate_random_user_agent(device_type='android', browser_type='chrome')\r\n        http_client = CloudflareScraper(headers=headers, connector=proxy_conn)\r\n        session = cloudscraper.create_scraper()\r\n\r\n        if proxy:\r\n            proxy_check = await self.check_proxy(http_client=http_client, proxy=proxy)\r\n            if proxy_check:\r\n                proxy_type = proxy.split(':')[0]\r\n                proxies = {\r\n                    proxy_type: proxy\r\n                }\r\n                session.proxies.update(proxies)\r\n                logger.info(f\"{self.session_name} | bind with proxy ip: {proxy}\")\r\n\r\n        token_live_time = randint(28700, 28800)\r\n        while True:\r\n            try:\r\n                if time() - access_token_created_time >= token_live_time:\r\n                    tg_web_data = self.query\r\n                    self.auth_token = tg_web_data\r\n                    data = self.generate_random_data(headers['User-Agent'])\r\n                    json_data = json.dumps(data)\r\n                    encoded_data = base64.b64encode(json_data.encode()).decode()\r\n                    headers['Device-Info'] = encoded_data\r\n                    # print(encoded_data)\r\n                    fvideo_token = self.generate_Fvideo_token(196)\r\n                    headers['X-Tg-User-Id'] = self.user_id\r\n                    # print(self.user)\r\n                    headers['Fvideo-Id'] = secrets.token_hex(20)\r\n                    headers['Fvideo-Token'] = fvideo_token\r\n                    headers['Bnc-Uuid'] = str(uuid.uuid4())\r\n                    headers['Cookie'] = f\"theme=dark; bnc-uuid={headers['Bnc-Uuid']};\"\r\n                    # print(fvideo_token)\r\n                    self.setup_session(session)\r\n                    access_token_created_time = time()\r\n                    token_live_time = randint(3500, 3600)\r\n\r\n                if self.access_token:\r\n                    headers['X-Growth-Token'] = self.access_token\r\n                    await self.get_user_info(session)\r\n                    if settings.AUTO_TASK:\r\n                        task_list = self.get_task_list(session)\r\n                        for task in task_list:\r\n                            check = self.complete_task(session, task)\r\n                            if check == \"done\":\r\n                                logger.success(\r\n                                    f\"{self.session_name} | <green>Successfully completed task <cyan>{task['type']}</cyan> | Reward: <yellow>{task['rewardList'][0]['amount']}</yellow></green>\")\r\n                            else:\r\n                                logger.warning(\r\n                                    f\"{self.session_name} | <light-yellow> Failed to complete task: {task['type']}, msg: {check}</light-yellow>\")\r\n                            await asyncio.sleep(uniform(3, 5))\r\n\r\n                if settings.AUTO_PLAY_GAME:\r\n                    await self.play_game(session)\r\n\r\n                logger.info(f\"<light-blue>==Completed {self.session_name}==</light-blue>\")\r\n                session.close()\r\n                await http_client.close()\r\n                # session.close()\r\n                break\r\n\r\n            except InvalidSession as error:\r\n                raise error\r\n\r\n            except Exception as error:\r\n                traceback.print_exc()\r\n                logger.error(f\"{self.session_name} | Unknown error: {error}\")\r\n                await asyncio.sleep(delay=randint(60, 120))\r\n\r\n\r\nasync def run_tapper_no_thread_query(queryids, proxies):\r\n    proxies_cycle = cycle(proxies) if proxies else None\r\n    acc = \"Account\"\r\n    while True:\r\n        i = 0\r\n        for query in queryids:\r\n\r\n            try:\r\n                await Tapper(query=query, accname=f\"{acc}-{i}\").run(next(proxies_cycle) if proxies_cycle else None)\r\n                i += 1\r\n            except InvalidSession:\r\n                logger.error(f\"{query} | Invalid Session\")\r\n\r\n            sleep_ = randint(settings.DELAY_EACH_ACCOUNT[0], settings.DELAY_EACH_ACCOUNT[1])\r\n            logger.info(f\"Sleep {sleep_}s...\")\r\n            await asyncio.sleep(sleep_)\r\n\r\n        sleep_ = randint(1500, 2500)\r\n        logger.info(f\"<red>Sleep {sleep_}s...</red>\")\r\n        await asyncio.sleep(sleep_)\r\n"
  },
  {
    "path": "bot/core/registrator.py",
    "content": "from pyrogram import Client\n\nfrom bot.config import settings\nfrom bot.utils import logger\n\n\nasync def register_sessions() -> None:\n    API_ID = settings.API_ID\n    API_HASH = settings.API_HASH\n\n    if not API_ID or not API_HASH:\n        raise ValueError(\"API_ID and API_HASH not found in the .env file.\")\n\n    session_name = input('\\nEnter the session name (press Enter to exit): ')\n\n    if not session_name:\n        return None\n\n    session = Client(\n        name=session_name,\n        api_id=API_ID,\n        api_hash=API_HASH,\n        workdir=\"sessions/\"\n    )\n\n    async with session:\n        user_data = await session.get_me()\n\n    logger.success(f'Session added successfully @{user_data.username} | {user_data.first_name} {user_data.last_name}')\n"
  },
  {
    "path": "bot/core/solver/classify/image.py",
    "content": "from PIL import Image\r\nimport requests\r\nfrom io import BytesIO\r\n\r\nasync def process_image(url):\r\n    square_size = 110\r\n\r\n    try:\r\n        response = requests.get(url)\r\n        image = Image.open(BytesIO(response.content))\r\n\r\n        cropped_images = []\r\n\r\n        for row in range(3):\r\n            for col in range(3):\r\n                x_min = col * square_size\r\n                y_min = row * square_size\r\n                x_max = x_min + square_size\r\n                y_max = y_min + square_size\r\n\r\n                # Crop the image\r\n                cropped_image = image.crop((x_min, y_min, x_max, y_max))\r\n                cropped_images.append(cropped_image)\r\n\r\n        return cropped_images\r\n\r\n    except Exception as err:\r\n        return str(err)\r\n"
  },
  {
    "path": "bot/core/tapper.py",
    "content": "import asyncio\nimport json\nimport random\nimport traceback\nfrom itertools import cycle\nfrom time import time\nfrom urllib.parse import unquote, quote\nfrom Crypto.Cipher import AES\nfrom Crypto.Util.Padding import pad\nfrom Crypto.Random import get_random_bytes\nimport base64\n\nimport aiohttp\nfrom aiocfscrape import CloudflareScraper\nfrom aiohttp_proxy import ProxyConnector\nfrom better_proxy import Proxy\nfrom pyrogram import Client\nfrom pyrogram.errors import Unauthorized, UserDeactivated, AuthKeyUnregistered, FloodWait\nfrom pyrogram.raw.types import InputBotAppShortName\nfrom pyrogram.raw.functions.messages import RequestAppWebView\nfrom soupsieve.util import lower\n\nfrom bot.core.agents import generate_random_user_agent\nfrom bot.config import settings\nimport cloudscraper\nfrom math import sqrt\n\nfrom bot.utils import logger\nfrom bot.exceptions import InvalidSession\nfrom .headers import headers\nfrom random import randint, choices, choice, uniform\nimport secrets\nimport uuid\nfrom faker import Faker\nimport string\n\n\nfake = Faker()\nmin_length = 256\nmax_length = 1024\n\n\ndef base64_encode(data):\n    return base64.b64encode(data).decode('utf-8')\n\n\nclass Tapper:\n    def __init__(self, tg_client: Client):\n        self.tg_client = tg_client\n        self.session_name = tg_client.name\n        self.first_name = ''\n        self.last_name = ''\n        self.user_id = ''\n        self.user = ''\n        self.auth_token = \"\"\n        self.last_claim = None\n        self.last_checkin = None\n        self.balace = 0\n        self.access_token = None\n        self.game_response = None\n        self.game = None\n        self.rs = 1000\n        self.curr_time = None\n\n    async def get_tg_web_data(self, proxy: str | None) -> str:\n        ref_param = settings.REF_LINK.split(\"=\")[1].split('&')[0]\n        if proxy:\n            proxy = Proxy.from_str(proxy)\n            proxy_dict = dict(\n                scheme=proxy.protocol,\n                hostname=proxy.host,\n                port=proxy.port,\n                username=proxy.login,\n                password=proxy.password\n            )\n        else:\n            proxy_dict = None\n\n        self.tg_client.proxy = proxy_dict\n\n        try:\n            if not self.tg_client.is_connected:\n                try:\n                    await self.tg_client.connect()\n                except (Unauthorized, UserDeactivated, AuthKeyUnregistered):\n                    raise InvalidSession(self.session_name)\n\n            while True:\n                try:\n                    peer = await self.tg_client.resolve_peer('Binance_Moonbix_bot')\n                    break\n                except FloodWait as fl:\n                    fls = fl.value\n\n                    logger.warning(f\"<light-yellow>{self.session_name}</light-yellow> | FloodWait {fl}\")\n                    logger.info(f\"<light-yellow>{self.session_name}</light-yellow> | Sleep {fls}s\")\n\n                    await asyncio.sleep(fls + 3)\n\n            web_view = await self.tg_client.invoke(RequestAppWebView(\n                peer=peer,\n                app=InputBotAppShortName(bot_id=peer, short_name=\"start\"),\n                platform='android',\n                write_allowed=True,\n                start_param=ref_param\n            ))\n\n            auth_url = web_view.url\n            # print(auth_url)\n            tg_web_data1 = unquote(string=auth_url.split('tgWebAppData=')[1].split('&tgWebAppVersion')[0])\n            tg_web_data = unquote(\n                string=unquote(string=auth_url.split('tgWebAppData=')[1].split('&tgWebAppVersion')[0]))\n\n            self.user_id = tg_web_data.split('\"id\":')[1].split(',\"first_name\"')[0]\n            self.first_name = tg_web_data.split('\"first_name\":\"')[1].split('\",\"last_name\"')[0]\n            self.last_name = tg_web_data.split('\"last_name\":\"')[1].split('\",\"username\"')[0]\n\n            if self.tg_client.is_connected:\n                await self.tg_client.disconnect()\n\n            return tg_web_data1\n\n        except InvalidSession as error:\n            raise error\n\n        except Exception as error:\n            traceback.print_exc()\n            logger.error(f\"<light-yellow>{self.session_name}</light-yellow> | Unknown error during Authorization: \"\n                         f\"{error}\")\n            await asyncio.sleep(delay=3)\n\n    def random_fingerprint(self, lengths=32):\n        return ''.join(choices('0123456789abcdef', k=lengths))\n\n    def generate_Fvideo_token(self, length):\n\n        characters = string.ascii_letters + string.digits + \"+/\"\n        digits = string.digits\n        characters1 = string.ascii_letters + digits\n\n        random_string = ''.join(choice(characters) for _ in range(length - 3))\n\n        random_string += '='\n        random_string += choice(digits)\n        random_string += choice(characters1)\n\n        return random_string\n\n    fake = Faker()\n\n    def get_random_resolution(self):\n        width = randint(720, 1920)\n        height = randint(720, 1080)\n        return f\"{width},{height}\"\n\n    def get_random_timezone(self):\n        timezones = [\n            \"GMT+07:00\", \"GMT+05:30\", \"GMT-08:00\", \"GMT+00:00\", \"GMT+03:00\"\n        ]\n        return choice(timezones)\n\n    def get_random_timezone_offset(self, timezone):\n        # Extract the offset from the timezone format \"GMT+07:00\"\n        sign = 1 if \"+\" in timezone else -1\n        hours = int(timezone.split(\"GMT\")[1].split(\":\")[0])\n        return sign * hours * 60\n\n    def get_random_plugins(self):\n        plugins = [\n            \"PDF Viewer,Chrome PDF Viewer,Chromium PDF Viewer,Microsoft Edge PDF Viewer,WebKit built-in PDF\",\n            \"Flash,Java,Silverlight,QuickTime\",\n            \"Chrome PDF Viewer,Widevine Content Decryption Module\",\n        ]\n        return choice(plugins)\n\n    def get_random_canvas_code(self):\n        return ''.join(choices(lower(string.hexdigits), k=8))\n\n    def get_random_fingerprint(self):\n        return ''.join(choices(lower(string.hexdigits), k=32))\n\n    def generate_random_data(self, user_agent):\n        timezone = self.get_random_timezone()\n        sol = self.get_random_resolution()\n        data = {\n            \"screen_resolution\": sol,\n            \"available_screen_resolution\": sol,\n            \"system_version\": fake.random_element([\"Windows 10\", \"Windows 11\", \"Ubuntu 20.04\"]),\n            \"brand_model\": fake.random_element([\"unknown\", \"Dell XPS 13\", \"HP Spectre\"]),\n            \"system_lang\": \"en-EN\",\n            \"timezone\": timezone,\n            \"timezoneOffset\": self.get_random_timezone_offset(timezone),\n            \"user_agent\": user_agent,\n            \"list_plugin\": self.get_random_plugins(),\n            \"canvas_code\": self.get_random_canvas_code(),\n            \"webgl_vendor\": fake.company(),\n            \"webgl_renderer\": f\"ANGLE ({fake.company()}, {fake.company()} Graphics)\",\n            \"audio\": str(uniform(100, 130)),\n            \"platform\": fake.random_element([\"Win32\", \"Win64\"]),\n            \"web_timezone\": fake.timezone(),\n            \"device_name\": f\"{fake.user_agent()} ({fake.random_element(['Windows'])})\",\n            \"fingerprint\": self.get_random_fingerprint(),\n            \"device_id\": \"\",\n            \"related_device_ids\": \"\"\n        }\n        return data\n\n    async def check_proxy(self, http_client: aiohttp.ClientSession, proxy: Proxy):\n        try:\n            response = await http_client.get(url='https://httpbin.org/ip', timeout=aiohttp.ClientTimeout(5), ssl=False)\n            ip = (await response.json()).get('origin')\n            logger.info(f\"{self.session_name} | Proxy IP: {ip}\")\n            return True\n        except Exception as error:\n            logger.error(f\"{self.session_name} | Proxy: {proxy} | Error: {error}\")\n            return False\n\n    def setup_session(self, session: cloudscraper.CloudScraper):\n        payload = {\n            \"queryString\": self.auth_token,\n            \"socialType\": \"telegram\"\n        }\n        response = session.post(\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/third-party/access/accessToken\",\n            headers=headers, json=payload)\n        data_ = response.json()\n        if data_['code'] == '000000':\n            logger.success(f\"{self.session_name} | <green>Get access token sucessfully</green>\")\n            self.access_token = data_['data']['accessToken']\n        else:\n            logger.warning(f\"{self.session_name} | <red>Get access token failed: {data_}</red>\")\n\n    def random_data_type(self, type, end_time, item_size, item_pts, pos_y: float):\n        # I WOKED HARD TO FIND OUT THIS.SO IF U COPY PLEASE CREDIT ME !\n\n        # end_time = int(end_time)\n        if type == 1:\n            pick_time = self.curr_time + self.rs\n            if pick_time >= end_time:\n                pick_time = end_time - 1000\n                return None\n\n            hook_pos_x = \"{:.3f}\".format(round(uniform(75, 230), 3))\n            hook_pos_y = \"{:.3f}\".format(round(uniform(199, 230), 3))\n            hook_hit_x = \"{:.3f}\".format(round(uniform(100, 400), 3))\n            hook_hit_y = \"{:.3f}\".format(pos_y)\n\n            multi = (float(hook_hit_x) - float(hook_pos_x)) * (float(hook_hit_x) - float(hook_pos_x))\n            mult2i = (float(hook_hit_y) - float(hook_pos_y)) * (float(hook_hit_y) - float(hook_pos_y))\n            cal_angle = (float(hook_pos_x) - float(hook_hit_x)) / (sqrt(multi + mult2i))\n            hook_shot_angle = \"{:.3f}\".format(cal_angle)\n\n            item_type = 1\n            item_s = item_size\n            point = randint(1, 200)\n\n        elif type == 2:\n            pick_time = self.curr_time + self.rs\n            if pick_time >= end_time:\n                pick_time = end_time - 1000\n                return None\n\n            hook_pos_x = \"{:.3f}\".format(round(uniform(75, 230), 3))\n            hook_pos_y = \"{:.3f}\".format(round(uniform(199, 230), 3))\n            #  hook_shot_angle = \"{:.3f}\".format(round(uniform(-1, 1), 3))\n            hook_hit_x = \"{:.3f}\".format(round(uniform(100, 400), 3))\n            hook_hit_y = \"{:.3f}\".format(pos_y)\n            multi = (float(hook_hit_x) - float(hook_pos_x)) * (float(hook_hit_x) - float(hook_pos_x))\n            mult2i = (float(hook_hit_y) - float(hook_pos_y)) * (float(hook_hit_y) - float(hook_pos_y))\n            cal_angle = (float(hook_pos_x) - float(hook_hit_x)) / (sqrt(multi + mult2i))\n            hook_shot_angle = \"{:.3f}\".format(cal_angle)\n            item_type = 2\n            item_s = item_size\n            point = int(item_size) + int(item_pts)\n\n        elif type == 0:\n            pick_time = self.curr_time + self.rs\n            if pick_time >= end_time:\n                pick_time = end_time - 1000\n                return None\n\n            hook_pos_x = \"{:.3f}\".format(round(uniform(75, 230), 3))\n            hook_pos_y = \"{:.3f}\".format(round(uniform(199, 230), 3))\n            # hook_shot_angle = \"{:.3f}\".format(round(uniform(-1, 1), 3))\n            hook_hit_x = \"{:.3f}\".format(round(uniform(100, 400), 3))\n            hook_hit_y = \"{:.3f}\".format(pos_y)\n            multi = (float(hook_hit_x) - float(hook_pos_x)) * (float(hook_hit_x) - float(hook_pos_x))\n            mult2i = (float(hook_hit_y) - float(hook_pos_y)) * (float(hook_hit_y) - float(hook_pos_y))\n\n            cal_angle = (float(hook_pos_x) - float(hook_hit_x)) / (sqrt(multi + mult2i))\n\n            hook_shot_angle = \"{:.3f}\".format(cal_angle)\n\n            item_type = 0\n            item_s = item_size\n            point = randint(1, 200)\n        else:\n            pick_time = self.curr_time + self.rs\n            if pick_time >= end_time:\n                pick_time = end_time - 1000\n                return None\n\n            hook_pos_x = \"{:.3f}\".format(round(uniform(75, 230), 3))\n            hook_pos_y = \"{:.3f}\".format(round(uniform(199, 230), 3))\n            hook_shot_angle = \"{:.3f}\".format(round(uniform(-1, 1), 3))\n            hook_hit_x = 0\n            hook_hit_y = 0\n            item_type = randint(0, 2)\n            item_s = randint(1, 100)\n            point = randint(1, 200)\n\n        # 1727080937255|272.705|208.070|-0.944|0|0|2|38|12;1727080938339|224.985|241.018|-0.432|249.685|294.600|1|70|182;1727080941172|124.175|241.530|0.420|0|0|2|57|186;1727080943373|77.580|210.808|0.910|0|0|2|7|140;1727080944891|181.929|250.277|-0.066|189.091|359.041|2|60|90;1727080948123|269.666|211.426|-0.902|0|0|2|92|11;1727080949024|279.568|199.250|-1.047|0|0|2|60|34;1727080950908|162.174|250.020|0.096|144.951|428.190|0|30|191;1727080953975|78.758|212.055|0.895|0|0|0|1|151;1727080955243|133.916|244.791|0.334|103.100|333.596|1|30|15;1727080957193|278.835|200.291|-1.035|0|0|1|5|150;1727080959444|209.788|245.932|-0.298|303.593|550.828|1|70|72;1727080965178|87.635|220.354|0.786|0|0|1|85|73;1727080967129|168.297|250.390|0.046|156.376|509.116|1|50|110;1727080971647|188.297|249.779|-0.118|209.403|427.530|1|30|30;1727080974548|145.269|252.269|0.237|105.591|416.545|1|30|92;1727080978299|172.753|252.036|0.010|168.866|661.017|1|50|13\n        data = f\"{pick_time}|{hook_pos_x}|{hook_pos_y}|{hook_shot_angle}|{hook_hit_x}|{hook_hit_y}|{item_type}|{item_s}|{point}\"\n        return data\n\n    def encrypt(self, text, key):\n        iv = get_random_bytes(12)\n        iv_base64 = base64_encode(iv)\n        # print(iv_base64[:16].encode('utf-8'))\n        cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv_base64[:16].encode('utf-8'))\n        ciphertext = cipher.encrypt(pad(text.encode('utf-8'), AES.block_size))\n        ciphertext_base64 = base64_encode(ciphertext)\n        return iv_base64 + ciphertext_base64\n\n    def get_game_data(self):\n        # I WOKED HARD TO FIND OUT THIS.SO IF U COPY PLEASE CREDIT ME !\n        try:\n            end_time = int((time() + 45) * 1000)\n            # print(end_time)\n            random_pick_time = randint(8, 15)\n            total_obj = 0\n            key_for_game = self.game_response['data']['gameTag']\n            obj_type = {\n                \"coin\": {},\n                \"trap\": {},\n                \"bonus\": \"\"\n            }\n            for obj in self.game_response['data']['cryptoMinerConfig']['itemSettingList']:\n                total_obj += obj['quantity']\n                if obj['type'] == \"BONUS\":\n                    obj_type['bonus'] = f\"{obj['rewardValueList'][0]},{obj['size']}\"\n                else:\n                    for reward in obj['rewardValueList']:\n                        if int(reward) > 0:\n                            obj_type['coin'].update({reward: f\"{obj['size']},{obj['quantity']}\"})\n                        else:\n                            obj_type['trap'].update({abs(int(reward)): f\"{obj['size']},{obj['quantity']}\"})\n\n            limit = min(total_obj, random_pick_time)\n            random_pick_sth_times = randint(1, limit)\n            picked_bonus = False\n            picked = 0\n            logger.info(f\"{self.session_name} | Playing game!\")\n            game_data_payload = []\n            score = 0\n            # print(obj_type)\n\n            pos_y = []\n            for i in range(random_pick_sth_times + 5):\n                pos_y.append(uniform(250, 550))\n\n            sorted_pos_y = sorted(pos_y)\n            for i in range(1, len(sorted_pos_y)):\n                if sorted_pos_y[i] - sorted_pos_y[i - 1] < 40:\n                    sorted_pos_y[i] += randint(40, 55)\n\n            Total_tap = 0\n\n            while end_time > self.curr_time and picked < random_pick_sth_times:\n                self.rs = randint(2500, 4000)\n                random_reward = randint(1, 100)\n                if random_reward <= 20:\n                    if len(list(obj_type['trap'].keys())) > 0:\n                        picked += 1\n                        reward_d = choice(list(obj_type['trap'].keys()))\n                        quantity = obj_type['trap'][reward_d].split(',')[1]\n                        item_size = obj_type['trap'][reward_d].split(',')[0]\n                        if int(quantity) > 0:\n                            data_ = self.random_data_type(end_time=end_time,\n                                                          type=0,\n                                                          item_size=int(item_size),\n                                                          item_pts=0,\n                                                          pos_y=sorted_pos_y[Total_tap])\n                            if data_ is not None:\n                                Total_tap += 1\n                                score = max(0, score - int(reward_d))\n                                game_data_payload.append(data_)\n                                if int(quantity) - 1 > 0:\n                                    obj_type['trap'].update({reward_d: f\"{item_size},{int(quantity) - 1}\"})\n\n                                else:\n                                    obj_type[\"trap\"].pop(reward_d)\n                            else:\n                                break\n                elif random_reward > 20 and random_reward <= 70:\n                    if len(list(obj_type['coin'].keys())) > 0:\n                        picked += 1\n                        reward_d = choice(list(obj_type['coin'].keys()))\n                        quantity = obj_type['coin'][reward_d].split(',')[1]\n                        item_size = obj_type['coin'][reward_d].split(',')[0]\n                        if int(quantity) > 0:\n\n                            data_ = self.random_data_type(end_time=end_time,\n                                                          type=1,\n                                                          item_size=item_size,\n                                                          item_pts=0,\n                                                          pos_y=sorted_pos_y[Total_tap])\n                            if data_ is not None:\n                                Total_tap += 1\n                                score += int(reward_d)\n                                game_data_payload.append(data_)\n                                if int(quantity) - 1 > 0:\n                                    obj_type['coin'].update({reward_d: f\"{item_size},{int(quantity) - 1}\"})\n                                else:\n                                    obj_type[\"coin\"].pop(reward_d)\n                            else:\n                                break\n                elif random_reward > 70 and random_reward <= 100 and picked_bonus is False:\n                    picked += 1\n                    size = obj_type['bonus'].split(',')[1]\n                    pts = obj_type['bonus'].split(',')[0]\n                    data_ = self.random_data_type(end_time=end_time,\n                                                  type=2,\n                                                  item_size=size,\n                                                  item_pts=pts,\n                                                  pos_y=sorted_pos_y[Total_tap])\n                    if data_ is not None:\n                        Total_tap += 1\n                        picked_bonus = True\n                        score += int(pts)\n                        game_data_payload.append(data_)\n\n                self.curr_time += self.rs\n\n            if len(game_data_payload) > 0:\n\n                data_pl = ';'.join(game_data_payload)\n                # print(data_pl)\n                game_payload = self.encrypt(data_pl, key_for_game)\n                self.game = {\n                    \"payload\": game_payload,\n                    \"log\": score,\n                    \"debug\": data_pl\n                }\n                # print(self.game)\n                return True\n            else:\n                logger.warning(f\"{self.session_name} | <yellow>Failed to play game, reason: Time out</yellow>\")\n                return False\n        except Exception as error:\n            traceback.print_exc()\n            logger.error(f\"{self.session_name} | <red>Unknown error while trying to get game data: {str(error)}</red>\")\n            return False\n\n    def setup_account(self, session: cloudscraper.CloudScraper):\n        ref_id = settings.REF_LINK.split(\"=\")[1].split('&')[0].split('_')[1]\n        payload = {\n            \"agentId\": str(ref_id),\n            \"resourceId\": 2056\n        }\n        res = session.post(\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/referral\",\n            headers=headers,\n            json=payload)\n        json_d = res.json()\n        if json_d['success']:\n            res = session.post(\n                \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/game/participated\",\n                headers=headers, json=payload)\n            json_d = res.json()\n            if json_d['success']:\n                logger.success(f\"{self.session_name} | <green>Successfully set up account !</green>\")\n                login_task = {\n                    \"resourceId\": 2057\n                }\n                complete = self.complete_task(session, login_task)\n                if complete == \"done\":\n                    logger.success(f\"{self.session_name} | <green>Successfully checkin for the first time !</green>\")\n\n        else:\n            logger.warning(\n                f\"{self.session_name} | <yellow>Unknown error while tryng to init account: {json_d}</yellow>\")\n\n    async def get_user_info(self, session: cloudscraper.CloudScraper):\n        payload = {\n            \"resourceId\": 2056\n        }\n        response = session.post(\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/user/user-info\",\n            headers=headers, json=payload)\n        data_ = response.json()\n        # print(data_)\n        if data_['code'] == '000000':\n            # print(data_)\n            data__ = data_['data']\n            if data__['participated'] is False:\n                logger.info(f\"{self.session_name} | Attempt to set up account...\")\n                self.setup_account(session)\n                await asyncio.sleep(uniform(3, 5))\n                await self.get_user_info(session)\n            else:\n                logger.info(f\"{self.session_name} | <cyan>Logged in</cyan>\")\n                logger.info(\n                    f\"{self.session_name} | Total point: <yellow>{data__['metaInfo']['totalGrade']}</yellow> | <white>Risk Passed: <red>{data__['riskPassed']}</red> | Qualified: <red>{data__['qualified']}</red></white>\")\n\n        else:\n            logger.warning(f\"{self.session_name} | <red>Get user data failed: {data_}</red>\")\n\n    def get_user_info1(self, session: cloudscraper.CloudScraper):\n        payload = {\n            \"resourceId\": 2056\n        }\n        response = session.post(\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/user/user-info\",\n            headers=headers, json=payload)\n        data_ = response.json()\n        if data_['code'] == '000000':\n            # print(data_)\n            data__ = data_['data']\n            return data__\n        else:\n            logger.warning(f\"{self.session_name} | <red>Get ticket data failed: {data_}</red>\")\n\n    def get_task_list(self, session: cloudscraper.CloudScraper):\n        payload = {\n            \"resourceId\": 2056\n        }\n        response = session.post(\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/task/list\",\n            headers=headers, json=payload)\n        data_ = response.json()\n        # print(data_)\n        if data_['code'] == '000000':\n            task_list = data_['data']['data'][0]['taskList']['data']  # bruh what are they doing ????\n            tasks = []\n            for task in task_list:\n                # print(task)\n                if task['type'] == \"THIRD_PARTY_BIND\":\n                    continue\n                elif task['status'] == \"COMPLETED\":\n                    continue\n                elif task['status'] == \"IN_PROGRESS\":\n                    tasks.append(task)\n            return tasks\n        else:\n            logger.warning(f\"{self.session_name} | <red>Get tasks list failed: {data_}</red>\")\n            return None\n\n    def complete_task(self, session: cloudscraper.CloudScraper, task: dict):\n        task_ids = [task['resourceId']]\n        payload = {\n            \"referralCode\": \"null\",\n            \"resourceIdList\": task_ids\n        }\n        response = session.post(\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/task/complete\",\n            headers=headers, json=payload)\n        data_ = response.json()\n        # print(data_)\n        if data_['success']:\n            return \"done\"\n        else:\n            return data_['messageDetail']\n\n    def complete_game(self, session: cloudscraper.CloudScraper):\n        string_payload = self.game['payload']\n        payload = {\n            \"log\": self.game['log'],\n            \"payload\": string_payload,\n            \"resourceId\": 2056\n        }\n        # print(payload)\n        response = session.post(\n            \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/game/complete\",\n            headers=headers, json=payload)\n        data_ = response.json()\n\n        if data_['success']:\n            logger.success(\n                f\"{self.session_name} | <green>Sucessfully earned: <yellow>{self.game['log']}</yellow> from game !</green>\")\n        else:\n            logger.warning(\n                f\"{self.session_name} | <yellow>Failed to complete game | {self.game['log']}: {data_}</yellow>\")\n\n    def auto_update_ticket(self, session: cloudscraper.CloudScraper):\n        ticket_data = self.get_user_info1(session)\n        return ticket_data['metaInfo']['totalAttempts'] - ticket_data['metaInfo']['consumedAttempts']\n\n    async def play_game(self, session: cloudscraper.CloudScraper):\n        ticket_data = self.get_user_info1(session)\n        if ticket_data['metaInfo']['totalAttempts'] == ticket_data['metaInfo']['consumedAttempts']:\n            logger.warning(f\"{self.session_name} | No Attempt left to play game...\")\n            return\n        attempt_left = ticket_data['metaInfo']['totalAttempts'] - ticket_data['metaInfo']['consumedAttempts']\n        logger.info(f\"{self.session_name} | Starting to play game...\")\n        while attempt_left > 0:\n            # await asyncio.sleep(1000)\n            logger.info(f\"{self.session_name} | Attempts left: <cyan>{attempt_left}</cyan>\")\n            payload = {\n                \"resourceId\": 2056\n            }\n            headers['Fvideo-Token'] = self.generate_Fvideo_token(196)\n            # print(headers)\n            response = session.post(\n                \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/game/start\",\n                headers=headers, json=payload)\n            if response.status_code == 200:\n                data_ = response.json()\n                # print(data_)\n                if 'sessionId' in data_['data']:\n                    # print(\"ok\")\n                    sessionId = data_['data']['sessionId']\n\n                    captcha_data = f\"bizId=tg_mini_game_play&sv=20220812&lang=en&securityCheckResponseValidateId={data_['data']['securityCheckValidateId']}&clientType=web\"\n\n                    captcha_header = {\n                        \"accept-encoding\": \"gzip, deflate, br\",\n                        \"accept-language\": \"en-US,en;q=0.9\",\n                        \"content-type\": \"text/plain; charset=UTF-8\",\n                        \"bnc-uuid\": \"xxx\",\n                        \"captcha-sdk-version\": \"1.0.0\",\n                        \"clienttype\": \"web\",\n                        \"device-info\": headers['Device-Info'],\n                        \"fvideo-id\": \"xxx\",\n                        \"origin\": \"https://www.binance.com\",\n                        \"referer\": \"https://www.binance.com/\",\n                        'sec-fetch-dest': 'empty',\n                        'sec-fetch-mode': 'cors',\n                        'sec-fetch-site': 'same-origin',\n                        \"user-agent\": headers[\"User-Agent\"],\n                        \"x-captcha-se\": \"true\"\n                    }\n\n                    cap_res = session.post(\"https://api.commonservice.io/gateway-api/v1/public/antibot/getCaptcha\",\n                                           headers=captcha_header, data=captcha_data)\n                    if cap_res.status_code == 200:\n                        # print(cap_res.text)\n                        captcha_data_ = cap_res.json()['data']\n                        cap_type = captcha_data_['captchaType']\n                        bizId = captcha_data\n                        sig = captcha_data_['sig']\n                        salt = captcha_data_['salt']\n                        tag = captcha_data_['tag']\n                        path2 = captcha_data_['path2']\n                        ek = captcha_data_['ek']\n                        logger.info(f\"{self.session_name} | Attempt to solve captcha ({tag})...\")\n\n                        captcha_data = {\n                            \"sig\": sig,\n                            \"salt\": salt,\n                            \"path2\": path2,\n                            \"ek\": ek,\n                            \"captchaType\": cap_type,\n                            \"tag\": tag\n                        }\n\n                        # dat = {\n                        #     \"mode\": \"VANHBAKA\",\n                        #     \"bizId\": bizId,\n                        #     \"captchaData\": {\n                        #             \"sig\": sig,\n                        #             \"salt\": salt,\n                        #             \"path2\": path2,\n                        #             \"ek\": ek,\n                        #             \"captchaType\": cap_type,\n                        #             \"tag\": tag\n                        #     }\n                        # }\n                        # head = {\n                        #     \"user_id\": self.user_id\n                        # }\n                        #\n                        # solve = session.post(\"http://127.0.0.1:5000/captcha/solve\", json=dat, headers=head)\n                        # solve1 = solve.json()\n                        # print(solve1)\n\n                        # print(payload)\n                        from bot.core.solver.captcha_solver import solve_captcha\n\n                        solve = await solve_captcha(bizId, captcha_data)\n                        # print(solve)\n                        await asyncio.sleep(random.uniform(2,4))\n                        if solve['ok']:\n                            sol = solve['solution']\n                            # print(sol)\n                            vaild_captcha = f\"{bizId}&data={sol['payload']}&s={sol['s']}&sig={sig}\"\n                            # print(vaild_captcha)\n\n                            solver = session.post(\n                                \"https://api.commonservice.io/gateway-api/v1/public/antibot/validateCaptcha\",\n                                data=vaild_captcha, headers=captcha_header)\n                            if solver.status_code == 200:\n                                # print(solver.json())\n\n                                captcha_token = solver.json()['data']['token']\n                                if captcha_token == \"\":\n                                    logger.warning(\n                                        f\"{self.session_name} | <yellow>Failed to solve captcha. Try again next round...</yellow>\")\n                                    sleep_ = uniform(10, 15)\n                                    logger.info(f\"{self.session_name} | Sleep {sleep_}s...\")\n                                    await asyncio.sleep(sleep_)\n                                    continue\n                                logger.success(f\"{self.session_name} | <green>Solved captcha successfully | Solve time: <cyan>{solve['solveTime']}s</cyan></green>\")\n                                headers['Fvideo-Token'] = self.generate_Fvideo_token(196)\n                                start_game_header = headers.copy()\n                                start_game_header['X-Captcha-Challenge'] = sig\n                                start_game_header['X-Captcha-Session-Id'] = sessionId\n                                start_game_header['X-Captcha-Token'] = captcha_token\n                                payload = {\n                                    \"resourceId\": 2056\n                                }\n                                # print(start_game_header)\n                                res_d = session.post(\n                                    \"https://www.binance.com/bapi/growth/v1/friendly/growth-paas/mini-app-activity/third-party/game/start\",\n                                    headers=start_game_header, json=payload)\n                                data_ = res_d.json()\n                            # print(data_)\n                attempt_left = self.auto_update_ticket(session)\n                if data_['success']:\n                    logger.success(\n                        f\"{self.session_name} | <green>Game <cyan>{data_['data']['gameTag']}</cyan> started successful</green>\")\n                    self.game_response = data_\n                    # print(data_)\n                    sleep_ = uniform(45, 45.05)\n                    self.curr_time = int((time() * 1000))\n                    check = self.get_game_data()\n                    if check:\n                        logger.info(\n                            f\"{self.session_name} | Wait <white>{sleep_}s</white> to complete the game...\")\n                        await asyncio.sleep(sleep_)\n\n                        self.complete_game(session)\n            else:\n                print(response.text)\n                logger.warning(f\"Start game failed: {response.status_code}\")\n\n            sleep_ = uniform(20, 25)\n\n            logger.info(f\"{self.session_name} | Sleep {sleep_}s...\")\n\n            await asyncio.sleep(sleep_)\n\n    async def run(self, proxy: str | None) -> None:\n        access_token_created_time = 0\n        proxy_conn = ProxyConnector().from_url(proxy) if proxy else None\n\n        headers[\"User-Agent\"] = generate_random_user_agent(device_type='android', browser_type='chrome')\n        http_client = CloudflareScraper(headers=headers, connector=proxy_conn)\n        session = cloudscraper.create_scraper()\n\n        if proxy:\n            proxy_check = await self.check_proxy(http_client=http_client, proxy=proxy)\n            if proxy_check:\n                proxy_type = proxy.split(':')[0]\n                proxies = {\n                    proxy_type: proxy\n                }\n                session.proxies.update(proxies)\n                logger.info(f\"{self.session_name} | bind with proxy ip: {proxy}\")\n\n        token_live_time = randint(28700, 28800)\n        while True:\n            try:\n                if time() - access_token_created_time >= token_live_time:\n                    tg_web_data = await self.get_tg_web_data(proxy=proxy)\n                    self.auth_token = tg_web_data\n                    data = self.generate_random_data(headers['User-Agent'])\n                    json_data = json.dumps(data)\n                    encoded_data = base64.b64encode(json_data.encode()).decode()\n                    headers['Device-Info'] = encoded_data\n                    # print(encoded_data)\n                    fvideo_token = self.generate_Fvideo_token(196)\n                    headers['X-Tg-User-Id'] = self.user_id\n                    # print(self.user)\n                    headers['Fvideo-Id'] = secrets.token_hex(20)\n                    headers['Fvideo-Token'] = fvideo_token\n                    headers['Bnc-Uuid'] = str(uuid.uuid4())\n                    headers['Cookie'] = f\"theme=dark; bnc-uuid={headers['Bnc-Uuid']};\"\n                    # print(fvideo_token)\n                    self.setup_session(session)\n                    access_token_created_time = time()\n                    token_live_time = randint(3500, 3600)\n\n                if self.access_token:\n                    headers['X-Growth-Token'] = self.access_token\n                    await self.get_user_info(session)\n                    if settings.AUTO_TASK:\n                        task_list = self.get_task_list(session)\n                        for task in task_list:\n                            check = self.complete_task(session, task)\n                            if check == \"done\":\n                                logger.success(\n                                    f\"{self.session_name} | <green>Successfully completed task <cyan>{task['type']}</cyan> | Reward: <yellow>{task['rewardList'][0]['amount']}</yellow></green>\")\n                            else:\n                                logger.warning(\n                                    f\"{self.session_name} | <light-yellow> Failed to complete task: {task['type']}, msg: {check}</light-yellow>\")\n                            await asyncio.sleep(uniform(3, 5))\n\n                if settings.AUTO_PLAY_GAME:\n                    await self.play_game(session)\n\n                logger.info(f\"<light-blue>==Completed {self.session_name}==</light-blue>\")\n                session.close()\n                await http_client.close()\n                # session.close()\n                break\n\n            except InvalidSession as error:\n                raise error\n\n            except Exception as error:\n                traceback.print_exc()\n                logger.error(f\"{self.session_name} | Unknown error: {error}\")\n                await asyncio.sleep(delay=randint(60, 120))\n\n\nasync def run_tapper_no_thread(tg_clients, proxies):\n    proxies_cycle = cycle(proxies) if proxies else None\n    while True:\n        for tg_client in tg_clients:\n            try:\n                await Tapper(tg_client=tg_client).run(next(proxies_cycle) if proxies_cycle else None)\n            except InvalidSession:\n                logger.error(f\"{tg_client.name} | Invalid Session\")\n\n            sleep_ = randint(settings.DELAY_EACH_ACCOUNT[0], settings.DELAY_EACH_ACCOUNT[1])\n            logger.info(f\"Sleep {sleep_}s...\")\n            await asyncio.sleep(sleep_)\n\n        sleep_ = randint(1500, 2500)\n        logger.info(f\"<red>Sleep {sleep_}s...</red>\")\n        await asyncio.sleep(sleep_)\n"
  },
  {
    "path": "bot/exceptions/__init__.py",
    "content": "class InvalidSession(BaseException):\n    ...\n"
  },
  {
    "path": "bot/utils/__init__.py",
    "content": "from .logger import logger\nfrom . import launcher\n\n\nimport os\n\nif not os.path.exists(path=\"sessions\"):\n    os.mkdir(path=\"sessions\")\n"
  },
  {
    "path": "bot/utils/launcher.py",
    "content": "import os\nimport glob\nimport argparse\nimport sys\n\nimport requests\n\nfrom pyrogram import Client\nfrom better_proxy import Proxy\n\nfrom bot.config import settings\nfrom bot.utils import logger\nfrom bot.core.tapper import run_tapper_no_thread\nfrom bot.core.query import run_tapper_no_thread_query\nfrom bot.core.registrator import register_sessions\n\nimport importlib.util\n\ncurr_version = \"3.0.5\"\n\nversion = requests.get(\"https://raw.githubusercontent.com/vanhbakaa/moonbix-bot/refs/heads/main/version\")\nversion_ = version.text.strip()\nif curr_version == version_:\n    logger.info(\"<cyan>Your version is up to date!</cyan>\")\nelse:\n    logger.warning(f\"<yellow>New version detected {version_} please update the bot!</yellow>\")\n    sys.exit()\nstart_text = f\"\"\"\n\nVersion: {curr_version} \nBy: https://github.com/vanhbakaa                                                                                                                                                                                         \nSelect an action:\n\n    1. Run clicker (session)\n    2. Create session\n    3. Run Cheat Tapper\n    4. Run clicker (Query)\n\"\"\"\n\nglobal tg_clients\n\n\ndef import_tapper():\n    # Define the relative file path\n    file_path = os.path.join(os.getcwd(), \"bot/core/tapperCheatPoint.py\")\n\n    # Define a module name for the imported module\n    module_name = \"tapper\"\n\n    # Check if the file exists\n    if os.path.exists(file_path):\n        # Dynamically load the module\n        spec = importlib.util.spec_from_file_location(module_name, file_path)\n        tapper_module = importlib.util.module_from_spec(spec)\n        spec.loader.exec_module(tapper_module)\n        sys.modules[module_name] = tapper_module\n        print(f\"Successfully imported '{file_path}' as module '{module_name}'\")\n        return tapper_module\n    else:\n        print(f\"Join my telegram channel to use this option!\")\n        return None\n\n\ndef get_session_names() -> list[str]:\n    session_names = sorted(glob.glob(\"sessions/*.session\"))\n    session_names = [\n        os.path.splitext(os.path.basename(file))[0] for file in session_names\n    ]\n\n    return session_names\n\n\ndef get_proxies() -> list[Proxy]:\n    if settings.USE_PROXY_FROM_FILE:\n        with open(file=\"bot/config/proxies.txt\", encoding=\"utf-8-sig\") as file:\n            proxies = [Proxy.from_str(proxy=row.strip()).as_url for row in file]\n    else:\n        proxies = []\n\n    return proxies\n\n\nasync def get_tg_clients() -> list[Client]:\n    global tg_clients\n\n    session_names = get_session_names()\n\n    if not session_names:\n        raise FileNotFoundError(\"Not found session files\")\n\n    if not settings.API_ID or not settings.API_HASH:\n        raise ValueError(\"API_ID and API_HASH not found in the .env file.\")\n\n    tg_clients = [\n        Client(\n            name=session_name,\n            api_id=settings.API_ID,\n            api_hash=settings.API_HASH,\n            workdir=\"sessions/\",\n            plugins=dict(root=\"bot/plugins\"),\n        )\n        for session_name in session_names\n    ]\n\n    return tg_clients\n\n\nasync def process() -> None:\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\"-a\", \"--action\", type=int, help=\"Action to perform\")\n\n    logger.info(f\"Detected {len(get_session_names())} sessions | {len(get_proxies())} proxies\")\n\n    action = parser.parse_args().action\n\n    if not action:\n\n        print(start_text)\n\n        while True:\n            action = input(\"> \")\n\n            if not action.isdigit():\n                logger.warning(\"Action must be number\")\n            elif action not in [\"1\", \"2\", \"3\", \"4\"]:\n                logger.warning(\"Action must be 1, 2, 3 or 4\")\n            else:\n                action = int(action)\n                break\n\n    if action == 2:\n        await register_sessions()\n    elif action == 1:\n        tg_clients = await get_tg_clients()\n        proxies = get_proxies()\n        await run_tapper_no_thread(tg_clients=tg_clients, proxies=proxies)\n\n    elif action == 3:\n        tapper = import_tapper()\n        if tapper:\n            tg_clients = await get_tg_clients()\n            proxies = get_proxies()\n            await tapper.run_tapper_no_thread(tg_clients=tg_clients, proxies=proxies)\n    elif action == 4:\n        with open(\"data.txt\", \"r\") as f:\n            query_ids = [line.strip() for line in f.readlines()]\n        proxies = get_proxies()\n        await run_tapper_no_thread_query(query_ids, proxies)\n\n\n"
  },
  {
    "path": "bot/utils/logger.py",
    "content": "import sys\nfrom loguru import logger\n\n\nlogger.remove()\nlogger.add(sink=sys.stdout, format=\"<white>{time:YYYY-MM-DD HH:mm:ss}</white>\"\n                                   \" | <level>{level: <8}</level>\"\n                                   \" | <cyan><b>{line}</b></cyan>\"\n                                   \" - <white><b>{message}</b></white>\")\nlogger = logger.opt(colors=True)\n"
  },
  {
    "path": "main.py",
    "content": "import asyncio\nfrom contextlib import suppress\n\nfrom bot.utils.launcher import process\n\n\nasync def main():\n    await process()\n\n\nif __name__ == '__main__':\n    with suppress(KeyboardInterrupt):\n        asyncio.run(main())\n"
  },
  {
    "path": "requirements.txt",
    "content": "aiocfscrape==1.0.0\naiohttp==3.9.3\naiohttp-proxy==0.1.2\naiosignal==1.3.1\nannotated-types==0.6.0\nasync-timeout==4.0.3\nattrs==23.2.0\nbeautifulsoup4==4.12.3\nbetter-proxy==1.1.5\ncolorama==0.4.6\nDateTime==5.5\nfrozenlist==1.4.1\nidna==3.6\nJs2Py==0.74\nloguru==0.7.2\nmultidict==6.0.5\npyaes==1.6.1\npydantic==2.6.4\npydantic-settings==2.2.1\npydantic_core==2.16.3\npyjsparser==2.7.1\nPyrogram==2.0.106\nPySocks==1.7.1\npython-dotenv==1.0.1\npytz==2024.1\nsix==1.16.0\nsoupsieve==2.5\nTgCrypto==1.2.5\ntyping_extensions==4.11.0\ntzdata==2024.1\ntzlocal==5.2\nwebsockets==12.0\nwin32-setctime==1.1.0\nyarl==1.9.4\nzope.interface==6.4.post2\nrequests==2.32.3\ncloudscraper==1.2.71\nFaker==29.0.0\npycryptodome==3.20.0\npillow==10.4.0\ntransformers==4.45.1\ntorch==2.4.1"
  },
  {
    "path": "run.bat",
    "content": "@echo off\n\nif not exist venv (\n    echo Creating virtual environment...\n    python -m venv venv\n)\n\necho Activating virtual environment...\ncall venv\\Scripts\\activate\n\nif not exist venv\\Lib\\site-packages\\installed (\n    if exist requirements.txt (\n\t\techo installing wheel for faster installing\n\t\tpip install wheel\n        echo Installing dependencies...\n        pip install -r requirements.txt\n        echo. > venv\\Lib\\site-packages\\installed\n    ) else (\n        echo requirements.txt not found, skipping dependency installation.\n    )\n) else (\n    echo Dependencies already installed, skipping installation.\n)\n\nif not exist .env (\n\techo Copying configuration file\n\tcopy .env-example .env\n) else (\n\techo Skipping .env copying\n)\n\necho Starting the bot...\npython main.py\n\necho done\necho PLEASE EDIT .ENV FILE\npause"
  },
  {
    "path": "run.sh",
    "content": "#!/bin/bash\n\n# Проверка на наличие папки venv\nif [ ! -d \"venv\" ]; then\n    echo \"Creating virtual environment...\"\n    python3 -m venv venv\nfi\n\necho \"Activating virtual environment...\"\nsource venv/bin/activate\n\n# Проверка на наличие установленного флага в виртуальном окружении\nif [ ! -f \"venv/installed\" ]; then\n    if [ -f \"requirements.txt\" ]; then\n\t\techo \"Installing wheel for faster installing\"\n\t\tpip3 install wheel\n        echo \"Installing dependencies...\"\n        pip3 install -r requirements.txt\n        touch venv/installed\n    else\n        echo \"requirements.txt not found, skipping dependency installation.\"\n    fi\nelse\n    echo \"Dependencies already installed, skipping installation.\"\nfi\n\nif [ ! -f \".env\" ]; then\n\techo \"Copying configuration file\"\n\tcp .env-example .env\nelse\n\techo \"Skipping .env copying\"\nfi\n\necho \"Starting the bot...\"\npython3 main.py\n\necho \"done\"\necho \"PLEASE EDIT .ENV FILE\"\n"
  },
  {
    "path": "version",
    "content": "3.0.5\n"
  }
]