from pwn import*from time import timefrom ctypes import CDLL# This will automatically get context arch, bits, os etcelf = context.binary =ELF('./vuln', checksec=False)# Lib-C for rand()libc =CDLL('/lib/x86_64-linux-gnu/libc.so.6')# Create process (level used to reduce noise)io =process(level='error')# Local# io = remote('fun.chall.seetf.sg', 50001) # Remoteio.sendlineafter(b':', b'crypto')# Submit nameio.sendlineafter(b'2. Do I know you?', b'1')# Guess valuelibc.srand(int(time()))# Call srand() with current time as seedguess = libc.rand()%1000000# Predict computers turnio.sendlineafter(b'Guess my favourite number!', str(guess).encode())# Submit guessio.recvlines(2)info(io.recv().decode())# Print flag