Tags: python crypto randomness
Rating:
```
from pwn import *
import random, time
nc = remote('challenges.ctfd.io', 30264)
s = round(time.time() / 100, 5) + 0.5
print(s)
s = int(s * 10 ** 5)
print(s)
rand = []
for i in range(5):
nc.sendlineafter('> ', 'r')
c = int(nc.recvline().decode().strip())
print(i + 1, c)
rand.append(c)
for i in range(s, -1, -1):
random.seed(i / 10 ** 5)
check = []
for j in range(5):
check.append(random.randint(1, 100000000))
if check == rand:
break
nc.sendlineafter('> ', 'g')
print(nc.recvline().decode().strip())
print(nc.recvline().decode().strip())
print(nc.recvline().decode().strip())
x = random.randint(1, 100000000)
nc.sendlineafter('> ', str(x))
print(nc.recvline().decode().strip())
x = random.randint(1, 100000000)
nc.sendlineafter('> ', str(x))
print(nc.recv().decode())
```
```
[x] Opening connection to challenges.ctfd.io on port 30264
[x] Opening connection to challenges.ctfd.io on port 30264: Trying 159.203.148.124
[+] Opening connection to challenges.ctfd.io on port 30264: Done
16072580.93149
1607258093149
1 13299649
2 45785466
3 84142974
4 86025849
5 92253576
Guess the next two random numbers for a flag!
Good luck!
Enter your first guess:
Wow, lucky guess... You won't be able to guess right a second time
What? You must have psychic powers... Well here's your flag:
nactf{ch000nky_turn1ps_1674973}
```
```
nactf{ch000nky_turn1ps_1674973}
```