sending a rip1 request via python

Dirk Loss lists at dirk-loss.de
Wed Dec 19 18:50:01 EST 2007


scripteaze wrote:
 >>> I need to be able to send a rip1 request to my rip1 enabled device.,
 > Well, i use scapy quite often, however, this needs to be very portable

import socket
rip_request = '\x01\x01\x00\x00\x00\x02' + '\x00' * 17 + '\x10'
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(rip_request, ("servername", 520))
s.close()

If you also want to handle the replies, you might want to have a look at
the SocketServer module:

http://docs.python.org/lib/module-SocketServer.html

Regards
Dirk



More information about the Python-list mailing list