[ Top ]

tcpdump2dot

Table of Contents

  1. tcpdump2dot : Turn a 'tcpdump -e -n' into a layer 2 flow map of your network , (with image gallery)


Contents

  1. tcpdump2dot
  2. Turn a 'tcpdump -e -n' into a layer 2 flow map of your network , (with image gallery)

    The Source:

    tcpdump2dot/dist/latest.tar.gz

    Description:

    Take a `tcpdump -e -n ` output and convert it into something wonderfull, as seen in the Gallery. Warning: Some of the images in the gallery are rather large and may not display on your browser. For these I use the Macos X preview application.

    My home network. if you have more interesting pictures, I'd love to show them to people. There are more interesting graphs, but the data is not public, so nuts.

    my home network, a pritty picture

    How to read the map

    Interesting things you can see from the map above. 12.234.162.49 (my laptop, the rotarran), is an Mac. It has sent traffic to 12.234.160.1 at 0:30:80:76:fc:54 and that traffic was returned from a different MAC addr. Asymmetric routing at layer 2. You can also see that the rotarran sent traffic to 12.234.160.3 but that nothing came back.

    I'm not sure, but I'm of the guessing opinion that the cisco macs that end in like bytes, are more than likely the same card, or switch or however cable modems work.

    Other things that can be seen from these sorts of maps.

    Usage

    This works for me.
    
    	tcpdump -e -n  -c 1000 > some_tmp_file
    	tcpdump2dot some_tmp_file > stf.dot
    	dot stf.dot -Tjpg -o stf.jpg -Goverlap=false	
    
    
    Another option is to just glom in all together into one big pipe. Then you might put that into a loop so that you have a continually updating map of a network segment.
    
    	tcpdump -e -n -c 1000 | tcpdump2dot | ./dot -Tjpg -Goverlap=false -o mynetwork.jpg
    
    
    and
    #!/bin/sh
    
    	while true
    		do
    		echo ""
    		echo ""
    		date
    		tcpdump -e -n -c 1000 | tcpdump2dot | ./dot -Tjpg -Goverlap=false -o mynetwork.tmp.jpg
    		mv mynetwork.tmp.jpg mynetwork.jpg
    		sleep 300;
    	done
    
    

    This works fine until you get graphs that are larger than about 4kx4k. Sometime around here, Mozilla and Netscape start complaining about things. Graphs of larger than 64k pixels in ether x or y, will probably crash dot or neato. Most image librarys were written with the idea of 16 bit integers. Wimps. At this point you'll need to start outputting in postscript or some other non rasterized format.

    If you want to use a different type of output driver like -Tps, which you'll have to do when he maps get to big, you'll need to start fiddling with the .dot file, and adding things like 'size ="20,20";', or 'page="8.5,11";' I'm still working on trying to fully figure out how to use them.

    If dot starts getting cranky or you'd like the layout to be different, it's time to crack open the graphviz manuals and start working on it. This is meant as a starting point and a work in progress.

    Things that need doing

    1. Incorporate TTL, port numbers, protocol types, etc.
    2. Spell checking.
    3. Graph gallery, you could send me data or pictures you know...
    4. figuring out and solving my problems with page / size and output driver choice.
    5. Work on getting a sub OUI map, sometimes vendors will do things in runs, like there are no Sun Sparc-20s with a high MAC addr. It could really help in guessing the node types. I know someone was doing this already, but I lost the link .. help?
    6. More documentation.
    7. Lots more argument checking and validation.

    People who get thanked

    Installing:

    1. Untar the tarball
    2. Use your version of perl not mine.
    3. read the script, it has embedded config knobs, they should be arguments...
    4. send me gulfie@grotto-group.com bug reports if anything goes wrong, or something could go better.

    Requisites

[ Top ]