from pwn import *
import time

conn = remote("localhost", 3004)
time.sleep(0.1)
recv = conn.recv(1024).decode()

start = recv.index('for ') + 4
duration = recv[start:recv.index('\n', start)]
duration = duration.replace('and ', ', ').split(', ')
print(duration)

days = int(duration[0].split()[0])
hours = int(duration[1].split()[0])
minutes = int(duration[2].split()[0])
seconds = int(duration[3].split()[0])

seed = days * (24*60*60) + hours * (60*60) + minutes * 60 + seconds
p = process(['./generator', str(seed)])
numbers = p.recv(1024)

conn.send(numbers)
time.sleep(0.1)
print(conn.recv(1024).decode())