PACTF_2018: Untwisting Fate
Category: 90 Points: Lovelace Description:
This time the lottery is harder than ever! Can you manage to untwist the cockles of fate itself? Can you see into the future? They seem to have given me a lot more information. Perhaps it’ll help?
Like the previous challenge, this one involves breaking RNG as well. However, this will be Python's
random instead of Java. In Python's
random, the Mersenne Twister PRNG is used. To break that, we have to recover the state of the internal structure before the next number. Thankfully, there are many libraries out there that help to expedite the process of arduous math. For the purpose of this challenge, we will be using the library by @eboda.
With a library, we can simply include it into our Python code,
#! /usr/bin/env python3 ## from MTRecover import MT19937Recover mtr = MT19937Recover() data = open("numbers.txt").readlines() numbers = [int(l) for l in data] r2 = mtr.go(numbers) print(r2.getrandbits(32))
and solve for our next number.
# ./solve.py 3956993139
Therefore, the flag is