2025 SWPU-NSSCTF 秋季招新入门 口算题卡

这里直接就是连接到端口,然后完成100道算式题就可以获得flag了
那就写一个脚本完成这些计算

点击查看代码
from pwn import *
import re
io = remote("node4.anna.nssctf.cn",28197)
for _ in range(100):
    question = io.recvuntil("?").decode()
    match = re.search(r"What is (\d+) ([\+\-]) (\d+)", question)
    if match:
        num1, op, num2 = match.groups()
        num1, num2 = int(num1), int(num2)
        result = num1 + num2 if op == "+" else num1 - num2
        io.sendline(str(result).encode())
print(io.recvall().decode())
posted @ 2025-08-31 23:00  Rye01R  阅读(44)  评论(0)    收藏  举报