fix: update flag and exp

This commit is contained in:
2023-10-16 14:57:57 +08:00
parent 1c680b646a
commit ce6d793bcb
5 changed files with 15 additions and 53 deletions

View File

@@ -1,46 +0,0 @@
from pwn import * # type: ignore
# context.log_level = 'debug'
"""
(这题小小的放了水)
因为只有一轮,而最终的答案有128种情况,那我们不妨直接猜一个答案
根据条件概率公式算一下
for i in range(0,1000,100):
print(i,":", 1 - (127/128) ** i)
0 : 0.0
100 : 0.5435690025908804
200 : 0.7916707446041162
300 : 0.9049120701701576
400 : 0.9565989213461966
500 : 0.9801904023814129
600 : 0.990958285600675
700 : 0.9958730812784277
800 : 0.9981163463716863
900 : 0.9991402420956556
大概300次以内都出结果了
"""
for i in range(300):
try:
r = remote("localhost", 10011)
# r = process(['python3', 'main.py'])
for i in range(15):
r.sendlineafter(b":", b"1")
r.recvuntil(b"!")
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()
print(flag)
break
else:
r.close()
except EOFError:
pass

View File

@@ -167,9 +167,9 @@ from pwn import *
#context.log_level = 'debug'
r = process(['python3', 'main_local.py'])
#r = remote("localhost", "10011")
#r = remote("localhost", "10010")
for i in range(1):
for i in range(50):
msg = ''
# 逐个发送问题并接收答案
for j in range(15):

View File

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

View File

@@ -0,0 +1 @@
flag = b'0xFA{you_Are_kinG_of_3G!!!}'

View File

@@ -1,10 +1,8 @@
from random import choice as c
from random import randint, shuffle
from random import shuffle
import socketserver
import signal
import string
import random
import os
from flag import flag
class Task(socketserver.BaseRequestHandler):
def _recvall(self):
@@ -90,7 +88,7 @@ class ForkedServer(socketserver.ForkingMixIn, socketserver.TCPServer):
if __name__ == "__main__":
flag = bytes(os.getenv("FLAG"),"utf-8") # type: ignore
#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