diff --git a/README.md b/README.md index 5376c40..febc1a4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Scamper is written in C and stores data in a binary "warts" format. These tools attempt to replicate the functionality of scamper's utilities by providing native python implementations. -* sc_attach.py: interact with scamper over control socket -* sc_wartsdump.py: parse binary warts files +* sc_warts.py: warts file processing library +* sc_wartsdump.py: parse binary warts files +* sc_sample.py: sample python using warts class * sc_analysis_dump.py: covert scamper traces to easily parsed text +* sc_attach.py: interact with scamper over control socket diff --git a/sc_sample.py b/sc_sample.py new file mode 100755 index 0000000..8429091 --- /dev/null +++ b/sc_sample.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +# +# Program: $Id: $ +# Author: Robert Beverly +# Description: Example use of sc_warts library. +# Counts the number of different destinations probed +# +import sys +from sc_warts import WartsReader + +if __name__ == "__main__": + assert len(sys.argv) == 2 + + w = WartsReader(sys.argv[1], verbose=False) + dsts = set() + while True: + (flags, hops) = w.next() + if flags == False: break + dsts.add(flags['dstaddr']) + print "Found %d probed destinations in %s." % (len(dsts), sys.argv[1])