Ask Your Question

I want to get the IP addresses list in the response returned by bitcoin.addr command

asked 2019-09-30 02:54:47 +0000

Sajan gravatar image

I would like to get the IP addresses of the peer list maintained by a bitcoin node. For this, I built the 'version', 'verack' and 'getaddr' messages using socket programming. I was able to get the 'addr' message from the corresponding bitcoin node. Now, further I would like to parse that addr response and get the list of IP addresses contained in it. I have tried using the bitcoin protocol documentation provided by the pyshark library. However, when I execute, pkt.bitcoin.addr.address or pkt.bitcoin.address.address, I get an Attribute error saying no such attribute exist. How can I parse such addr response for my further analysis?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-30 07:52:05 +0000

grahamb gravatar image

Both of those fields are listed in the field reference for the bitcoin dissector, so if there is a packet in the capture that contains those fields and the packet is correctly dissected as bitcoin then the fields should be present.

What do you see if you open the capture file in Wireshark?

edit flag offensive delete link more


I found the issue, actually in the website, it mentions to use bitcoin.address.address for each packet sniffed. However, I found that it is actually supposed to be bitcoin.address_address

Below is the snapshot of the image I found!

Thank you for your efforts and concern

Sajan gravatar imageSajan ( 2019-09-30 08:36:13 +0000 )edit

That must be either an artefact of the pyshark wrapper, or tshark XML output (which is apparently what pyshark uses) because the field is defined in the bitcoin dissector as noted in the field reference (which is autogenerated), i.e. "bitcoin.address.address" and has been since 2013. Something to maybe take note of when using pyshark.

grahamb gravatar imagegrahamb ( 2019-09-30 09:06:12 +0000 )edit

thank you!

Sajan gravatar imageSajan ( 2019-09-30 09:09:16 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2019-09-30 02:54:47 +0000

Seen: 333 times

Last updated: Sep 30 '19