mirror of
https://github.com/cmand/scamper.git
synced 2024-05-19 06:50:05 +00:00
Add hello-world sample of using warts library
This commit is contained in:
@ -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
|
||||
|
20
sc_sample.py
Executable file
20
sc_sample.py
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Program: $Id: $
|
||||
# Author: Robert Beverly <rbeverly@nps.edu>
|
||||
# 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])
|
Reference in New Issue
Block a user