SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 

python-hexdump rpm build for : openSUSE Leap 42. For other distributions click python-hexdump.

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

Content of RPM  Changelog  Provides Requires

Hmm ... It's impossible ;-) This RPM doesn't exist on any FTP server

Provides :
python-hexdump

Requires :
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
python(abi) = 2.7
rpmlib(PayloadIsLzma) <= 4.4.6-1


Content of RPM :
/usr/lib/python2.7/site-packages/hexdump-2.0-py2.7.egg-info
/usr/lib/python2.7/site-packages/hexdump.py
/usr/lib/python2.7/site-packages/hexdump.pyc
/usr/lib/python2.7/site-packages/hexfile.bin
/usr/share/doc/packages/python-hexdump
/usr/share/doc/packages/python-hexdump/README.txt

 
ICM