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

@@ -26,7 +26,7 @@ for i in range(0,1000,100):
for i in range(300):
try:
r = remote("localhost", 10011)
r = remote('172.20.14.117', "61553")
# r = process(['python3', 'main.py'])
for i in range(15):
r.sendlineafter(b":", b"1")
@@ -35,8 +35,7 @@ for i in range(300):
r.sendlineafter(b"chests:", b"0 0 1 0 0 1 0")
r.recvline()
flag = r.recvline()
if b"flag" in flag:
end_time = time.time()
if b"0xFA" in flag:
print(flag)
break
else:

View File

@@ -164,10 +164,10 @@ for i in range(15):
from pwn import *
# 设置日志级别为 debug以便在执行过程中输出详细日志信息
#context.log_level = 'debug'
context.log_level = 'debug'
r = process(['python3', 'main_local.py'])
#r = remote("localhost", "10011")
#r = process(['python3', 'main_local.py'])
r = remote('172.20.14.117', "61553")
for i in range(1):
msg = ''

View File

@@ -0,0 +1,7 @@
FROM python:3.11
COPY main_remote.py /app/
WORKDIR /app
CMD [ "python", "main_remote.py" ]

View File

@@ -1,6 +1,5 @@
from random import choice as c
from random import randint, shuffle
from Crypto.Util.number import * # type: ignore
flag = b"flag{this_is_a_test_flag}"

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)