{ "info": { "author": "Stephen Harris", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing" ], "description": "# Py_Obfuscate\n\n[![Build Status](https://travis-ci.org/stephenharris/py_obfuscate.svg?branch=master)](https://travis-ci.org/stephenharris/py_obfuscate)\n\nA module for obfuscating a mysqldump file\n\nThis project is a partial-port of My_Obfusicate. Under the hood it mostly uses Faker for generating fake data.\n\n## Example usage\nThis package exposes a `py_obfuscate` module which contains `Obfuscator` class with a very simple inteface.\nIt's `obfuscate` method expects two streams: a read string (e.g. the mysqldump file) and write stream (e.g. the file to write the obfuscated dump to).\n\n```\nobfuscatator.obfuscate(streamIn, streamOut)\n```\n\nAs a more practical example, create the file `obfuscate.py`\n\n```\nimport sys\nimport yaml\nimport py_obfuscate\n\nconfig = yaml.safe_load(open(\"obfuscator.yaml\"))\nobfuscatator = py_obfuscate.Obfuscator(config)\n\nsrc = sys.stdin\nout = sys.stdout\n\nobfuscatator.obfuscate(src, out)\n```\n\nNow create a config file (`obfuscate.yaml`), e.g.:\n\n```\ntables:\n users:\n name:\n type: \"name\"\n email:\n type: \"email\"\n accountno:\n type: \"string\"\n chars: \"1234567890\"\n length: 10\n```\n\nYou should change this config to reflect the tables and columns you wish to obfuscate.\n\nNow you can run:\n\n```\nmysqldump -c --add-drop-table --hex-blob -u user -ppassword database | python obfuscate.py > obfuscated_dump.sql\n```\n\n**Note** that the `-c` option on mysqldump is *required* to use py_obfuscate. Additionally, the default behavior of mysqldump is to output special characters. This may cause trouble, so you can request hex-encoded blob content with `\u2013hex-blob`. If you get MySQL errors due to very long lines, try some combination of `\u2013max_allowed_packet=128M`, `\u2013single-transaction`, `\u2013skip-extended-insert`, and `\u2013quick`.\n\n## Configuration\n\nIn the above example we've used YAML as the configuration format; since you pass `py_obfuscate.Obfuscator` a config object (dictionary) you can\nuse any format you wish, so long as parses into the same structure. The basic structure is:\n\n```\nlocale: \ntables:\n :\n truncate: \n :\n type: \n : \n```\n\nTables or columns which are ommitted from the config are ignored. Currently no warning is given.\n\n### Locale\n* **type:** string\n* **default:** `\"en_GB\"`\n\nThis is the locale string passed to Faker. \n\n### Truncate\n\nSetting `truncate: true` for a table will remove the insert from the mysqldump.\n\n### Types\n\nThese are the following types supported:\n\n#### string \n\nOptions:\n* `chars` (string) The character list to choose from (defaults `\"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_+-=[{]}/?|!@#$%^&*()``~\"`)\n* `length` (integer) The length of the string (defaults `10`)\n\n#### fixed \n\nOptions:\n* `value` (string|array) Replace column entries with this value or one of the values in the specified array (defaults `\"\"`)\n\n#### integer \n\nOptions:\n* `min` (string) Replace column entries with a random integer greater than or equal to this value (defaults `0`)\n* `max` (string) Replace column entries with a random integer less than or equal to this value (defaults `100`)\n\n#### email\n\n#### name\n\n#### first_name\n\n#### last_name\n\n#### username\n\n#### address\n\n#### street_address\n\n#### secondary_address\n\n#### city\n\n#### postcode\n\n#### company\n\n#### ip\n\n#### url\n\n#### sortcode\n\n#### bank_account\n\n#### mobile\n\n#### uk_landline\n\n#### null\n\n\n## Unit testes\n\n python -m unittest discover -s py_obfuscate\n\n\n## License\n\nThis work is provided under the MIT License. See the included LICENSE file.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stephenharris/py_obfuscate", "keywords": "obfuscate mysqldump mysql", "license": "", "maintainer": "", "maintainer_email": "", "name": "py-obfuscate", "package_url": "https://pypi.org/project/py-obfuscate/", "platform": "", "project_url": "https://pypi.org/project/py-obfuscate/", "project_urls": { "Homepage": "https://github.com/stephenharris/py_obfuscate" }, "release_url": "https://pypi.org/project/py-obfuscate/0.1.6/", "requires_dist": [ "faker" ], "requires_python": "", "summary": "A module for obfuscating a mysqldump file", "version": "0.1.6" }, "last_serial": 4458896, "releases": { "0.1.6": [ { "comment_text": "", "digests": { "md5": "0b2b5a260f6479b3417441dd66abb197", "sha256": "99ade377b602e977781468e9eb979bdb35d84e4c58a91f05aca9a18eadf43e4b" }, "downloads": -1, "filename": "py_obfuscate-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "0b2b5a260f6479b3417441dd66abb197", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10327, "upload_time": "2018-11-06T21:10:55", "url": "https://files.pythonhosted.org/packages/7e/f7/5bb147ca9e5242bec4cfa7cb9212a849b06e241304f68b92df8a075f5848/py_obfuscate-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7253bb802d7e043ab563df5096d080e7", "sha256": "7fb008498f16d80fe793ad96525855732614d09c0378abbee1bfe6b2551b96b7" }, "downloads": -1, "filename": "py_obfuscate-0.1.6.tar.gz", "has_sig": false, "md5_digest": "7253bb802d7e043ab563df5096d080e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9815, "upload_time": "2018-11-06T21:10:57", "url": "https://files.pythonhosted.org/packages/46/38/979afc68fffdcb5a96f02032ccf24946bf0691042d687386fef20dfacf41/py_obfuscate-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0b2b5a260f6479b3417441dd66abb197", "sha256": "99ade377b602e977781468e9eb979bdb35d84e4c58a91f05aca9a18eadf43e4b" }, "downloads": -1, "filename": "py_obfuscate-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "0b2b5a260f6479b3417441dd66abb197", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10327, "upload_time": "2018-11-06T21:10:55", "url": "https://files.pythonhosted.org/packages/7e/f7/5bb147ca9e5242bec4cfa7cb9212a849b06e241304f68b92df8a075f5848/py_obfuscate-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7253bb802d7e043ab563df5096d080e7", "sha256": "7fb008498f16d80fe793ad96525855732614d09c0378abbee1bfe6b2551b96b7" }, "downloads": -1, "filename": "py_obfuscate-0.1.6.tar.gz", "has_sig": false, "md5_digest": "7253bb802d7e043ab563df5096d080e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9815, "upload_time": "2018-11-06T21:10:57", "url": "https://files.pythonhosted.org/packages/46/38/979afc68fffdcb5a96f02032ccf24946bf0691042d687386fef20dfacf41/py_obfuscate-0.1.6.tar.gz" } ] }