| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import time
- import aiohttp
- import asyncio
- import json
- from fake_useragent import UserAgent
- from utils.utils_send_gotify import *
- goto_url = 'https://app.getgrass.io/'
- account_list = [
- 'jack0210_@hotmail.com:aaaAAA111!!!',
- 'yujiec0210@gmail.com:aaaAAA111!!!',
- 'yujieccyj01@hotmail.com:aaaAAA111!!!',
- 'yujieccyj02@hotmail.com:aaaAAA111!!!',
- 'yujieccyj03@hotmail.com:aaaAAA111!!!',
- 'yujieccyj04@hotmail.com:aaaAAA111!!!',
- 'yujieccyj05@hotmail.com:aaaAAA111!!!',
- 'yujieccyj06@hotmail.com:aaaAAA111!!!',
- 'yujieccyj07@hotmail.com:aaaAAA111!!!',
- 'yujieccyj08@hotmail.com:aaaAAA111!!!',
- 'yujieccyj09@hotmail.com:aaaAAA111!!!',
- 'yujieccyj10@hotmail.com:aaaAAA111!!!',
- 'yujieccyj11@hotmail.com:aaaAAA111!!!'
- ]
- class LoginClient:
- def __init__(self, email, password, user_agent):
- self.email = email
- self.password = password
- self.user_agent = user_agent
- self.website_headers = {
- 'authority': 'api.getgrass.io',
- 'accept': 'application/json, text/plain, */*',
- 'accept-language': 'uk-UA,uk;q=0.9,en-US;q=0.8,en;q=0.7',
- 'content-type': 'application/json',
- 'origin': 'https://app.getgrass.io',
- 'referer': 'https://app.getgrass.io/',
- 'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
- 'sec-ch-ua-mobile': '?0',
- 'sec-ch-ua-platform': '"Windows"',
- 'sec-fetch-dest': 'empty',
- 'sec-fetch-mode': 'cors',
- 'sec-fetch-site': 'same-site',
- 'user-agent': self.user_agent,
- }
- async def login(self, session):
- url = 'https://api.getgrass.io/login'
- json_data = {
- 'password': self.password,
- 'username': self.email,
- }
- try:
- response = await session.post(url, headers=self.website_headers, data=json.dumps(json_data))
- response_text = await response.text()
- if response.status != 200:
- print(f"Login failed: {response_text}")
- return None
- return await response.json()
- except aiohttp.ClientConnectionError as e:
- print(f"Connection error occurred: {e}")
- return None
- except Exception as e:
- print(f"An error occurred: {e}")
- return None
- if __name__ == "__main__":
- async def main():
- async with aiohttp.ClientSession() as session:
- for account in account_list:
- email = account.split(':')[0]
- password = account.split(':')[1]
- user_agent = UserAgent().random
- client = LoginClient(email, password, user_agent)
- login_result = await client.login(session)
- if login_result:
- email = login_result['result']['data']['email']
- user_id = login_result['result']['data']['userId']
- print(f'account: {email}\nuser_id: {user_id}')
- else:
- print("Login failed.")
- asyncio.run(main())
|