[Twisted-Python] sniffing multicast traffic
ben at bbarker.co.uk
Wed Mar 10 08:18:28 EST 2010
Well that's odd...
I changed the interfaces over - used eth1 for the connection to the
network I need to sniff...
and now /sbin/ip maddr tells me I have joined 220.127.116.11 on eth0 !
Whichever interface is live, the join seems to happen on the other :-p
What could there be about my network config that is making this happen :-p
On Wed, Mar 10, 2010 at 1:03 PM, Ben Barker <ben at bbarker.co.uk> wrote:
>>> But I seem to have trouble getting them to receive anything at all.
>> That's a little vague. Does "trouble" mean "it sometimes works" or
>> "never works"?
> Sorry - yes, it was very vague! Never works. If I run wiresahrk I can
> see udp packets addressed to 18.104.22.168, port 901, flying past, however
> when I run my python script it does not appear to ever receive
> The scritp I am running is almost identical to an exampel I found here:
>>> I have managed to use tshark to display the packets :
>>> tshark -i eth0 -x -l -f udp
>> Can you post a complete example that isn't working for you?
>> When your code is running, have a look "/sbin/ip maddr" to ensure the
>> group has been added to the socket listen filter
> link 01:00:5e:00:00:04
> link 33:33:ff:7a:7e:4e
> link 01:00:5e:00:00:fb
> link 01:00:5e:00:00:01
> link 33:33:00:00:00:01
> inet 22.214.171.124
> inet 126.96.36.199
> inet 188.8.131.52
> inet6 ff02::1:ff7a:7e4e
> inet6 ff02::1
> That's interesting.... eth1 is the wrong interface! In fact, it isn't
> connected to anything at all. eth0 is the interface that should be
> being used. I will try to swap them around, but presumably this is
> something I can specify somwhere...
> As I said, the code I am using is taken from the above link, but the
> exact listing is given below:
> from twisted.internet.protocol import DatagramProtocol
> from twisted.internet import reactor
> from twisted.application.internet import MulticastServer
> class MulticastServerUDP(DatagramProtocol):
> def startProtocol(self):
> print 'Started Listening'
> # Join a specific multicast group, which is the IP we will respond to
> def datagramReceived(self, datagram, address):
> print "Server Received:" + repr(datagram)
> reactor.listenMulticast(901, MulticastServerUDP())
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
More information about the Twisted-Python