{ "info": { "author": "Silvan Wegmann", "author_email": "binstruct@narf.ch", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries" ], "description": "==================\nBinStruct Tutorial\n==================\n\nThe binstruct library allows you to access binary data using a predefined\nstructure. The binary data can be provided in any form that allows an indexed\naccess to single bytes. This could for example be an mmaped file. The data\nstructure itself is defined in way similar to Django database table definitions\nby declaring a new class with its fields.\n\n.. image:: https://travis-ci.org/Jokymon/binstruct.svg?branch=master\n :target: https://travis-ci.org/Jokymon/binstruct\n :alt: Current build status\n\n.. image:: https://coveralls.io/repos/Jokymon/binstruct/badge.png?branch=master\n :target: https://coveralls.io/r/Jokymon/binstruct?branch=master\n :alt: Test coverage\n\n.. image:: https://pypip.in/version/binstruct/badge.svg\n :target: https://pypi.python.org/pypi/binstruct/\n :alt: PyPI version\n\n.. image:: https://pypip.in/py_versions/binstruct/badge.svg\n :target: https://pypi.python.org/pypi/binstruct/\n :alt: Supported Python versions\n\n.. image:: https://pypip.in/egg/binstruct/badge.svg\n :target: https://pypi.python.org/pypi/binstruct/\n :alt: Egg Status\n\n.. image:: https://pypip.in/wheel/binstruct/badge.svg\n :target: https://pypi.python.org/pypi/binstruct/\n :alt: Wheel Status\n\n.. image:: https://pypip.in/license/binstruct/badge.svg\n :target: https://pypi.python.org/pypi/binstruct/\n :alt: License\n\nSimple Example\n--------------\n\nFirst you have to define the structure which you want to use to access your\nbinary data. This is done by specifying all desired fields with their types and\ntheir position inside a new class. As an example let's take the first of the\nELF header which in C would look like this\n\n.. code-block:: c\n\n #define EI_NIDENT 16\n\n typedef struct {\n unsigned char e_ident[EI_NIDENT];\n uint16_t e_type;\n uint16_t e_machine;\n uint32_t e_version;\n // rest of the fields omitted for simplicity\n } ElfN_Ehdr;\n\nUsing binstruct you now declare the following Python class\n\n.. code-block:: python\n\n from binstruct import *\n\n class ElfN_Ehdr(StructTemplate):\n e_ident = RawField(0, 16)\n e_type = UInt16Field(16)\n e_machine = UInt16Field(18)\n e_version = UInt32Field(20)\n\nNote that you have to specify the offset of the fields even though it would be\npossible to derive that from the size of the previous fields. I opted for this\nsolution because it makes the implementation easier and because it allows for\neasier skipping of irrelevant or reserved fields.\n\nNow we can create an instance of this class by providing the constructor an\nindexable data structure and an offset. The indexable data structure is any\nPython object representing binary data to which you want to have \"structured\naccess\". The offset allows you to place the structure at any place inside the\nindexable data structure.\n\nFor this example lets just use a simple list for the binary data\n\n.. code-block:: python\n\n binary_data = 24 * [0]\n header = ElfN_Ehdr(binary_data, 0)\n\nNow you can simply read and write any of the fields\n\n.. code-block:: python\n\n header.e_type = 0x0\n header.e_ident[0] = 0x7f\n header.e_ident[1] = ord('E')\n header.e_ident[2] = ord('L')\n header.e_ident[3] = ord('F')\n\n print(header.e_type)\n print(header.e_ident[1])\n\nThe current implementation provides signed and unsigned fields for 8-bit,\n16-bit and 32-bit integers, strings, raw data fields and even nested\nstructures. For some ideas of how to use them, also checkout the unit tests.\n\nContributing\n------------\n\nThe library is fully standalone and only requires py.test to run the unit\ntests. To contribute any changes simply clone the project on GitHub:\nhttps://github.com/Jokymon/binstruct, push your changes to your own GitHub\nproject and send a pull request. For any changes please make sure you have good\nunit tests.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Jokymon/binstruct", "keywords": null, "license": "GNU GPL v3", "maintainer": null, "maintainer_email": null, "name": "binstruct", "package_url": "https://pypi.org/project/binstruct/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/binstruct/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Jokymon/binstruct" }, "release_url": "https://pypi.org/project/binstruct/1.0.1/", "requires_dist": null, "requires_python": null, "summary": "Library for read/write access of binary data via structures", "version": "1.0.1" }, "last_serial": 1445049, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "4b9639ef92b5a70d881d79097b624135", "sha256": "1e17e609eb9e69678d34dd67285315f796752e9ec8d2728435a409bc8e3c1196" }, "downloads": -1, "filename": "binstruct-1.0.0-py2.7.egg", "has_sig": false, "md5_digest": "4b9639ef92b5a70d881d79097b624135", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 2616, "upload_time": "2014-09-09T20:01:59", "url": "https://files.pythonhosted.org/packages/61/8f/67533d240fdda1a8aa09d0d3815f73b34571714a96f875473b1bc1dd91d4/binstruct-1.0.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "a2c0bd94141995ef8e6aafc8a9c63c8a", "sha256": "46ad60f29db67bdb5a66263571f1cad713e647a03e6244f804fee269b37efb5c" }, "downloads": -1, "filename": "binstruct-1.0.0-py3.4.egg", "has_sig": false, "md5_digest": "a2c0bd94141995ef8e6aafc8a9c63c8a", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 2616, "upload_time": "2014-09-09T20:01:45", "url": "https://files.pythonhosted.org/packages/b7/b8/3143bd3f81b06971d95a68d1fa865dcd1579aa3f337fed414caa1f45341c/binstruct-1.0.0-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "c46efc4fbdc45910295aa3a30e73f44b", "sha256": "aec3322af27b7bd04baa86da9a643cfbcc88be536cc283424830b05bd7301ea6" }, "downloads": -1, "filename": "binstruct-1.0.0.win32-py2.7.exe", "has_sig": false, "md5_digest": "c46efc4fbdc45910295aa3a30e73f44b", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 203455, "upload_time": "2014-09-09T20:01:49", "url": "https://files.pythonhosted.org/packages/fb/dc/279fdba4df00c63e46a0df236dc5dd889191fbd6d69d7e0bf19dc523521a/binstruct-1.0.0.win32-py2.7.exe" }, { "comment_text": "", "digests": { "md5": "6059570323a7f6e6c7e2b01301c070e9", "sha256": "fd6d2d398260fee7ffe376318f129ec29c6abd555ec7d8f75085062e8d50997b" }, "downloads": -1, "filename": "binstruct-1.0.0.win32-py3.4.exe", "has_sig": false, "md5_digest": "6059570323a7f6e6c7e2b01301c070e9", "packagetype": "bdist_wininst", "python_version": "3.4", "requires_python": null, "size": 198335, "upload_time": "2014-09-09T20:01:30", "url": "https://files.pythonhosted.org/packages/1c/76/5d013e2f43744f3c43c7d7ce8816af9a0e4b939535915edfe25898b1f613/binstruct-1.0.0.win32-py3.4.exe" }, { "comment_text": "", "digests": { "md5": "8dcdcd0370ac169b57f037c6ebdc7218", "sha256": "0931fd74013de7cfd4f3f2ff331a094e5e2bfdee8a77258d5424ae5390764e0e" }, "downloads": -1, "filename": "binstruct-1.0.0.win-amd64-py2.7.exe", "has_sig": false, "md5_digest": "8dcdcd0370ac169b57f037c6ebdc7218", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 231103, "upload_time": "2014-09-09T20:01:54", "url": "https://files.pythonhosted.org/packages/39/ac/c68231e716947587f1750f801379646716ed763b1153662bc5cb8934cb4c/binstruct-1.0.0.win-amd64-py2.7.exe" }, { "comment_text": "", "digests": { "md5": "b269a4e8508b7dcf9fec6dfa35f29dda", "sha256": "c093447f70fd5b447f64d8f509bccc2854af2f9b472d97c39e70b23b50a4acdd" }, "downloads": -1, "filename": "binstruct-1.0.0.win-amd64-py3.4.exe", "has_sig": false, "md5_digest": "b269a4e8508b7dcf9fec6dfa35f29dda", "packagetype": "bdist_wininst", "python_version": "3.4", "requires_python": null, "size": 229567, "upload_time": "2014-09-09T20:01:36", "url": "https://files.pythonhosted.org/packages/ce/5d/555046eb4d40988b6839a300160f09e939dcf9357e363c621db382e2274b/binstruct-1.0.0.win-amd64-py3.4.exe" }, { "comment_text": "", "digests": { "md5": "d68e65adb952e4cdb0f46749507768ac", "sha256": "656443ac0269d56d811695d4c70177a0df9e4e0cca8cedb0def87fa7a8e7fb88" }, "downloads": -1, "filename": "binstruct-1.0.0.zip", "has_sig": false, "md5_digest": "d68e65adb952e4cdb0f46749507768ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23160, "upload_time": "2014-09-09T20:01:41", "url": "https://files.pythonhosted.org/packages/32/83/2fd44a375093bb692706581b1bd11d1d8c0f34b86d8fa8d77326c7c35941/binstruct-1.0.0.zip" } ], "1.0.0a1": [ { "comment_text": "", "digests": { "md5": "e6b3459407e8e8e3a2cc472397134e7f", "sha256": "b9876a500a4c824d944b9d3ca1afdc740ae5a4cc6c878d4b56846efee5a0de11" }, "downloads": -1, "filename": "binstruct-1.0.0a1.win32.exe", "has_sig": false, "md5_digest": "e6b3459407e8e8e3a2cc472397134e7f", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 197845, "upload_time": "2014-03-10T21:11:18", "url": "https://files.pythonhosted.org/packages/fc/e4/07926ffe7defe446972fceceb8567c37d2d264aad612eb9e688f3fd5d611/binstruct-1.0.0a1.win32.exe" }, { "comment_text": "", "digests": { "md5": "bd7c8473fad087e6d2c59db1355e0afc", "sha256": "30445a674553c259989349a08a6251d84f89644765798eb613fe8d754bbb0b55" }, "downloads": -1, "filename": "binstruct-1.0.0a1.zip", "has_sig": false, "md5_digest": "bd7c8473fad087e6d2c59db1355e0afc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18577, "upload_time": "2014-03-10T21:11:15", "url": "https://files.pythonhosted.org/packages/e8/66/75aba8c20ff59e45de31581d68f8bee0a5f6e637e2c9e6190b19abb28b33/binstruct-1.0.0a1.zip" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "71a04fd98507e2057988895604ac8f65", "sha256": "0835032fc8f0531ffa51e19c5adea35256b318ca103cb0ce659fe32a6973bbe8" }, "downloads": -1, "filename": "binstruct-1.0.1-py2.7.egg", "has_sig": false, "md5_digest": "71a04fd98507e2057988895604ac8f65", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 7755, "upload_time": "2015-03-02T18:56:42", "url": "https://files.pythonhosted.org/packages/23/11/b7ba8aad5130ecc07a5ba79cc40615045e44a0cfe246e783b99a81e574ff/binstruct-1.0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "9f26b240934fc19920ffb1ce4b62b89a", "sha256": "1447bed53098724911ff26445495e0b12bdde1587899304fb115e8c4b833acf7" }, "downloads": -1, "filename": "binstruct-1.0.1-py3.4.egg", "has_sig": false, "md5_digest": "9f26b240934fc19920ffb1ce4b62b89a", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 8033, "upload_time": "2015-01-31T17:48:27", "url": "https://files.pythonhosted.org/packages/d6/c6/2eda60721a0622ad4952639d304441b0683acfd968c114f50b1f9d6641cf/binstruct-1.0.1-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "f1f16dadd33c20fd44e681b85dd6d531", "sha256": "0a703cfd9d5b45781b26a8db2b58f8bff04a2353d75101db9f2281522427d429" }, "downloads": -1, "filename": "binstruct-1.0.1.win32-py2.7.exe", "has_sig": false, "md5_digest": "f1f16dadd33c20fd44e681b85dd6d531", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 205523, "upload_time": "2015-03-02T18:56:13", "url": "https://files.pythonhosted.org/packages/d7/b0/ebfcfb1d95a9035161d0878b58867d77ca280f7b77981a0c3f19638d242c/binstruct-1.0.1.win32-py2.7.exe" }, { "comment_text": "", "digests": { "md5": "da9fbfab0970dfdfb950e4ac77c000f1", "sha256": "8e13d2567d51001813438ae1a86f3ff6965edac37b0ed1f65c113d346a86a98c" }, "downloads": -1, "filename": "binstruct-1.0.1.win32-py3.4.exe", "has_sig": false, "md5_digest": "da9fbfab0970dfdfb950e4ac77c000f1", "packagetype": "bdist_wininst", "python_version": "3.4", "requires_python": null, "size": 200403, "upload_time": "2015-01-31T17:48:12", "url": "https://files.pythonhosted.org/packages/d0/56/b65819d40d9da0e3ad6e175bb8cbf007297feb768e5871813bcb3a6f7822/binstruct-1.0.1.win32-py3.4.exe" }, { "comment_text": "", "digests": { "md5": "4221e9188bfbcb79fd80d7bd59682d68", "sha256": "6d803f6c6761d14ff89209d4569ba52400f5dc3be7c1507543d728caa68d6fe7" }, "downloads": -1, "filename": "binstruct-1.0.1.win-amd64-py2.7.exe", "has_sig": false, "md5_digest": "4221e9188bfbcb79fd80d7bd59682d68", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 233171, "upload_time": "2015-03-02T18:56:25", "url": "https://files.pythonhosted.org/packages/dd/ca/b7ddc567b2116d7dc2aaae496fbda94947350571986f742b09ae622d219e/binstruct-1.0.1.win-amd64-py2.7.exe" }, { "comment_text": "", "digests": { "md5": "d461c7c65c69d46296c5aa5791e06ed8", "sha256": "a9513b09f4deeaf4bb514c1ff367ff83a91eb68482cafc53e0018f45667269a4" }, "downloads": -1, "filename": "binstruct-1.0.1.win-amd64-py3.4.exe", "has_sig": false, "md5_digest": "d461c7c65c69d46296c5aa5791e06ed8", "packagetype": "bdist_wininst", "python_version": "3.4", "requires_python": null, "size": 231635, "upload_time": "2015-01-31T17:48:16", "url": "https://files.pythonhosted.org/packages/15/14/c75ee4789bcaf72e11bc12e3e06522ea0ee276b04581b18c7e5d84f08c36/binstruct-1.0.1.win-amd64-py3.4.exe" }, { "comment_text": "", "digests": { "md5": "63bc5fc709c5a6b548dbad1329d79291", "sha256": "59949c31ede3127d03436ebc753288c01c2568fc29f0704845f5609bee0870ba" }, "downloads": -1, "filename": "binstruct-1.0.1.win-py2.7.exe", "has_sig": false, "md5_digest": "63bc5fc709c5a6b548dbad1329d79291", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 205523, "upload_time": "2015-03-02T18:56:34", "url": "https://files.pythonhosted.org/packages/6d/bb/4b75a7836806509bdbf0da89e051aca389a5d8199bf7d87819cd509707ba/binstruct-1.0.1.win-py2.7.exe" }, { "comment_text": "", "digests": { "md5": "066a5f55c2f406050aead269ce064355", "sha256": "6238b637c18e5889a1977d0c9c72b14cc3ca56b4ab7f0e9d4c40cad5bfbdd056" }, "downloads": -1, "filename": "binstruct-1.0.1.zip", "has_sig": false, "md5_digest": "066a5f55c2f406050aead269ce064355", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23177, "upload_time": "2015-01-31T17:48:22", "url": "https://files.pythonhosted.org/packages/d3/66/6c6b14ae151e370879276336a8cf853be193209df51b87660705e4ec98d5/binstruct-1.0.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "71a04fd98507e2057988895604ac8f65", "sha256": "0835032fc8f0531ffa51e19c5adea35256b318ca103cb0ce659fe32a6973bbe8" }, "downloads": -1, "filename": "binstruct-1.0.1-py2.7.egg", "has_sig": false, "md5_digest": "71a04fd98507e2057988895604ac8f65", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 7755, "upload_time": "2015-03-02T18:56:42", "url": "https://files.pythonhosted.org/packages/23/11/b7ba8aad5130ecc07a5ba79cc40615045e44a0cfe246e783b99a81e574ff/binstruct-1.0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "9f26b240934fc19920ffb1ce4b62b89a", "sha256": "1447bed53098724911ff26445495e0b12bdde1587899304fb115e8c4b833acf7" }, "downloads": -1, "filename": "binstruct-1.0.1-py3.4.egg", "has_sig": false, "md5_digest": "9f26b240934fc19920ffb1ce4b62b89a", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 8033, "upload_time": "2015-01-31T17:48:27", "url": "https://files.pythonhosted.org/packages/d6/c6/2eda60721a0622ad4952639d304441b0683acfd968c114f50b1f9d6641cf/binstruct-1.0.1-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "f1f16dadd33c20fd44e681b85dd6d531", "sha256": "0a703cfd9d5b45781b26a8db2b58f8bff04a2353d75101db9f2281522427d429" }, "downloads": -1, "filename": "binstruct-1.0.1.win32-py2.7.exe", "has_sig": false, "md5_digest": "f1f16dadd33c20fd44e681b85dd6d531", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 205523, "upload_time": "2015-03-02T18:56:13", "url": "https://files.pythonhosted.org/packages/d7/b0/ebfcfb1d95a9035161d0878b58867d77ca280f7b77981a0c3f19638d242c/binstruct-1.0.1.win32-py2.7.exe" }, { "comment_text": "", "digests": { "md5": "da9fbfab0970dfdfb950e4ac77c000f1", "sha256": "8e13d2567d51001813438ae1a86f3ff6965edac37b0ed1f65c113d346a86a98c" }, "downloads": -1, "filename": "binstruct-1.0.1.win32-py3.4.exe", "has_sig": false, "md5_digest": "da9fbfab0970dfdfb950e4ac77c000f1", "packagetype": "bdist_wininst", "python_version": "3.4", "requires_python": null, "size": 200403, "upload_time": "2015-01-31T17:48:12", "url": "https://files.pythonhosted.org/packages/d0/56/b65819d40d9da0e3ad6e175bb8cbf007297feb768e5871813bcb3a6f7822/binstruct-1.0.1.win32-py3.4.exe" }, { "comment_text": "", "digests": { "md5": "4221e9188bfbcb79fd80d7bd59682d68", "sha256": "6d803f6c6761d14ff89209d4569ba52400f5dc3be7c1507543d728caa68d6fe7" }, "downloads": -1, "filename": "binstruct-1.0.1.win-amd64-py2.7.exe", "has_sig": false, "md5_digest": "4221e9188bfbcb79fd80d7bd59682d68", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 233171, "upload_time": "2015-03-02T18:56:25", "url": "https://files.pythonhosted.org/packages/dd/ca/b7ddc567b2116d7dc2aaae496fbda94947350571986f742b09ae622d219e/binstruct-1.0.1.win-amd64-py2.7.exe" }, { "comment_text": "", "digests": { "md5": "d461c7c65c69d46296c5aa5791e06ed8", "sha256": "a9513b09f4deeaf4bb514c1ff367ff83a91eb68482cafc53e0018f45667269a4" }, "downloads": -1, "filename": "binstruct-1.0.1.win-amd64-py3.4.exe", "has_sig": false, "md5_digest": "d461c7c65c69d46296c5aa5791e06ed8", "packagetype": "bdist_wininst", "python_version": "3.4", "requires_python": null, "size": 231635, "upload_time": "2015-01-31T17:48:16", "url": "https://files.pythonhosted.org/packages/15/14/c75ee4789bcaf72e11bc12e3e06522ea0ee276b04581b18c7e5d84f08c36/binstruct-1.0.1.win-amd64-py3.4.exe" }, { "comment_text": "", "digests": { "md5": "63bc5fc709c5a6b548dbad1329d79291", "sha256": "59949c31ede3127d03436ebc753288c01c2568fc29f0704845f5609bee0870ba" }, "downloads": -1, "filename": "binstruct-1.0.1.win-py2.7.exe", "has_sig": false, "md5_digest": "63bc5fc709c5a6b548dbad1329d79291", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 205523, "upload_time": "2015-03-02T18:56:34", "url": "https://files.pythonhosted.org/packages/6d/bb/4b75a7836806509bdbf0da89e051aca389a5d8199bf7d87819cd509707ba/binstruct-1.0.1.win-py2.7.exe" }, { "comment_text": "", "digests": { "md5": "066a5f55c2f406050aead269ce064355", "sha256": "6238b637c18e5889a1977d0c9c72b14cc3ca56b4ab7f0e9d4c40cad5bfbdd056" }, "downloads": -1, "filename": "binstruct-1.0.1.zip", "has_sig": false, "md5_digest": "066a5f55c2f406050aead269ce064355", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23177, "upload_time": "2015-01-31T17:48:22", "url": "https://files.pythonhosted.org/packages/d3/66/6c6b14ae151e370879276336a8cf853be193209df51b87660705e4ec98d5/binstruct-1.0.1.zip" } ] }