diff --git a/bit_tools.py b/bit_tools.py index 548bcbd..66cf0aa 100644 --- a/bit_tools.py +++ b/bit_tools.py @@ -1,5 +1,9 @@ import json import requests +from peewee import fn + +from models.ips import Ips +from models.xstart import Xstart url = "http://127.0.0.1:54345" headers = {'Content-Type': 'application/json'} @@ -149,3 +153,17 @@ def group_add(groupName): res = requests.post(f'{url}/group/add', data=json.dumps(json_data), headers=headers) return res.json() + +# if __name__ == '__main__': +# for i in Xstart.select().where( +# Xstart.x_id.is_null() +# ): +# ips_info = Ips.select().where(Ips.start == 1).order_by(fn.Rand()).get() +# +# update_proxy_Browser( +# id=i.bit_id, +# host=ips_info.host, +# port=ips_info.port, +# proxyUserName=ips_info.username, +# proxyPassword=ips_info.password +# ) diff --git a/models/ips.py b/models/ips.py index d048a61..a4627c6 100644 --- a/models/ips.py +++ b/models/ips.py @@ -1,6 +1,6 @@ from peewee import * -from models import db1 +from models import db1 class Ips(Model): @@ -9,10 +9,12 @@ class Ips(Model): port = CharField(null=True) username = CharField(null=True) password = CharField(null=True) + start = IntegerField(null=True) class Meta: database = db1 table_name = 'ips' -if __name__ == '__main__': - Ips.create_table() \ No newline at end of file + +# if __name__ == '__main__': +# Ips.create_table() diff --git a/telegram/bot_session.session b/telegram/bot_session.session index 6e30193..eede567 100644 Binary files a/telegram/bot_session.session and b/telegram/bot_session.session differ diff --git a/telegram/sign.db b/telegram/sign.db index 8b2db4e..40cbc10 100644 Binary files a/telegram/sign.db and b/telegram/sign.db differ diff --git a/test.py b/test.py index 6380af2..96c28ec 100644 --- a/test.py +++ b/test.py @@ -1,28 +1,65 @@ -from cozepy import Coze, TokenAuth, Message, ChatEventType, COZE_CN_BASE_URL +import random +import time +from concurrent.futures import ThreadPoolExecutor + +from curl_cffi import requests + +from models.ips import Ips + +cookies = { + 'PHPSESSID': 'a99b27b7-0c15-324d-49f0-29009b795783', + 'ipsb': 'Dn42KhiATwEbRov7et5J6FBspLaZdXVg', +} + +headers = { + 'accept': '*/*', + 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', + 'cache-control': 'no-cache', + 'dnt': '1', + 'pragma': 'no-cache', + 'referer': 'https://ip.sb/', + 'sec-ch-ua': '"Chromium";v="142", "Microsoft Edge";v="142", "Not_A Brand";v="99"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"Windows"', + 'sec-fetch-dest': 'script', + 'sec-fetch-mode': 'no-cors', + 'sec-fetch-site': 'same-site', + 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0', + # 'cookie': 'PHPSESSID=a99b27b7-0c15-324d-49f0-29009b795783; ipsb=Dn42KhiATwEbRov7et5J6FBspLaZdXVg', +} -def to_xx(user_id, quest_text): - """调用Coze API进行对话""" - coze = Coze(auth=TokenAuth(token="pat_TNHVdiVDn9poKjUXYqVArNwGd9C2cWIIP04ltz4N85WClayks7VuNDF9ewHb5rTi"), - base_url=COZE_CN_BASE_URL) +def main(sql_info): + proxies = { + 'http': f'socks5://{sql_info.username}:{sql_info.password}@{sql_info.host}:{sql_info.port}', + 'https': f'socks5://{sql_info.username}:{sql_info.password}@{sql_info.host}:{sql_info.port}', + } - bot_id = "7566918492960620559" - user_id = user_id + # socks5://92.113.106.14:30014:t5742:x335757 + for i in range(5): + try: + response = requests.get( + 'https://ipv4.ip.sb/addrinfo', + headers=headers, + proxies=proxies, + ) - text = "" - for event in coze.chat.stream( - bot_id=bot_id, - user_id=user_id, - additional_messages=[ - Message.build_user_question_text(quest_text) - ] - ): - if event.event == ChatEventType.CONVERSATION_MESSAGE_DELTA: - message = event.message - text += message.content + print(response.json()["address"]) - return text + if response.json()["address"] == sql_info.host: + sql_info.start = 1 + sql_info.save() + + break + + + except: + time.sleep(random.randint(1, 3)) if __name__ == '__main__': - print(to_xx(user_id="7566918492960620559", quest_text="我想要加入你们公司,需要什么要求")) \ No newline at end of file + + with ThreadPoolExecutor(max_workers=100) as executor: + for i in Ips.select(): + executor.submit(main, i) + time.sleep(random.randint(1, 3))