146 lines
4.5 KiB
Python
146 lines
4.5 KiB
Python
import time
|
|
import urllib.parse
|
|
import json
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
|
|
from curl_cffi import requests
|
|
|
|
from models.tg_phone_devices import TgPhoneDevices
|
|
from test111111 import generate_evm_wallet
|
|
|
|
|
|
def get_user_data1(
|
|
phone,
|
|
bot_name,
|
|
url,
|
|
invite_code="",
|
|
platform="",
|
|
start_params="",
|
|
channel_name='',
|
|
device_model=""
|
|
):
|
|
# data = {
|
|
# "phone": phone, # 区号加号码
|
|
# "bot_name": bot_name, # 机器人名称
|
|
# "url": url,
|
|
# "platform": platform, # 平台 web_3 tdesktop
|
|
# "start_params": start_params,
|
|
# 'channel_name': channel_name, # 频道名称
|
|
# }
|
|
|
|
data = {
|
|
"phone": phone, # 区号加号码
|
|
"bot_name": bot_name, # 机器人名称
|
|
"url": url,
|
|
"invite_code": invite_code, # 邀请码
|
|
"platform": platform, # 平台 web_3 tdesktop
|
|
"start_params": start_params,
|
|
"channel_name": channel_name, # 频道名称
|
|
# 'device_model': device_model,
|
|
}
|
|
|
|
resp = requests.post("http://127.0.0.1:9001/api/get_token", json=data)
|
|
# print(resp.json())
|
|
if resp.status_code == 200:
|
|
return resp.json().get("data")
|
|
|
|
return False
|
|
|
|
|
|
def get_code(user_data1, dev_info1):
|
|
headers = {
|
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0',
|
|
'Accept': 'application/json, text/plain, */*',
|
|
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
|
|
'Content-Type': 'application/json',
|
|
'sec-ch-ua-platform': '"Windows"',
|
|
'sec-ch-ua': '"Microsoft Edge WebView2";v="143", "Microsoft Edge";v="143", "Chromium";v="143", "Not A(Brand";v="24"',
|
|
'sec-ch-ua-mobile': '?0',
|
|
'Origin': 'https://app.depinsim.com',
|
|
'Sec-Fetch-Site': 'same-site',
|
|
'Sec-Fetch-Mode': 'cors',
|
|
'Sec-Fetch-Dest': 'empty',
|
|
'Referer': 'https://app.depinsim.com/',
|
|
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
|
}
|
|
|
|
sessions = requests.Session()
|
|
|
|
sessions.proxies.update({
|
|
'http': f'http://192.168.1.20:{dev_info1.port}',
|
|
'https': f'http://192.168.1.20:{dev_info1.port}',
|
|
})
|
|
|
|
# 解析查询字符串
|
|
parsed_data = urllib.parse.parse_qs(user_data1)
|
|
|
|
# 获取 user 参数的值
|
|
user_data = parsed_data.get('user', [None])[0]
|
|
|
|
if user_data:
|
|
# 对 user 参数进行 URL 解码
|
|
decoded_user_data = urllib.parse.unquote(user_data)
|
|
# 解析 JSON 数据
|
|
user_json = json.loads(decoded_user_data)
|
|
# 获取 id 的值
|
|
user_id = user_json.get('id')
|
|
# print(user_id)
|
|
|
|
response = sessions.post(f'https://api.depinsim.com/base/tgUserStatus/{user_id}', headers=headers)
|
|
print(response.json())
|
|
|
|
json_data = {
|
|
'initData': user_data1,
|
|
'couponCode': '',
|
|
}
|
|
response = sessions.post('https://api.depinsim.com/base/tgLoginWithCoupon', headers=headers, json=json_data)
|
|
|
|
print(response.json())
|
|
dev_info1.dep_code = response.json()["data"]["verifyCode"]
|
|
dev_info1.save()
|
|
|
|
|
|
def main(dev_info):
|
|
# user_data = get_user_data1(
|
|
# phone=dev_info.phone,
|
|
# bot_name='DepinSimBot',
|
|
# url="https://app.depinsim.com",
|
|
# device_model=dev_info.device_model
|
|
# )
|
|
#
|
|
# # print(user_data)
|
|
# get_code(user_data1=user_data, dev_info1=dev_info)
|
|
mnemonic, address, privkey = generate_evm_wallet(num_words=12)
|
|
dev_info.mnemonic = mnemonic
|
|
dev_info.address = address
|
|
dev_info.privkey = privkey
|
|
|
|
dev_info.save()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
with ThreadPoolExecutor(max_workers=20) as executor:
|
|
# dev_infos = list(
|
|
# TgPhoneDevices.select().where(TgPhoneDevices.is_valid_session == 1, TgPhoneDevices.dep_code.is_null()))
|
|
|
|
|
|
dev_infos = list(
|
|
TgPhoneDevices.select())
|
|
for dev_info in dev_infos[7150:]:
|
|
executor.submit(main, dev_info)
|
|
time.sleep(0.5) # 控制线程提交的频率
|
|
|
|
# Hello! Welcome to Depinsim.
|
|
#
|
|
# By signing this message, you confirm ownership of the wallet address: 0xADcA20376A6CdCBd232577ac830F4116eC863DcF
|
|
#
|
|
# Please note:
|
|
# - This signature does not incur any gas fees.
|
|
# - It will not initiate any blockchain transactions.
|
|
# - It is solely for authentication purposes.
|
|
#
|
|
# Thank you for choosing Depinsim! Together, let's explore the exciting possibilities of the Web3 world.
|
|
#
|
|
# Depinsim Team
|