maple_clb/run.py

70 lines
1.5 KiB
Python

from asyncio import create_task, get_event_loop, new_event_loop, run, sleep
from json import loads
from random import choice
from clb import public, private, Client
try:
import uvloop
uvloop.install()
except ImportError:
...
from os.path import dirname
dir_path = dirname(__file__)
NAMES = []
ACCOUNTS = []
TASKS = []
PROXIES = []
with open(f".names", "r") as f:
NAMES.extend([l.rstrip("\n") for l in f.readlines()])
with open(f".words", "r") as f:
NAMES.extend([l.rstrip("\n") for l in f.readlines()])
with open(f"proxies.txt", "r") as f:
for line in f.readlines():
PROXIES.append(line.rstrip("\n"))
# with open(f"{dir_path}/.proxies", "r") as f:
# for line in f.readlines():
# PROXIES.append(line.rstrip("\n"))
with open(f".accounts2", "r") as f:
ACCOUNTS = loads(f.read())
print(f"{dir_path}/.accounts_2")
print(len(NAMES), len(public), len(ACCOUNTS))
loop = new_event_loop()
async def create_clients():
loop = get_event_loop()
loop.set_debug(True)
for account in ACCOUNTS[200:300]:
client = Client(
loop=loop,
names=NAMES,
username=account["username"],
password=account["password"],
proxy=choice(PROXIES)
)
create_task(client.start())
while loop.is_running():
await sleep(60.0)
# run(create_clients())
loop.run_until_complete(create_clients())
loop.run_forever()
# with open("{dir_path}/.junk", "w+") as f:
# for l in clb.JUNK:
# f.write(f"{l}""\n")