Name : python-hexdump
| |
Version : 2.0
| Vendor : obs://build_opensuse_org/devel:languages:python
|
Release : 1.2
| Date : 2015-10-04 15:34:21
|
Group : Development/Languages/Python
| Source RPM : python-hexdump-2.0-1.2.src.rpm
|
Size : 0.03 MB
| |
Packager : (none)
| |
Summary : View/edit your binary with any text editor
|
Description :
Cross-platform Python 2/3 library and tool to work with hex and binary data.
01 - dump binary data string ============================
Python 2::
>>> import hexdump >>> hexdump.hexdump(\'\\x00\'*16) 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Python 3::
>>> import hexdump >>> hexdump.hexdump(\'\\x00\'*16) ... TypeError: Abstract unicode data (expected bytes) >>> hexdump.hexdump(b\'\\x00\'*16) 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Python 3 strings are arrays of abstract indexes in unicode table. Single index is an integer which takes more than one byte when stored, so you need to specify exactly how to store these bytes with encoding.
02 - restore binary data from hex dump string ==============================================
Python 2::
>>> import hexdump >>> res = hexdump.restore( ... \'0010: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ..\"3DUfw........\') >>> res \'\\x00\\x11\"3DUfw\\x88\\x99\\xaa\\xbb\\xcc\\xdd\\xee\\xff\' >>> type(res) < type \'str\'>
Python 3::
>>> import hexdump >>> res = hexdump.restore( ... \'0010: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ..\"3DUfw........\') >>> res b\'\\x00\\x11\"3DUfw\\x88\\x99\\xaa\\xbb\\xcc\\xdd\\xee\\xff\' >>> type(res) < class \'bytes\'>
03 - use as command line tool ============================= Make hex dump of binary data::
$ python hexdump.py binary.dat > hexdump.txt $ python -m hexdump binary.dat 0000000000: 00 00 00 5B 68 65 78 64 75 6D 70 5D 00 00 00 00 ...[hexdump].... 0000000010: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ..\"3DUfw........
Restore binary data::
$ python -m hexdump --restore hexdump.txt > binary.dat
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/python/openSUSE_Leap_42.1/noarch |
Hmm ... It's impossible ;-) This RPM doesn't exist on any FTP server
Provides :
python-hexdump
Requires :