Issue 28 in dpkt: ip.src and ip.dst return gibberish values

22 views
Skip to first unread message

codesite...@google.com

unread,
Jan 26, 2010, 11:55:36 AM1/26/10
to dp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

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

codesite...@google.com

unread,
Jan 26, 2010, 12:11:41 PM1/26/10
to dp...@googlegroups.com

Comment #1 on issue 28 by brampton: ip.src and ip.dst return gibberish
values
http://code.google.com/p/dpkt/issues/detail?id=28

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 )

codesite...@google.com

unread,
Feb 3, 2010, 8:21:49 AM2/3/10
to dp...@googlegroups.com

Comment #2 on issue 28 by allisonvoll: ip.src and ip.dst return gibberish
values
http://code.google.com/p/dpkt/issues/detail?id=28

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'

codesite...@google.com

unread,
Feb 3, 2010, 9:15:12 AM2/3/10
to dp...@googlegroups.com
Updates:
Status: WontFix

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.)

codesite...@google.com

unread,
Feb 3, 2010, 6:28:06 PM2/3/10
to dp...@googlegroups.com

Comment #4 on issue 28 by alrhodes: ip.src and ip.dst return gibberish
values
http://code.google.com/p/dpkt/issues/detail?id=28

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

Reply all
Reply to author
Forward
0 new messages