New issue 28 by till.salzgeber: ip.src and ip.dst return gibberish values
http://code.google.com/p/dpkt/issues/detail?id=28
try using ip.src or ip.dst, returns are not as expected :-/
What is the expected output? What do you see instead?
expected: 10.42.0.something
got: *$
What version of the product are you using? On what operating system?
1.6 on ubuntu
Please provide any additional information below.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
ip.src and ip.dst are stored as four raw bytes, not as printable strings.
Do the following:
import socket
...
print socket.inet_ntoa( ip.src )
You can convert the rawbyte character to int with built-in function ord,
ie:
>>> '.'.join([str(ord(c)) for c in ip.src])
Outputs something like: '10.1.0.233'
Comment #3 on issue 28 by dugsong: ip.src and ip.dst return gibberish values
http://code.google.com/p/dpkt/issues/detail?id=28
(No comment was entered for this change.)
Here is a patch for ip.py that shows the ip in readable form when you use
repr().
This issue has been brought up before.
Attachments:
ip_py.diff 995 bytes