{ "info": { "author": "anatoly techtonik ", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [ "License :: Public Domain", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "What is it about?\r\n\r\n* *dump* binary to hex and *restore* it back\r\n* Linux / Windows / OS X\r\n* Python 2/3\r\n* library and command line tool\r\n\r\n\r\ncommand line\r\n============\r\nThere are three ways to execute hexdump.py from command line::\r\n\r\n $ python hexdump.py\r\n $ python hexdump-3.2.zip\r\n\r\n # after installing with `pip install hexdump`\r\n $ python -m hexdump\r\n\r\nDump binary data in hex form::\r\n\r\n $ python -m hexdump binary.dat\r\n 0000000000: 00 00 00 5B 68 65 78 64 75 6D 70 5D 00 00 00 00 ...[hexdump]....\r\n 0000000010: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ..\"3DUfw........\r\n\r\nRestore binary from a saved hex dump::\r\n\r\n $ python -m hexdump --restore hexdump.txt > binary.dat\r\n\r\n\r\nbasic API\r\n=========\r\ndump(binary, size=2, sep=' ')\r\n\r\n Convert binary data (bytes in Python 3 and\r\n str in Python 2) to string like '00 DE AD BE EF'.\r\n `size` argument specifies length of text chunks\r\n and `sep` sets chunk separator.\r\n\r\ndehex(hextext)\r\n\r\n Helper to convert from hex string to binary data\r\n stripping whitespaces from `hextext` if necessary.\r\n\r\n\r\nadvanced API: write full dumps\r\n==============================\r\n\r\nPython 2::\r\n\r\n >>> hexdump('\\x00'*16)\r\n 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\r\n\r\nPython 3::\r\n\r\n >>> hexdump('\\x00'*16)\r\n ...\r\n TypeError: Abstract unicode data (expected bytes)\r\n >>> hexdump.hexdump(b'\\x00'*16)\r\n 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\r\n \r\nPython 3 string is a sequence of indexes in abstract unicode\r\ntable. Each index points to a symbol, which doesn't specify\r\nits binary value. To convert symbol to binary data, you need\r\nto lookup binary a value for in in the encoding.\r\n\r\nHere is how the same Russian text looks when transformed from\r\nabstract unicode integers of Python 3 to bytes in Windows-1251\r\nencoding and to bytes in UTF-8.\r\n\r\n >>> message = '\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f'\r\n >>> hexdump(message.encode('windows-1251'))\r\n 00000000: E8 ED F2 E5 F0 F4 E5 F0 E5 ED F6 E8 FF .............\r\n >>> hexdump(message.encode('utf-8'))\r\n 00000000: D0 B8 D0 BD D1 82 D0 B5 D1 80 D1 84 D0 B5 D1 80 ................\r\n 00000010: D0 B5 D0 BD D1 86 D0 B8 D1 8F ..........\r\n\r\n\r\nadvanced API: restore binary data from different hexdump formats\r\n================================================================\r\n\r\nPython 2::\r\n\r\n >>> res = restore(\r\n ... '0010: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ..\"3DUfw........')\r\n >>> res\r\n '\\x00\\x11\"3DUfw\\x88\\x99\\xaa\\xbb\\xcc\\xdd\\xee\\xff'\r\n >>> type(res)\r\n \r\n\r\nPython 3::\r\n\r\n >>> res = restore(\r\n ... '0010: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ..\"3DUfw........')\r\n >>> res\r\n b'\\x00\\x11\"3DUfw\\x88\\x99\\xaa\\xbb\\xcc\\xdd\\xee\\xff'\r\n >>> type(res)\r\n \r\n\r\n\r\nrun self-tests\r\n==============\r\nManually::\r\n\r\n $ hexdump.py --test output.txt\r\n $ diff -u3 hextest.txt output.txt\r\n\r\nAutomatically with `tox`::\r\n\r\n $ tox\r\n\r\n\r\nquestions\r\n=========\r\n| Q: Why creating another module when there is binascii already?\r\n| A: ``binascii.unhexlify()`` chokes on whitespaces and linefeeds.\r\n| ``hexdump.dehex()`` doesn't have this problem.\r\n\r\nIf you have other questions, feel free to open an issue\r\nat https://bitbucket.org/techtonik/hexdump/\r\n\r\n\r\nChangeLog\r\n=========\r\n3.3 (2015-01-22)\r\n * accept input from sys.stdin if \"-\" is specified\r\n for both dump and restore (issue #1)\r\n * new normalize_py() helper to set sys.stdout to\r\n binary mode on Windows\r\n\r\n3.2 (2015-07-02)\r\n * hexdump is now packaged as .zip on all platforms\r\n (on Linux created archive was tar.gz)\r\n * .zip is executable! try `python hexdump-3.2.zip`\r\n * dump() now accepts configurable separator, patch\r\n by Ian Land (PR #3)\r\n\r\n3.1 (2014-10-20)\r\n * implemented workaround against mysterious coding\r\n issue with Python 3 (see revision 51302cf)\r\n * fix Python 3 installs for systems where UTF-8 is\r\n not default (Windows), thanks to George Schizas\r\n (the problem was caused by reading of README.txt)\r\n\r\n3.0 (2014-09-07)\r\n * remove unused int2byte() helper\r\n * add dehex(text) helper to convert hex string\r\n to binary data\r\n * add 'size' argument to dump() helper to specify\r\n length of chunks\r\n\r\n2.0 (2014-02-02)\r\n * add --restore option to command line mode to get\r\n binary data back from hex dump\r\n * support saving test output with `--test logfile`\r\n * restore() from hex strings without spaces\r\n * restore() now raises TypeError if input data is\r\n not string\r\n * hexdump() and dumpgen() now don't return unicode\r\n strings in Python 2.x when generator is requested\r\n\r\n1.0 (2013-12-30)\r\n * length of address is reduced from 10 to 8\r\n * hexdump() got new 'result' keyword argument, it\r\n can be either 'print', 'generator' or 'return'\r\n * actual dumping logic is now in new dumpgen()\r\n generator function\r\n * new dump(binary) function that takes binary data\r\n and returns string like \"66 6F 72 6D 61 74\"\r\n * new genchunks(mixed, size) function that chunks\r\n both sequences and file like objects\r\n\r\n0.5 (2013-06-10)\r\n * hexdump is now also a command line utility (no\r\n restore yet)\r\n\r\n0.4 (2013-06-09)\r\n * fix installation with Python 3 for non English\r\n versions of Windows, thanks to George Schizas\r\n\r\n0.3 (2013-04-29)\r\n * fully Python 3 compatible\r\n\r\n0.2 (2013-04-28)\r\n * restore() to recover binary data from a hex dump in\r\n native, Far Manager and Scapy text formats (others\r\n might work as well)\r\n * restore() is Python 3 compatible\r\n\r\n0.1 (2013-04-28)\r\n * working hexdump() function for Python 2\r\n\r\n\r\nRelease checklist\r\n=================\r\n\r\n| [ ] run tests \r\n| [ ] update version in hexdump.py \r\n| [ ] update ChangeLog in README.txt from hexdump.py \r\n| [ ] python setup.py register sdist upload \r\n\r\n\r\nLicense\r\n=======\r\nPublic Domain\r\n\r\n\r\nCredits\r\n=======\r\n| anatoly techtonik \r\n| George Schizas \r\n| Ian Land", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/techtonik/hexdump/", "keywords": "", "license": "Public Domain", "maintainer": "", "maintainer_email": "", "name": "hexdump", "package_url": "https://pypi.org/project/hexdump/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/hexdump/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.org/techtonik/hexdump/" }, "release_url": "https://pypi.org/project/hexdump/3.3/", "requires_dist": null, "requires_python": null, "summary": "dump binary data to hex format and restore from there", "version": "3.3" }, "last_serial": 1917355, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "f31a80d46976a24a31b54d0706feac06", "sha256": "c7857830c637e31dbf5337985827318e586ea91d8113f61d73d0b6af3831f51e" }, "downloads": -1, "filename": "hexdump-0.3.zip", "has_sig": false, "md5_digest": "f31a80d46976a24a31b54d0706feac06", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4331, "upload_time": "2013-04-28T21:44:17", "url": "https://files.pythonhosted.org/packages/e1/66/1cbba37f69b51915a741ad8c81eb8df453a86384aaa3491d1e5d3a57a149/hexdump-0.3.zip" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "717906c11858f262326d71796694c26d", "sha256": "289845bb3df841d9517627177bd4250a8641d58cafe7927eb53956e9c3ad093c" }, "downloads": -1, "filename": "hexdump-0.4.tar.gz", "has_sig": false, "md5_digest": "717906c11858f262326d71796694c26d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3660, "upload_time": "2013-06-08T21:53:40", "url": "https://files.pythonhosted.org/packages/3b/37/7b8ed56babba95befcba796b80315abefe181c6cbcfb3e90b08de2acc526/hexdump-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "19b67c288cc89db1d71544191e99e2f4", "sha256": "b759ee4eda51251dbce7284339237c8970c7a66e152728700a059511de0f9c7d" }, "downloads": -1, "filename": "hexdump-0.5.tar.gz", "has_sig": false, "md5_digest": "19b67c288cc89db1d71544191e99e2f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4363, "upload_time": "2013-06-10T19:43:09", "url": "https://files.pythonhosted.org/packages/65/39/b13f84a314f3327adf7765fc8adbdbf09eb7023be10fcb3798dc6c323aa1/hexdump-0.5.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "4c00635bb3b32bfbcc98d62b45e89be0", "sha256": "fad4ce7f53cb40bea58c24fca32dd628792bb8c3257a79b16478b9a9370d616c" }, "downloads": -1, "filename": "hexdump-1.0.zip", "has_sig": false, "md5_digest": "4c00635bb3b32bfbcc98d62b45e89be0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6733, "upload_time": "2013-12-30T16:42:29", "url": "https://files.pythonhosted.org/packages/1a/56/0e258ab6eb55d3f6b5f3e349695686253094a93f565cb4922d07b2874eef/hexdump-1.0.zip" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "34955c24a8d5b8992d68ff87d193e77e", "sha256": "28155f11f14173d37088a8307a2058893f8d8ba0e55885eb16f221b284954218" }, "downloads": -1, "filename": "hexdump-2.0.zip", "has_sig": false, "md5_digest": "34955c24a8d5b8992d68ff87d193e77e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8599, "upload_time": "2014-02-02T11:17:20", "url": "https://files.pythonhosted.org/packages/f6/c8/b7843e7e7ea15bfbeff397b1cd0c78ce0686345cbe9f5b97dd877b3e9d11/hexdump-2.0.zip" } ], "3.0": [ { "comment_text": "", "digests": { "md5": "acf2a809e0af462cd3c9704d31eccf29", "sha256": "d21a64f58fc5a5b0dc5bf856421c84a5aa741ce96514db36a561597df5fcfe6b" }, "downloads": -1, "filename": "hexdump-3.0.zip", "has_sig": false, "md5_digest": "acf2a809e0af462cd3c9704d31eccf29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9970, "upload_time": "2014-09-07T19:27:06", "url": "https://files.pythonhosted.org/packages/70/be/48679e31853b8d69914b60d909c6c0cb20737163eddcc16ff283fa44bf82/hexdump-3.0.zip" } ], "3.1": [ { "comment_text": "", "digests": { "md5": "4616b91706c0f172844fdb23c461c4e3", "sha256": "f917a3a0ebd9130ee303f7d84d2ef1b0aeeff094c71f28b00c8981355812bc65" }, "downloads": -1, "filename": "hexdump-3.1.zip", "has_sig": false, "md5_digest": "4616b91706c0f172844fdb23c461c4e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10417, "upload_time": "2014-10-20T20:29:13", "url": "https://files.pythonhosted.org/packages/03/f4/bbe86ea3e3f901ec04171b987aa6c5eb8110e4a1f4068120042bb57a7b6f/hexdump-3.1.zip" } ], "3.2": [ { "comment_text": "", "digests": { "md5": "ec61fc2d8ff11d3ab096c0249cf52db9", "sha256": "b6d403a6961f03db409e7fc4234bee0a88ffe86e2e17221a305e00733c8601cb" }, "downloads": -1, "filename": "hexdump-3.2.zip", "has_sig": false, "md5_digest": "ec61fc2d8ff11d3ab096c0249cf52db9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11991, "upload_time": "2015-02-07T12:15:20", "url": "https://files.pythonhosted.org/packages/0b/a8/39865177ff9589f40c58483b5c1acd0d9dcf880ba03448d58057b2a04484/hexdump-3.2.zip" } ], "3.3": [ { "comment_text": "", "digests": { "md5": "0bf05d40e1af5abea6939215dfcb9105", "sha256": "d781a43b0c16ace3f9366aade73e8ad3a7bd5137d58f0b45ab2d3f54876f20db" }, "downloads": -1, "filename": "hexdump-3.3.zip", "has_sig": false, "md5_digest": "0bf05d40e1af5abea6939215dfcb9105", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12658, "upload_time": "2016-01-22T14:40:19", "url": "https://files.pythonhosted.org/packages/55/b3/279b1d57fa3681725d0db8820405cdcb4e62a9239c205e4ceac4391c78e4/hexdump-3.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0bf05d40e1af5abea6939215dfcb9105", "sha256": "d781a43b0c16ace3f9366aade73e8ad3a7bd5137d58f0b45ab2d3f54876f20db" }, "downloads": -1, "filename": "hexdump-3.3.zip", "has_sig": false, "md5_digest": "0bf05d40e1af5abea6939215dfcb9105", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12658, "upload_time": "2016-01-22T14:40:19", "url": "https://files.pythonhosted.org/packages/55/b3/279b1d57fa3681725d0db8820405cdcb4e62a9239c205e4ceac4391c78e4/hexdump-3.3.zip" } ] }