feat: finish CS

This commit is contained in:
2023-11-02 09:11:18 +08:00
parent 8c48770523
commit 4258de1573
5 changed files with 18 additions and 13 deletions

View File

@@ -2,10 +2,12 @@ from random import choice as c
from random import randint, shuffle
import socketserver
import signal
import string
import random
import os
# 白名单列表,包含允许在问题中使用的关键词和符号
white_list = ['==', '(', ')', 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', '0', '1', 'and', 'or', 'not']
class Task(socketserver.BaseRequestHandler):
def _recvall(self):
BUFF_SIZE = 2048
@@ -74,7 +76,7 @@ class Task(socketserver.BaseRequestHandler):
# 游戏开始
self.send(b"The Unbreakable Shannon has returned, with some suspicious chests and a far more complicated strategy -- he MAY LIE ONCE OR TWICE! Can you still get all the treasure without losing your head?")
for i in range(1):
for _ in range(1):
if not self.do_round(): # 执行游戏回合
self.send(b"A chest suddenly comes alive and BITE YOUR HEAD OFF.\n")
return
@@ -91,9 +93,7 @@ class ForkedServer(socketserver.ForkingMixIn, socketserver.TCPServer):
if __name__ == "__main__":
flag = bytes(os.getenv("FLAG"),"utf-8") # type: ignore
# 白名单列表,包含允许在问题中使用的关键词和符号
white_list = ['==', '(', ')', 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', '0', '1', 'and', 'or', 'not']
HOST, PORT = '0.0.0.0', 10011
HOST, PORT = '0.0.0.0', 10001
server = ForkedServer((HOST, PORT), Task)
server.allow_reuse_address = True
print(HOST, PORT)