diff --git a/OlivOS/core/boot/bootDataAPI.py b/OlivOS/core/boot/bootDataAPI.py index dcd37841..37cc778c 100644 --- a/OlivOS/core/boot/bootDataAPI.py +++ b/OlivOS/core/boot/bootDataAPI.py @@ -548,7 +548,7 @@ "server": { "auto": True, "host": "0.0.0.0", - "port": 55011, + "port": 55666, "token": "114514" } }, diff --git a/OlivOS/core/core/accountAPI.py b/OlivOS/core/core/accountAPI.py index fc46e33d..537640ff 100644 --- a/OlivOS/core/core/accountAPI.py +++ b/OlivOS/core/core/accountAPI.py @@ -18,6 +18,8 @@ import socket from contextlib import closing import platform +import random +import hashlib import OlivOS @@ -114,6 +116,8 @@ def accountFix(basic_conf_models, bot_info_dict, logger_proc): and basic_conf_models[basic_conf_models_this]['type'] == 'astralqsign_lib_exe_model' \ and basic_conf_models[basic_conf_models_this]['server']['auto'] is True: basic_conf_models[basic_conf_models_this]['server']['host'] = '0.0.0.0' + basic_conf_models[basic_conf_models_this]['server']['port'] = random.randint(10000, 65535) + basic_conf_models[basic_conf_models_this]['server']['token'] = getToken(str(random.randint(10000, 65535))) if isInuse( '127.0.0.1', basic_conf_models[basic_conf_models_this]['server']['port'] @@ -189,3 +193,9 @@ def get_free_port(): s.bind(('', 0)) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) return s.getsockname()[1] + +def getToken(src:str): + hash_tmp = hashlib.new('md5') + hash_tmp.update(str(src).encode(encoding='UTF-8')) + hash_tmp.update(str(114514666).encode(encoding='UTF-8')) + return hash_tmp.hexdigest()