Skip to content

Commit

Permalink
小改动
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Aug 15, 2024
1 parent ede782b commit 92ae84d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OlivOS/core/boot/bootDataAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@
"server": {
"auto": True,
"host": "0.0.0.0",
"port": 55011,
"port": 55666,
"token": "114514"
}
},
Expand Down
10 changes: 10 additions & 0 deletions OlivOS/core/core/accountAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import socket
from contextlib import closing
import platform
import random
import hashlib

import OlivOS

Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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()

0 comments on commit 92ae84d

Please sign in to comment.