Wednesday, February 17, 2010

Find and discover switches, well the smart ones.

Like many people I have occasionally forgotten small details when under pressure, and even worse sometime forgotten to write them down. Added to the fact I regularly visit or remotely handle to handle sites setup by other people I don't always know the configuration of a site switches.

Most modern switches have a web interface or at least a telnet one - but serial ports are becoming less common - even if there are connected.

Cisco devices (and some Linksys now), will reveal their presence to you via CDP, just sit on the net with your favourite sniffer running and watch for CDP packets. However Netgear switches don't do this. Netgear do offer a downloadable discovery program - but it is for windows only, so isn't easily to run on remote networks.

Given that we are not trying to do anything more complicated than force a device to send us a packet , and perhaps read a few fields out of that packet , I decided it couldn't be to difficult to roll my own.

So I have the great honour to I present to you, ngdiscover.py - I can't guarantee I've got all the fields right - I've only worked out what they are by inspecting the response packets, but the script works for me.

Have a play and let me know what you find. If it doesn't work for you - you might find the '--debug' option helpful , this makes ngdiscover.py dump the raw response packet to the output as well.