-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path22.py
34 lines (25 loc) · 769 Bytes
/
22.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from mersennetwister import MT19937
from random import randint
from time import sleep, time
def get_randout():
global SEED_VAL # Only used for verification
sleep(randint(40, 1000))
seed = int(time())
SEED_VAL = seed
sleep(randint(40, 1000))
return MT19937(seed).next()
def crack(output, time_range=2000):
now = int(time())
possible_seeds = []
for seed in range(now - time_range, now + time_range):
if MT19937(seed).next() == output:
possible_seeds.append(seed)
return possible_seeds
out = get_randout()
print "PRNG Output:", out
seeds = crack(out)
print "Cracked possible seeds:", seeds
if SEED_VAL in seeds:
print "Worked!"
else:
print "Something somewhere went terribly wrong."