This commit is contained in:
ddrwode
2025-11-27 09:59:02 +08:00
commit 54dbfdcf88
5 changed files with 5168 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
.idea
.git
.log
.venv
__pycache__

26
test111.py Normal file
View File

@@ -0,0 +1,26 @@
import threading
import time
def daemon_thread_function():
print("守护线程开始")
time.sleep(5)
print("守护线程结束")
def non_daemon_thread_function():
print("非守护线程开始")
time.sleep(2)
print("非守护线程结束")
# 创建守护线程
daemon_thread = threading.Thread(target=daemon_thread_function, daemon=True)
# 创建非守护线程
non_daemon_thread = threading.Thread(target=non_daemon_thread_function)
# 启动线程
daemon_thread.start()
non_daemon_thread.start()
print("主线程继续执行")
# 主线程等待非守护线程结束
non_daemon_thread.join()
print("主线程结束")

136
ton 撞助记词.py Normal file
View File

@@ -0,0 +1,136 @@
import random
import threading
import time
import asyncio
import requests
from loguru import logger
from concurrent.futures import ThreadPoolExecutor
from tonutils.client import TonapiClient, ToncenterV3Client
from tonutils.utils import to_amount
from tonutils.wallet import (
WalletV3R1,
# Uncomment the following lines to use different wallet versions:
WalletV3R2,
WalletV4R1,
WalletV4R2,
WalletV5R1,
HighloadWalletV2,
HighloadWalletV3,
)
# 配置日志文件输出
logger.add("wallet_log.log", rotation="1 day", retention="999 days")
# API key for accessing the Tonapi (obtainable from https://tonconsole.com)
API_KEY = "AFMEX4F23ZRPOUIAAAAPHGIE5QECWZA5M75E54VD72O5IJEGP5IW3LOTXO7Z4QOX7MV6JQQ"
# Set to True for test network, False for main network
IS_TESTNET = False
headers = {
'accept': '*/*',
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'authorization': 'Bearer AFPJTKEBPOX3AIYAAAAKA2HWOTRNJP5MUCV5DMDCZAAOCPSAYEYS3CILNQVLF2HWKED6USY',
'cache-control': 'no-cache',
'content-type': 'application/json',
'dnt': '1',
'origin': 'https://tonviewer.com',
'pragma': 'no-cache',
'priority': 'u=1, i',
'referer': 'https://tonviewer.com/',
'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132", "Microsoft Edge";v="132"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0',
}
def get_ton_num(address):
headers = {
'accept': '*/*',
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'authorization': 'Bearer AFPJTKEBPOX3AIYAAAAKA2HWOTRNJP5MUCV5DMDCZAAOCPSAYEYS3CILNQVLF2HWKED6USY',
'cache-control': 'no-cache',
'content-type': 'application/json',
'dnt': '1',
'origin': 'https://tonviewer.com',
'pragma': 'no-cache',
'priority': 'u=1, i',
'referer': 'https://tonviewer.com/',
'sec-ch-ua': '"Not A(Brand";v="8", "Chromium";v="132", "Microsoft Edge";v="132"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0',
}
for i in range(3):
try:
response = requests.get(
f'https://tonapi.io/v2/accounts/{address}',
headers=headers,
)
return to_amount(int(response.json()["balance"]))
except:
time.sleep(random.random())
return False
async def main(i) -> None:
# client = TonapiClient(api_key=API_KEY, is_testnet=IS_TESTNET)
# wallet, public_key, private_key, mnemonic = WalletV3R1.from_mnemonic(client, MNEMONIC)
# Uncomment and use the following lines to create different wallet versions from mnemonic:
# wallet, public_key, private_key, mnemonic = WalletV3R2.from_mnemonic(client, MNEMONIC)
# wallet, public_key, private_key, mnemonic = WalletV4R1.from_mnemonic(client, MNEMONIC)
# wallet, public_key, private_key, mnemonic = WalletV4R2.from_mnemonic(client, i.split())
# wallet, public_key, private_key, mnemonic = WalletV5R1.from_mnemonic(client, i.split())
# wallet, public_key, private_key, mnemonic = HighloadWalletV2.from_mnemonic(client, MNEMONIC)
# wallet, public_key, private_key, mnemonic = HighloadWalletV3.from_mnemonic(client, MNEMONIC)
client = ToncenterV3Client(is_testnet=IS_TESTNET, rps=1, max_retries=1)
wallet, public_key, private_key, mnemonic = WalletV4R2.create(client)
for i1 in range(5):
try:
# balance = await wallet.balance()
#
# # print(f"Wallet balance (nano): {balance}")
#
# logger.info(
# f"余额:{to_amount(balance)} Address: {wallet.address.to_str(is_user_friendly=True, is_url_safe=True, is_bounceable=False, is_test_only=False)}D{mnemonic}")
response = requests.get(
f'https://tonapi.io/v2/accounts/{wallet.address.to_str(is_user_friendly=True, is_url_safe=True, is_bounceable=False, is_test_only=False)}',
headers=headers,
)
logger.info(
f"余额:{to_amount(int(response.json()["balance"]))} Address: {wallet.address.to_str(is_user_friendly=True, is_url_safe=True, is_bounceable=False, is_test_only=False)}D{" ".join(mnemonic)}")
break
except:
time.sleep(random.random())
# UQAPANf-jMyS_2DcqYt-9KDD6_n38GoVlx70iq6aZV6ky1rN
# UQAPANf-jMyS_2DcqYt-9KDD6_n38GoVlx70iq6aZV6ky1rN
def main1(i):
asyncio.run(main(i))
if __name__ == "__main__":
with ThreadPoolExecutor(max_workers=100) as executor:
# main1(i="grfreg")
while True:
executor.submit(main1, "grfreg")
time.sleep(random.random())

41
ton 生成助记词.py Normal file
View File

@@ -0,0 +1,41 @@
from tonutils.client import ToncenterV3Client
from tonutils.wallet import (
# Uncomment the following lines to use different wallet versions:
# WalletV2R1,
# WalletV2R2,
# WalletV3R1,
# WalletV3R2,
# WalletV4R1,
WalletV4R2,
# WalletV5R1,
# HighloadWalletV2,
# HighloadWalletV3,
# PreprocessedWalletV2,
# PreprocessedWalletV2R1,
)
# Set to True for test network, False for main network
IS_TESTNET = True
def main() -> None:
client = ToncenterV3Client(is_testnet=IS_TESTNET, rps=1, max_retries=1)
wallet, public_key, private_key, mnemonic = WalletV4R2.create(client)
# Uncomment and use the following lines to create different wallet versions:
# wallet, public_key, private_key, mnemonic = WalletV3R2.create(client)
# wallet, public_key, private_key, mnemonic = WalletV4R1.create(client)
# wallet, public_key, private_key, mnemonic = WalletV4R2.create(client)
# wallet, public_key, private_key, mnemonic = WalletV5R1.create(client)
# wallet, public_key, private_key, mnemonic = HighloadWalletV2.create(client)
# wallet, public_key, private_key, mnemonic = HighloadWalletV3.create(client)
# wallet, public_key, private_key, mnemonic = PreprocessedWalletV2.create(client)
# wallet, public_key, private_key, mnemonic = PreprocessedWalletV2R1.create(client)
print("Wallet has been successfully created!")
print(f"Address: {wallet.address.to_str()}")
print(f"Mnemonic: {mnemonic}")
if __name__ == "__main__":
main()

4960
wallet_log.log Normal file

File diff suppressed because it is too large Load Diff