From 2441060500c57644b4a64d3271fc5388febcec5d Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Wed, 5 Dec 2012 18:53:50 +0100 Subject: [PATCH] -i to set the number of netbeacon to send (Default:10) --- nb_send.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nb_send.py b/nb_send.py index d925e2c..2430127 100644 --- a/nb_send.py +++ b/nb_send.py @@ -41,6 +41,7 @@ def nbsend(destination=None,payload=None, logging=False): usage = "usage: %prog [options] " parser = OptionParser(usage) parser.add_option("-s","--storeseq", dest="storeseq", action='store_true', help="store sequence and validate sequence") +parser.add_option("-i","--iteration", dest="iteration", type=int, help="set the number of interation for sending the netbeacon") (options, args) = parser.parse_args() @@ -55,9 +56,13 @@ if options.storeseq: else: seqstart = 1 -for x in range(seqstart,seqstart+10): +if not options.iteration: + options.iteration=10 + +for x in range(seqstart,seqstart+options.iteration): nbsend(destination="127.0.0.1", payload=nbmessage(x), logging=True) if options.storeseq: s['seq'] = x + if options.storeseq: s.close()