有人可以帮我理解这段代码
clientsock.send("Welcome to Maths_Server 1.0\n")
try:
clientsock.send("Enter the first number, so I can EVALuate it:\n")
firstNum = eval(clientsock.recv(1024))
firstNum = firstNum + firstNum + ord(flag[4]) + ord(flag[8]) + ord(flag[5])
clientsock.send("Enter the second number, so I can EVALuate it:\n")
secondNum = eval(clientsock.recv(1024))
if secondNum == firstNum:
clientsock.send("The flag is: " + flag + "\n")
firstNum = 0
secondNum = 0
except:
pass
clientsock.close()
我想知道recv()的作用以及如何使if语句成为真正的
答案 0 :(得分:0)
嗯,您无法确定firstNum
值,因为它是由用户输入的,因此您在firstNum
中输入一个随机数,然后输入secondNum
您输入的firstNum
firstNum
1}},所以它的作用是eval()获取secondNum
值并将其转换为routes.php
的字符串,这将使if语句成立。希望这会成功。