fix(crawler,webui): improve WAF slider bypass algorithm and add auto port fallback

This commit is contained in:
zxy
2026-09-02 21:55:34 +08:00
parent 606feb10cf
commit 45342d079e
2 changed files with 32 additions and 14 deletions
+7 -1
View File
@@ -646,7 +646,13 @@ def index_page():
def main():
port = 8000
import socket
def is_port_in_use(p):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex(('127.0.0.1', p)) == 0
default_port = 8000 if not is_port_in_use(8000) else 8080
port = int(os.environ.get("PORT", default_port))
url = f"http://127.0.0.1:{port}"
print("=" * 65)
print(" 🚀 人教社电子教材 WebUI 服务器正在启动...")