Ethereal-dev: [Ethereal-dev] Bug ugly protocol graph

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gerald Combs <gerald@xxxxxxxxxxxx>
Date: Fri, 11 Mar 2005 15:26:46 -0600
I wrote a script (attached) that converts the output of "tethereal -G
decodes" into a Graphviz graph.  The final output can be found at
http://www.ethereal.com/~gerald/big-ugly-protocol-graph.png .  With a
bit of tweaking, we _might_ be able to turn this into a protocol poster.
#!/usr/bin/env python

import os

tethereal = './tethereal -G decodes'
proto = {}

dissector_dump = os.popen(tethereal)

# Build a dictionary of relationships
for line in dissector_dump:
    line = line.strip()
    (filter, selector, child) = line.split()
    parent = filter.split('.')[0]

    if not proto.has_key(parent):
	proto[parent] = []

    if child not in proto[parent]:
	proto[parent].append(child)

# Dump out our graph
print 'digraph Ethereal {'

parents = proto.keys()
parents.sort()

for parent in parents:
    proto[parent].sort()

    for child in proto[parent]:
	print '\t"' + parent + '"->"' + child + '";'

print '}'