jack vor 1 Jahr
Ursprung
Commit
c0839099f7
4 geänderte Dateien mit 127 neuen und 1 gelöschten Zeilen
  1. 90 0
      message/message_check_grassio.py
  2. 2 1
      test/test_coin.py
  3. 10 0
      test/test_ip.py
  4. 25 0
      utils/utils_get_current_ip.py

+ 90 - 0
message/message_check_grassio.py

@@ -0,0 +1,90 @@
+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())

+ 2 - 1
test/test_sui.py → test/test_coin.py

@@ -17,7 +17,8 @@ headers = {
 client = httpx.Client(proxies=proxies, headers=headers)
 
 # 目标 URL
-url = "https://coinmarketcap.com/currencies/x/"
+# url = "https://coinmarketcap.com/currencies/sui/"  # sui
+url = "https://coinmarketcap.com/currencies/x/"  # x
 
 try:
     result = ''

+ 10 - 0
test/test_ip.py

@@ -0,0 +1,10 @@
+import requests
+
+proxyip = "http://lumi-jiege0210:aaaAAA111@175.99.17.215:6011"
+url = "https://api.ip.cc"
+proxies = {
+    'http://': proxyip,
+    'https://': proxyip,
+}
+data = requests.get(url=url, proxies=proxies)
+print(data.text)

+ 25 - 0
utils/utils_get_current_ip.py

@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+import aiohttp
+import asyncio
+
+
+async def fetch(url):
+    async with aiohttp.ClientSession() as session:
+        async with session.get(url) as response:
+            return await response.text()
+
+
+async def main():
+    url = 'http://api.ip.cc'
+    content = await fetch(url)
+    print(content)
+
+
+asyncio.run(main())
+
+'''
+Proxy server: 175.99.17.215
+port: 6011
+username: lumi-jiege0210
+password: aaaAAA111
+'''