├── user_id.txt ├── requirements.txt ├── local_proxies.txt ├── README.md ├── grass_proxy.py └── grass_freeproxy.py /user_id.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | asyncio 3 | loguru 4 | websockets_proxy 5 | fake-useragent==1.5.1 6 | websockets==12.0 7 | -------------------------------------------------------------------------------- /local_proxies.txt: -------------------------------------------------------------------------------- 1 | http://ip:port 2 | socks4://ip:port 3 | socks5://ip:port 4 | http://user:pass@ip:port 5 | socks4://user:pass@ip:port 6 | socks5://user:pass@ip:port 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Paste your proxies inside local_proxies.txt and the User ID inside user_id.txt 2 | 3 | 4 | # How to Get GRASS User ID 5 | 6 | 1. Open your browser and login to the GRASS dashboard. 7 | 2. Press `F12` to open the **Inspect Elements** panel. 8 | 3. Go to the **Console** tab and paste the following code: 9 | 10 | ```javascript 11 | localStorage.getItem('userId') 12 | ``` 13 | 14 | 4. You will receive your user ID, which looks like this: `"2oT4xCkPYSNyBp........"` 15 | 5. If you can't paste, type allow pasting and press Enter, then paste the line above. 16 | 17 | ## Recommended Python Version 18 | 19 | It is recommended to use **Python 3.10**. 20 | [Download Python 3.10 here](https://www.python.org/downloads/release/python-3100/). 21 | 22 | ## Install Requirements 23 | 24 | Run the following command to install the necessary packages: 25 | 26 | ```bash 27 | pip install -r requirements.txt 28 | ``` 29 | 30 | ## Running the Script 31 | 32 | You can run the script using the following commands: 33 | 34 | ### Using Free Proxies (Automatically Assigned) 35 | ```bash 36 | python grass_freeproxy.py 37 | ``` 38 | This script will automatically assign free proxies using the **Proxyscrape API**. 39 | ### Using Personal Proxies 40 | ```bash 41 | python grass_proxy.py 42 | ``` 43 | ## FOR ANDROID 44 | 45 | # How to Get GRASS User ID Using Android Device 46 | 47 | 1. Download and install [Kiwi Browser](https://play.google.com/store/apps/details?id=com.kiwibrowser.browser&hl=en). 48 | 2. Login to the GRASS web and go to the dashboard. 49 | 3. Open the **Developer Tools** in the Kiwi browser. 50 | 4. Go to the **Console** tab and paste this code: 51 | 52 | ```javascript 53 | localStorage.getItem('userId') 54 | ``` 55 | 56 | 5. If you can't paste, type `allow pasting` and press Enter, then paste the line above. 57 | 58 | ## Configure Termux 59 | 60 | After installing Termux, ensure you have allowed storage permission for Termux (device app) settings. 61 | Alternatively, run this command in Termux: 62 | 63 | ```bash 64 | termux-setup-storage 65 | ``` 66 | 67 | ### Install Python 3.10 68 | 69 | Run the following commands: 70 | 71 | ```bash 72 | pkg update && upgrade 73 | pkg install tur-repo 74 | pkg install python-is-python3.10 75 | pkg install -y rust binutils 76 | CARGO_BUILD_TARGET="$(rustc -Vv | grep "host" | awk '{print $2}')" pip install maturin 77 | ``` 78 | 79 | ## Clone This Script and do the rest. 80 | 81 | 82 | -------------------------------------------------------------------------------- /grass_proxy.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import random 3 | import ssl 4 | import json 5 | import time 6 | import uuid 7 | from loguru import logger 8 | from websockets_proxy import Proxy, proxy_connect 9 | from fake_useragent import UserAgent 10 | 11 | async def connect_to_wss(socks5_proxy, user_id): 12 | user_agent = UserAgent(os=['windows', 'macos', 'linux'], browsers='chrome') 13 | random_user_agent = user_agent.random 14 | device_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, socks5_proxy)) 15 | logger.info(f"Device ID: {device_id}") 16 | 17 | while True: 18 | try: 19 | await asyncio.sleep(random.randint(1, 10) / 10) 20 | custom_headers = { 21 | "User-Agent": random_user_agent, 22 | } 23 | ssl_context = ssl.create_default_context() 24 | ssl_context.check_hostname = False 25 | ssl_context.verify_mode = ssl.CERT_NONE 26 | 27 | urilist = ["wss://proxy2.wynd.network:4444/", "wss://proxy2.wynd.network:4650/"] 28 | uri = random.choice(urilist) 29 | server_hostname = "proxy2.wynd.network" 30 | proxy = Proxy.from_url(socks5_proxy) 31 | 32 | async with proxy_connect(uri, proxy=proxy, ssl=ssl_context, server_hostname=server_hostname, 33 | extra_headers=custom_headers) as websocket: 34 | async def send_ping(): 35 | while True: 36 | send_message = json.dumps({ 37 | "id": str(uuid.uuid4()), "version": "1.0.0", "action": "PING", "data": {} 38 | }) 39 | logger.debug(f"Sending ping: {send_message}") 40 | await websocket.send(send_message) 41 | await asyncio.sleep(5) 42 | 43 | await asyncio.sleep(1) 44 | asyncio.create_task(send_ping()) 45 | 46 | while True: 47 | response = await websocket.recv() 48 | message = json.loads(response) 49 | logger.info(f"Received message: {message}") 50 | 51 | if message.get("action") == "AUTH": 52 | auth_response = { 53 | "id": message["id"], 54 | "origin_action": "AUTH", 55 | "result": { 56 | "browser_id": device_id, 57 | "user_id": user_id, 58 | "user_agent": custom_headers['User-Agent'], 59 | "timestamp": int(time.time()), 60 | "device_type": "desktop", 61 | "version": "4.28.2", 62 | } 63 | } 64 | logger.debug(f"Sending auth response: {auth_response}") 65 | await websocket.send(json.dumps(auth_response)) 66 | 67 | elif message.get("action") == "PONG": 68 | pong_response = {"id": message["id"], "origin_action": "PONG"} 69 | logger.debug(f"Sending pong response: {pong_response}") 70 | await websocket.send(json.dumps(pong_response)) 71 | except Exception as e: 72 | logger.error(f"Error with proxy {socks5_proxy}: {e}") 73 | 74 | async def main(): 75 | try: 76 | with open('user_id.txt', 'r') as f: 77 | _user_id = f.read().strip() 78 | if not _user_id: 79 | print("No user ID found in 'user_id.txt'.") 80 | return 81 | print(f"User ID read from file: {_user_id}") 82 | except FileNotFoundError: 83 | print("Error: 'user_id.txt' file not found.") 84 | return 85 | 86 | try: 87 | with open('local_proxies.txt', 'r') as file: 88 | local_proxies = file.read().splitlines() 89 | if not local_proxies: 90 | print("No proxies found in 'local_proxies.txt'.") 91 | return 92 | print(f"Proxies read from file: {local_proxies}") 93 | except FileNotFoundError: 94 | print("Error: 'local_proxies.txt' file not found.") 95 | return 96 | 97 | tasks = [asyncio.ensure_future(connect_to_wss(proxy, _user_id)) for proxy in local_proxies] 98 | await asyncio.gather(*tasks) 99 | 100 | if __name__ == '__main__': 101 | asyncio.run(main()) 102 | -------------------------------------------------------------------------------- /grass_freeproxy.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import random 3 | import ssl 4 | import json 5 | import time 6 | import uuid 7 | import requests 8 | import shutil 9 | from loguru import logger 10 | from websockets_proxy import Proxy, proxy_connect 11 | from fake_useragent import UserAgent 12 | 13 | async def connect_to_wss(socks5_proxy, user_id): 14 | user_agent = UserAgent(os=['windows', 'macos', 'linux'], browsers='chrome') 15 | random_user_agent = user_agent.random 16 | device_id = str(uuid.uuid3(uuid.NAMESPACE_DNS, socks5_proxy)) 17 | logger.info(device_id) 18 | while True: 19 | try: 20 | await asyncio.sleep(random.randint(1, 10) / 10) 21 | custom_headers = { 22 | "User-Agent": random_user_agent, 23 | } 24 | ssl_context = ssl.create_default_context() 25 | ssl_context.check_hostname = False 26 | ssl_context.verify_mode = ssl.CERT_NONE 27 | urilist = ["wss://proxy2.wynd.network:4444/", "wss://proxy2.wynd.network:4650/"] 28 | uri = random.choice(urilist) 29 | server_hostname = "proxy2.wynd.network" 30 | proxy = Proxy.from_url(socks5_proxy) 31 | async with proxy_connect(uri, proxy=proxy, ssl=ssl_context, server_hostname=server_hostname, 32 | extra_headers=custom_headers) as websocket: 33 | async def send_ping(): 34 | while True: 35 | send_message = json.dumps({ 36 | "id": str(uuid.uuid4()), "version": "1.0.0", "action": "PING", "data": {} 37 | }) 38 | logger.debug(send_message) 39 | await websocket.send(send_message) 40 | await asyncio.sleep(5) 41 | 42 | await asyncio.sleep(1) 43 | asyncio.create_task(send_ping()) 44 | 45 | while True: 46 | response = await websocket.recv() 47 | message = json.loads(response) 48 | logger.info(message) 49 | if message.get("action") == "AUTH": 50 | auth_response = { 51 | "id": message["id"], 52 | "origin_action": "AUTH", 53 | "result": { 54 | "browser_id": device_id, 55 | "user_id": user_id, 56 | "user_agent": custom_headers['User-Agent'], 57 | "timestamp": int(time.time()), 58 | "device_type": "desktop", 59 | "version": "4.28.2", 60 | } 61 | } 62 | logger.debug(auth_response) 63 | await websocket.send(json.dumps(auth_response)) 64 | 65 | elif message.get("action") == "PONG": 66 | pong_response = {"id": message["id"], "origin_action": "PONG"} 67 | logger.debug(pong_response) 68 | await websocket.send(json.dumps(pong_response)) 69 | except Exception as e: 70 | proxy_to_remove = socks5_proxy 71 | with open('auto_proxies.txt', 'r') as file: 72 | lines = file.readlines() 73 | updated_lines = [line for line in lines if line.strip() != proxy_to_remove] 74 | with open('auto_proxies.txt', 'w') as file: 75 | file.writelines(updated_lines) 76 | print(f"Proxy '{proxy_to_remove}' has been removed from the file.") 77 | 78 | def fetch_proxies(): 79 | """Fetches proxies from the API and saves them to 'auto_proxies.txt'.""" 80 | api_url = "https://api.proxyscrape.com/v4/free-proxy-list/get?request=display_proxies&proxy_format=protocolipport&format=text" 81 | try: 82 | response = requests.get(api_url, stream=True) 83 | if response.status_code == 200: 84 | proxies = response.text.strip().splitlines() 85 | if proxies: 86 | with open('auto_proxies.txt', 'w') as f: 87 | f.writelines([proxy + '\n' for proxy in proxies]) 88 | print(f"Fetched and saved {len(proxies)} proxies to 'auto_proxies.txt'.") 89 | else: 90 | print("No proxies found from the API.") 91 | return False 92 | else: 93 | print(f"Failed to fetch proxies. Status code: {response.status_code}") 94 | return False 95 | except Exception as e: 96 | print(f"Error fetching proxies: {e}") 97 | return False 98 | return True 99 | 100 | async def main(): 101 | try: 102 | with open('user_id.txt', 'r') as f: 103 | _user_id = f.read().strip() 104 | if not _user_id: 105 | print("No user ID found in 'user_id.txt'.") 106 | return 107 | print(f"User ID read from file: {_user_id}") 108 | except FileNotFoundError: 109 | print("Error: 'user_id.txt' file not found.") 110 | return 111 | 112 | # Fetch and save proxies to 'auto_proxies.txt' 113 | if not fetch_proxies(): 114 | print("No proxies available. Exiting script.") 115 | return 116 | 117 | try: 118 | with open('auto_proxies.txt', 'r') as file: 119 | auto_proxy_list = file.read().splitlines() 120 | if not auto_proxy_list: 121 | print("No proxies found in 'auto_proxies.txt'. Exiting script.") 122 | return 123 | print(f"Proxies read from file: {auto_proxy_list}") 124 | except FileNotFoundError: 125 | print("Error: 'auto_proxies.txt' file not found.") 126 | return 127 | 128 | tasks = [asyncio.ensure_future(connect_to_wss(i, _user_id)) for i in auto_proxy_list] 129 | await asyncio.gather(*tasks) 130 | 131 | if __name__ == '__main__': 132 | asyncio.run(main()) 133 | --------------------------------------------------------------------------------