Skip to content

Contrib: Code: RIPMonitor

Pierre LALET edited this page Jan 17, 2016 · 1 revision

Monitor RIP broadcasts as they happen


You need to monitor RIP broadcast as they happen to help diagnose RIP problems


#! /usr/bin/env python
from scapy import *
import IPy

def rip_cb(p):
                src = socket.gethostbyaddr(p[IP].src)[0]
        except socket.herror, e:
                if e.args[0] == 1:
                        src = p[IP].src

        re = p[RIPEntry]
        while type(re) != NoPayload:
                addr = re.addr + "/" + re.mask
                print "%-25s %-18s %s" % \
                        ( src, IPy.IP(addr), re.metric)
                re = re.payload

sniff(prn=rip_cb, filter="udp and dst port route", store=0)


When run it prints out three columns the source address, the route offered and the metric.

See also

[SimplisticARPMonitor](Contrib: Code: SimplisticARPMonitor)


Thomas Stewart 2008