PitchHut
Log in / Sign up
untwister
7 views
Revealing the secrets of your PRNGs with efficiency.
Pitch

Untwister is a powerful multi-threaded tool designed for recovering seeds from popular pseudo-random number generators (PRNGs). Supporting algorithms like glibc's rand and Mersenne Twister, it allows you to analyze and retrieve seed values from observed outputs effectively. With versatile options for brute forcing and threading, Untwister optimizes your exploration of random number dynamics.

Description

Untwister is a powerful multi-threaded seed recovery tool specifically designed for various popular Pseudorandom Number Generators (PRNGs). If you’re working with Glibc's rand(), Mersenne Twister (MT19937), or even the PRNGs utilized in PHP, Ruby, and Java, this tool provides you with the capability to recover PRNG seeds efficiently from observed values.

Supported PRNGs

  • Glibc's rand()
  • Mersenne Twister (MT19937)
  • PHP's MT-variant (php_mt_rand)
  • Ruby's MT-variant DEFAULT::rand()
  • Java's Random() class

Usage Overview

The command-line interface of Untwister allows for flexible seed recovery with various options:

Untwister - Recover PRNG seeds from observed values.
    -i <input_file> [-d <depth>] [-r <rng_alg>] [-g <seed>] [-t <threads>]

Command-Line Options

  • -i <input_file>: Specify the path to the input file containing newline-separated 32-bit integers representing observed values.
  • -d <depth>: Set the searching depth (default is 1000). Increasing this allows deeper inspection when brute forcing, accommodating situations where the generator has been used extensively.
  • -r <rng_alg>: Choose the RNG algorithm from supported options such as glibc-rand, mt19937, php-mt_rand, ruby-rand, or java.
  • -g <seed>: Generate a test set of random numbers from a specified seed.
  • Additional flags provide further control over the brute-forcing process, thread usage, and number generation limits.

Examples

Easily crack a list of random numbers:

./untwister -i test_ints.txt

Generate random numbers from a specified seed:

./untwister -d 70 -g 1234 -r glibc-rand

Python Bindings

Untwister also offers Python bindings for seamless integration into your projects. To install the required dependencies, follow the setup instructions for your operating system, whether you’re using Ubuntu/Debian Linux or macOS.

Example Python Script

#!/usr/bin/env python
import untwister

with open('observed_ints.txt') as fp:
    sample = [int(line) for line in fp.readlines()]
    results = untwister.bruteforce(untwister.MT19937, sample, threads=4)
    print(results)  # Outputs a list of tuples

Utilize Untwister to unlock the secrets of your PRNGs and enhance your understanding of random number generation with this essential seed recovery tool.