{ "info": { "author": "Maxim Kochukov", "author_email": "kochukov.ma@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Security", "Topic :: Security :: Cryptography" ], "description": "# randcrack \u2013 Python random module cracker / predictor\n\n[![Build Status](https://travis-ci.org/tna0y/Python-random-module-cracker.svg?branch=master)](https://travis-ci.org/tna0y/Python-random-module-cracker)\n![PyPI](https://img.shields.io/pypi/v/randcrack.svg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/randcrack.svg)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/randcrack.svg)\n\nThis script is able to predict python's `random` module random generated values.\n\nScript was tested against **Python 3.5.2**, **3.6.2.** and **3.7.0.** Should work against other versions of Python as well, since the generator is pretty much the same in **2.7.12**. Enjoy!\n\n## Installation\nTo install randcrack, simply:\n\n```bash\n$ pip install randcrack\n```\n\n## How it works\nThe generator is based upon *Mersenne Twister*, which is able to generate numbers with excellent statistical properties(indistinguishable from truly random). However, this generator was not designed to be cryptographycally secure. You should NEVER use in critical applications as a PRNG for your crypto scheme.\nYou can learn more about this generator [on Wikipedia](https://en.wikipedia.org/wiki/Mersenne_Twister).\n\nThis cracker works as the following way. It obtains first 624 32 bit numbers from the generator and obtains the most likely state of Mersenne Twister matrix, which is the internal state. From this point generator should be synchronized with the cracker.\n\n## How to use\nIt is **important to feed cracker exactly 32-bit integers** generated by the generator due to the fact that they will be generated anyway, but dropped if you don't request for them.\nAs well, you must feed the cracker exactly after new seed is presented, or after 624*32 bits are generated since every 624 32-bit numbers generator shifts it's state and cracker is designed to be fed from the begining of some state.\n\n#### Implemented methods\n\nCracker has one method for feeding: `submit(n)`. After submitting 624 integers it won't take any more and will be ready for predicting new numbers.\n\nCracker can predict new numbers with following methods, which work exactly the same as their siblings from the `random` module but without `predict_` prefix. These are: `predict_getrandbits`, `predict_randbelow`, `predict_randrange`, `predict_randint` and `predict_choice`\n\n**Note:** Cracker does not implement prediction of `random()` function since it is based on the `os.urandom` module which is based on `/dev/urandom`.\n\nHere's an example usage:\n```python\nimport random, time\nfrom randcrack import RandCrack\n\nrandom.seed(time.time())\n\nrc = RandCrack()\n\nfor i in range(624):\n\trc.submit(random.getrandbits(32))\n\t# Could be filled with random.randint(0,4294967294) or random.randrange(0,4294967294)\n\nprint(\"Random result: {}\\nCracker result: {}\"\n\t.format(random.randrange(0, 4294967295), rc.predict_randrange(0, 4294967295)))\n```\n**Output**\n```\t\nRandom result: 127160928\nCracker result: 127160928\n```\n\n## Accuracy\n\nCracker is not absolutely accurate. It is able to perform close to **100%** accurate on first **624** 32-bit generations, **~99.5%** on the first **1 000**, **~95%** on the first **10 000** and then figures drop to **~50%** accurate to generation **50 000**.", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/tna0y/Python-random-module-cracker/archive/0.1.5.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tna0y/Python-random-module-cracker", "keywords": "random,security,cryptography,cracker,encryption", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "randcrack", "package_url": "https://pypi.org/project/randcrack/", "platform": "", "project_url": "https://pypi.org/project/randcrack/", "project_urls": { "Download": "https://github.com/tna0y/Python-random-module-cracker/archive/0.1.5.tar.gz", "Homepage": "https://github.com/tna0y/Python-random-module-cracker" }, "release_url": "https://pypi.org/project/randcrack/0.1.5/", "requires_dist": null, "requires_python": "", "summary": "Predict python's random module random generated values", "version": "0.1.5" }, "last_serial": 5121224, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f3daccee2e22f587741a87cce682f38e", "sha256": "4c9504b1599816d8e9f166a1d1c4d25277e8ae067cc9133733af38bfcd2144ce" }, "downloads": -1, "filename": "randcrack-0.1.tar.gz", "has_sig": false, "md5_digest": "f3daccee2e22f587741a87cce682f38e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3228, "upload_time": "2019-04-09T21:36:34", "url": "https://files.pythonhosted.org/packages/12/39/9c9c6632cc3de117e89421206b5c34ebd932cc5b1526fb52223ac81dce3d/randcrack-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "4f560e7a015cc5748858ce2bc596e871", "sha256": "9166b98834eb55e1ec2e65ab920664b946b8e32bc39f0662c74c630479fbac4d" }, "downloads": -1, "filename": "randcrack-0.1.1.tar.gz", "has_sig": false, "md5_digest": "4f560e7a015cc5748858ce2bc596e871", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3216, "upload_time": "2019-04-09T21:40:12", "url": "https://files.pythonhosted.org/packages/df/3d/42e6bbb9b46161949bcc09aebc681a0e031edebf61d3e604dadee78480f6/randcrack-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "691191e81133d111f7efafb517883ce3", "sha256": "445879493b155bbd19df8d16ee3b081136031e80eb5b9b57442c64e82f7362f8" }, "downloads": -1, "filename": "randcrack-0.1.2.tar.gz", "has_sig": false, "md5_digest": "691191e81133d111f7efafb517883ce3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4596, "upload_time": "2019-04-09T22:36:48", "url": "https://files.pythonhosted.org/packages/df/40/8f7b0e00655a0fe073308109d7c248b0b879cf6313474884f53ae3a45740/randcrack-0.1.2.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "afa748ff3ac0dea5063cd34c25f5230c", "sha256": "01d1cd5170c4edbd7fd1b84e9097c46ebc1dc67d71f6112d9a1245d6a5023aa9" }, "downloads": -1, "filename": "randcrack-0.1.5.tar.gz", "has_sig": false, "md5_digest": "afa748ff3ac0dea5063cd34c25f5230c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5492, "upload_time": "2019-04-09T22:52:41", "url": "https://files.pythonhosted.org/packages/b4/d9/dd40504145c8f04fa2d9fbe13b347c10bced5ad093b978a7d1967bff7c6d/randcrack-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "afa748ff3ac0dea5063cd34c25f5230c", "sha256": "01d1cd5170c4edbd7fd1b84e9097c46ebc1dc67d71f6112d9a1245d6a5023aa9" }, "downloads": -1, "filename": "randcrack-0.1.5.tar.gz", "has_sig": false, "md5_digest": "afa748ff3ac0dea5063cd34c25f5230c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5492, "upload_time": "2019-04-09T22:52:41", "url": "https://files.pythonhosted.org/packages/b4/d9/dd40504145c8f04fa2d9fbe13b347c10bced5ad093b978a7d1967bff7c6d/randcrack-0.1.5.tar.gz" } ] }