root/trunk/tool/renetcolRC.py @ 152

Revision 152, 24.5 KB (checked in by andreu, 12 years ago)

Add timestamp on the first file creation

Line 
1
2##  File: renetcolRC.py
3 
4##  Authors: ANDREU Francois-Xavier
5 
6##  Copyright (C) 2010-2011 GIP RENATER
7 
8
9##   This file is part of renetcol.
10 
11##   renetcol is free software; you can redistribute it and/or modify
12##   it under the terms of the GNU General Public License as published by
13##   the Free Software Foundation; either version 2 of the License, or
14##   (at your option) any later version.
15 
16##   renetcol is distributed in the hope that it will be useful,
17##   but WITHOUT ANY WARRANTY; without even the implied warranty of
18##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19##   GNU General Public License for more details.
20 
21##   You should have received a copy of the GNU General Public License
22##   along with renetcol; if not, write to the Free Software
23##   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 
25
26import os
27import binascii
28import struct
29import time
30
31import operator
32import threading
33import string
34import re
35import socket
36import sys
37import traceback
38import commands
39from optparse import OptionParser
40
41global localAddr, localPort
42global rrt, record, record_file_name
43
44########### DEFAULT VALUES, YOU MUST CHANGE IT ###############################
45IPversion = 4
46localAddr = ''
47localAddr6 = '0::'
48localPort = 2222
49collectorAddr = "127.0.0.1"
50collectorAddr6 = "0::"
51collectorPort = 52571  # if you change this port number, apply the
52                       # modification on the renetcolSender.h file
53                       # and you'll need a new compilation of the collector
54##############################################################################
55
56myInputControlThread = None
57printValue =      [ 0,1,1,0,1,0,0,1,1,0, # 0 to 9
58                    1,1,1,0,1,0,1,1,0,0, # 10...
59                    0,1,0,0,0,0,0,1,1,0, #
60                    0,0,0,0,0,0,0,0,0,0, #
61                    0,0,0,0,0,0,1,1,0,0, #
62                    0,0,0,0,0,0,0,0,0,0, #
63                    0,0,0,0,0,0,0,0,0,1, #
64                    1,1,1,1,1,1,1,1,1,1, #
65                    0,0,0,0,0,0,0,0,0,0,  # 80 to 89
66                    0,0,0,0,0,0,0,0,0,0, #
67                    0,0,0,0,0,0,0,0,0,0, #
68                    0,0,0,0,0,0,0,0,0,0, #
69                    0,0,0,0,0,0,0,0,0,0, #
70                    0,0,0,0,0,0,0,0,0,0 # 130 to 139
71                    ]
72firstParseValue = [ 0,0,0,0,0,0,0,0,0,0,
73                    0,0,0,0,0,0,0,0,0,0,
74                    0,0,0,0,0,0,0,0,0,0,
75                    0,0,0,0,0,0,0,0,0,0,
76                    0,0,0,0,0,0,0,0,0,0,
77                    0,0,0,0,0,0,0,0,0,0,
78                    0,0,0,0,0,0,0,0,0,0,
79                    0,0,0,0,0,0,0,0,0,0,
80                    0,0,0,0,0,0,0,0,0,0,
81                    0,0,0,0,0,0,0,0,0,0, #
82                    0,0,0,0,0,0,0,0,0,0, #
83                    0,0,0,0,0,0,0,0,0,0, #
84                    0,0,0,0,0,0,0,0,0,0, #
85                    0,0,0,0,0,0,0,0,0,0 # 130 to 139
86                    ]
87checkUpValues =   [ 0,0,0,0,0,0,0,0,0,0,
88                    0,0,0,0,0,0,0,0,0,0,
89                    0,0,0,0,0,0,0,0,0,0,
90                    0,0,0,0,0,0,0,0,0,0,
91                    0,0,0,0,0,0,0,0,0,0,
92                    0,0,0,0,0,0,0,0,0,0,
93                    0,0,0,0,0,0,0,0,0,0,
94                    0,0,0,0,0,0,0,0,0,0,
95                    0,0,0,0,0,0,0,0,0,0,
96                    0,0,0,0,0,0,0,0,0,0, #
97                    0,0,0,0,0,0,0,0,0,0, #
98                    0,0,0,0,0,0,0,0,0,0, #
99                    0,0,0,0,0,0,0,0,0,0, #
100                    0,0,0,0,0,0,0,0,0,0 # 130 to 139
101                    ]
102fieldsName =  [ "","IN_BYTES","IN_PKTS","","PROT","TOS","TCP_FL","S_PORT","IPv4@S","S_MASK",
103                "InSNMP","D_PORT","IPv4@D","D_MASK","OutSNMP","NextHop","S_AS","D_AS","","",
104                "LT","AGE","","","","","","IPv6@S","IPv6@D","IPv6_S_MASK",
105                "IPv6_D_MASK","","","","","","","","","",
106                "","","","","","","M_T_L_T","M_T_L_@","","",
107                "","","","","","","","","","",
108                "","","","","","","","","","ROUTER;TIMESTAMP",
109                "M_L_1","M_L_2","M_L_3","M_L_4","M_L_5","M_L_6","M_L_7","M_L_8","M_L_9","M_L_10",
110                "","","","","","","","","","", # 80 to 89
111                "","","","","","","","","","",
112                "","","","","","","","","","",
113                "","","","","","","","","","",
114                "","","","","","","","","","",
115                "","","","","","","","","","" # 130 to 139
116                ]
117flowCpt = 0
118flowCptW = 0
119mask = [ 0,0,0 ]
120spaceSep = " "
121tabSep = "\t"
122freeze = 0
123record = 0
124record_file_name = ""
125record_file = None
126is_already_see = 0
127collectorRule=""
128router=0
129tpl_def = {}
130oldTpl = 0
131oldTplW = 0
132fromRouter = ""
133myTimer = None
134myCPT = 1
135rrt = 3600
136
137class InputControl(threading.Thread):
138    def kill(self, timeout):
139        self.imRunning = 0
140        time.sleep(1)
141        print "\n.\n..\n..."
142        time.sleep(1)
143        print "....\n.....\n......"       
144        time.sleep(1)
145        if self.myFlowInput:
146            self.myFlowInput.socket_close()
147        self.join(timeout)
148       
149    def __init__(self, address, port):
150        self.imRunning = 1
151        self.currentflow = None
152        threading.Thread.__init__(self)
153        self.myFlowInput = FlowInput(address, port)
154
155    def run(self):
156        global freeze, record
157        while self.imRunning:
158            if self.myFlowInput:
159                tmp = self.myFlowInput.get_flow()
160                if (tmp[0]!=None):
161                    self.currentflow = Flow(tmp)
162                    if (freeze==0) & self.currentflow.enable():
163                        self.currentflow.print_flow2()
164                    if (record==1) & self.currentflow.enable():
165                        self.currentflow.write_flow2()
166##                else:
167##                    self.myFlowInput = None
168   
169class Flow:
170    def __init__(self, data):
171        self.flow = [ data[0], data[1] ]
172
173# flow selection
174    def enable(self):
175        global firstParseValue, checkUpValues, tpl_def, fromRouter
176        res = 1
177        resS = 1
178        resD = 1
179        for i in range (0, len(tpl_def[self.flow[0]])):
180            f = tpl_def[self.flow[0]][i][0]
181            # or f==15 or f==18 or f==47
182            if ( f==8 ) and ( checkUpValues[f]==1 ):
183                resS = resS & ( ((struct.unpack('>L',(socket.inet_aton(self.flow[1][i])))[0] & mask[1-1]) == firstParseValue[f]) )
184            elif ( f==12 ) and ( checkUpValues[f]==1 ):
185                resD = resD & ( ((struct.unpack('>L',(socket.inet_aton(self.flow[1][i])))[0] & mask[1-1]) == firstParseValue[f]) )
186            elif ( i==27 or i==28 ):
187                pass
188            elif ( (f==1) and (checkUpValues[f]==1) ):
189                res = res & ( (self.flow[1][i] <= ((firstParseValue[f])+((firstParseValue[f])*5/100))) and ((self.flow[1][i] >= ((firstParseValue[f])-((firstParseValue[f])*5/100)))) )
190            elif (checkUpValues[f]==1):
191                res = res & (self.flow[1][i] == firstParseValue[f])
192        if ( checkUpValues[69]==1 ):
193            res = res & ( (fromRouter == firstParseValue[69]) )
194        res = res & (resS or resD)
195        return res
196
197# flow print
198    def print_flow2(self):
199        global printValue, tpl_def, flowCpt, fieldsName, oldTpl, os_type, fromRouter
200        myliste = []
201        myTpl = []
202        strFlow = ""
203        strField = ""
204        underscore_line = ""
205        flowCpt+=1
206        if (flowCpt%60 == 0 or oldTpl != self.flow[0]):
207##        if (flowCpt%100 == 0):
208            flowCpt = 0
209            for i in range (0, len(tpl_def[self.flow[0]])):
210                f = tpl_def[self.flow[0]][i][0]
211                if printValue[f]:
212                    if ( f==27 or f==28 or f==62 or f==63 ):
213                        strField += str(fieldsName[f])
214                        l = len(str(fieldsName[f]))
215                        if ((40-l)%8 == 0):
216                            tabNb = int((40-l)/8)
217                        else:
218                            tabNb = int((40-l)/8) + 1
219                        for j in range (0, tabNb):
220                            strField += "\t"
221                        for k in range (0, 40):
222                            underscore_line += "-"
223                    elif ( f==8 or f==15 or f==12 or f==18 or f==47 ):
224                        strField += str(fieldsName[f])
225                        l = len(str(fieldsName[f]))
226                        if ((16-l)%8 == 0):
227                            tabNb = int((16-l)/8)
228                        else:
229                            tabNb = int((16-l)/8) + 1
230                        for j in range (0, tabNb):
231                            strField += "\t"
232                        for k in range (0, 16):
233                            underscore_line += "-"
234                    else:
235                        strField += str(fieldsName[f])
236                        strField += "\t"
237                        for k in range (0, 8):
238                            underscore_line += "-"
239            if (oldTpl != self.flow[0]):
240                print " "
241            if (os_type == 0):
242                esc = '\x1b['
243                sep = ';'
244                end = 'm'
245                if (printValue[69]):
246                    rt = str(fieldsName[69])
247                    toprint = esc+"37"+sep+"44"+end+strField+rt+esc+"0"+end
248                else:
249                    toprint = esc+"37"+sep+"44"+end+strField+esc+"0"+end
250                print toprint
251            else:
252                if (printValue[69]):
253                    strField += str(fieldsName[69])
254                print strField
255                print underscore_line
256        for i in range (0, len(tpl_def[self.flow[0]])):
257            f = tpl_def[self.flow[0]][i][0]
258            if printValue[f]:
259                if ( f==27 or f==28 or f==62 or f==63 ):
260                    strFlow += str(self.flow[1][i])
261                    l = len(str(self.flow[1][i]))
262                    if ((40-l)%8 == 0):
263                        tabNb = int((40-l)/8)
264                    else:
265                        tabNb = int((40-l)/8) + 1
266                    for j in range (0, tabNb):
267                        strFlow += "\t"
268                elif ( f==8 or f==12 or f==15 or f==18 or f==47 ):
269                    strFlow += str(self.flow[1][i])
270                    l = len(str(self.flow[1][i]))
271                    if ((16-l)%8 == 0):
272                        tabNb = int((16-l)/8)
273                    else:
274                        tabNb = int((16-l)/8) + 1
275                    for j in range (0, tabNb):
276                        strFlow += "\t"
277                elif (f==21):
278                    myliste += [str(self.flow[1][i]-self.flow[1][i+1])]
279                    strFlow += str(self.flow[1][i]-self.flow[1][i+1])
280                    strFlow += "\t"
281                elif (f==22):
282                    pass
283                else:
284                    myliste += [str(self.flow[1][i])]
285                    strFlow += str(self.flow[1][i])
286                    for k in range (len(str(self.flow[1][i])), 7):
287                        strFlow += " "
288                    strFlow += "\t"
289        if (printValue[69]):
290            strFlow += fromRouter+"\t"+time.strftime("%Y/%m/%d %H:%M", time.gmtime())
291        print strFlow
292        oldTpl = self.flow[0]
293
294# flow record
295    def write_flow2(self):
296        global printValue, record_file, tpl_def, flowCptW, fieldsName, oldTplW, os_type, fromRouter
297        myliste = []
298        myTpl = []
299        strFlow = ""
300        strField = ""
301        underscore_line = "#"
302        flowCptW+=1
303        if (flowCptW%6 == 0 or oldTplW != self.flow[0]):
304##        if (flowCpt%100 == 0):
305            strField = "#"
306            flowCptW = 0
307            for i in range (0, len(tpl_def[self.flow[0]])):
308                f = tpl_def[self.flow[0]][i][0]
309                if printValue[f]:
310                    if ( f==27 or f==28 or f==62 or f==63 ):
311                        strField += str(fieldsName[f])
312                        l = len(str(fieldsName[f]))
313                        if ((40-l)%8 == 0):
314                            tabNb = int((40-l)/8)
315                        else:
316                            tabNb = int((40-l)/8) + 1
317                        #for j in range (0, tabNb):
318                            strField += ";"
319                        for k in range (0, 40):
320                            underscore_line += "-"
321                    elif ( f==8 or f==15 or f==12 or f==18 or f==47 ):
322                        strField += str(fieldsName[f])
323                        l = len(str(fieldsName[f]))
324                        if ((16-l)%8 == 0):
325                            tabNb = int((16-l)/8)
326                        else:
327                            tabNb = int((16-l)/8) + 1
328                        #for j in range (0, tabNb):
329                        strField += ";"
330                        for k in range (0, 16):
331                            underscore_line += "-"
332                    else:
333                        strField += str(fieldsName[f])
334                        strField += ";"
335                        for k in range (0, 8):
336                            underscore_line += "-"
337            if (oldTplW != self.flow[0]):
338                record_file.write("")
339            if (os_type == 0):
340                esc = '\x1b['
341                sep = ';'
342                end = 'm'
343                if (printValue[69]):
344                    rt = str(fieldsName[69])
345                    toprint = esc+"37"+sep+"44"+end+strField+rt+esc+"0"+end+"\n"
346                else:
347                    toprint = esc+"37"+sep+"44"+end+strField+esc+"0"+end+"\n"
348                record_file.write(toprint)
349            else:
350                if (printValue[69]):
351                    strField += str(fieldsName[69])
352                if (record_file!=None):
353                    record_file.write(strField)
354                    record_file.write("\n")
355#                    record_file.write(underscore_line)
356#                    record_file.write("\n")
357        for i in range (0, len(tpl_def[self.flow[0]])):
358            f = tpl_def[self.flow[0]][i][0]
359            if printValue[f]:
360                if (f==21):
361                    myliste += [str(self.flow[1][i]-self.flow[1][i+1])]
362                elif (f==22):
363                    pass
364                else:
365                    myliste += [str(self.flow[1][i])]
366        theflow = string.join(myliste, ";")+";"+fromRouter+";"+time.strftime("%Y%m%d%H%M", time.gmtime())+"\n"
367        if (record_file!=None):
368            record_file.write(theflow)
369            record_file.flush()
370            oldTplW = self.flow[0]
371       
372class FlowInput:
373    def __init__(self, h, p):
374        self.HOST = h
375        self.PORT = p
376        if (IPversion == 4):
377            self.socketnumber = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
378        elif (IPversion == 6):
379            self.socketnumber = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
380        else:
381            print "IP protocol ", IPversion ," not supported"
382            exit(0)
383        self.socketnumber.bind((self.HOST, self.PORT))
384   
385    def get_flow(self):
386        global collectorRule, tpl_def, os_type, fromRouter
387        if (self.socketnumber!=None):
388            data = self.socketnumber.recvfrom(1024)
389            flow = data[0]
390            code = struct.unpack('<H', flow[0:2])
391            if (code[0] == 1): ## a def packet
392                routerSrc = struct.unpack('<L', flow[2:6])
393                sourceId = struct.unpack('<L', flow[6:10])
394                tplId = struct.unpack('<H', flow[10:12])
395                mykeylst = []
396                mykeylst += [str(routerSrc[0])]
397                mykeylst += [str(sourceId[0])]
398                mykeylst += [str(tplId[0])]
399                mykeystr = string.join(mykeylst,"");
400                fields = []
401                fieldNb = struct.unpack('<H', flow[12:14])
402                for i in range(0, fieldNb[0]):
403                    fd = struct.unpack('<H',flow[14+(i*4):16+(i*4)])
404                    tp = struct.unpack('<H',flow[14+(2+i*4):16+(2+i*4)])
405                    fields.insert(i,(fd[0],tp[0]))
406                tpl_def[mykeystr] = fields
407                return ( None, None)
408            if (code[0]==11): ## a data packet
409                routerSrc = struct.unpack('<L', flow[4:8])
410                tmp =  struct.unpack('<L', flow[4:8])
411                fromRouter = socket.inet_ntoa(struct.pack('>L', tmp[0]))
412                sourceId = struct.unpack('<L', flow[8:12])
413                tplId = struct.unpack('<H', flow[12:14])
414                mykeylst = []
415                mykeylst += [str(routerSrc[0])]
416                mykeylst += [str(sourceId[0])]
417                mykeylst += [str(tplId[0])]
418                mykeystr = string.join(mykeylst,"")
419                if (tpl_def.has_key(mykeystr)== True):
420                    field_list = []
421                    index = 0
422                    for i in range (0, len(tpl_def[mykeystr])):
423                        if (tpl_def[mykeystr][i][1]==1):
424                            value = struct.unpack('<B',flow[14+index:15+index])
425                            field_list.insert(i,value[0])
426                        if (tpl_def[mykeystr][i][1]==2):
427                            value = struct.unpack('>H',flow[14+index:16+index])
428                            field_list.insert(i,value[0])
429                        if (tpl_def[mykeystr][i][1]==3):
430                            value = struct.unpack('<BBB',flow[14+index:17+index])
431                            valueTmp = struct.pack('<BBBB',value[2],value[1],value[0],0)
432                            valueFinal = struct.unpack('<L', valueTmp)
433                            valueFinal2 = (valueFinal[0])>>4
434                            field_list.insert(i,valueFinal2)
435                        if (tpl_def[mykeystr][i][1]==4):
436                            if (tpl_def[mykeystr][i][0]==8 or tpl_def[mykeystr][i][0]==12 or tpl_def[mykeystr][i][0]==15 or tpl_def[mykeystr][i][0]==18 or tpl_def[mykeystr][i][0]==47):
437                                value = socket.inet_ntoa(flow[14+index:18+index])
438                                field_list.insert(i,value)
439                            else:
440                                value = struct.unpack('<L', flow[14+index:18+index])
441                                value = struct.unpack('>L', flow[14+index:18+index])
442                                field_list.insert(i,value[0])
443                        if (tpl_def[mykeystr][i][1]==16):
444                            if (os_type==1):
445                                field_list.insert(i,nt_inet_ntop(flow[14+index:30+index]))
446                            else:
447                                tmp = socket.inet_ntop(socket.AF_INET6,flow[14+index:30+index])
448                                field_list.insert(i,tmp)
449                        index += tpl_def[mykeystr][i][1]
450                    return mykeystr, field_list
451##                else:
452##                  print "I'm waiting the tpl def for the key", mykeystr
453##                return (routerSrc[0], field_list)
454            return ( None, None)
455        return ( None, None)
456
457    def socket_close(self):
458        if self.socketnumber:
459           try :
460               self.socketnumber.shutdown(2)
461               self.socketnumber = None
462           except socket.error:
463              pass
464
465def print_hello(widget, event):
466    print "Hello, World!"
467
468def nt_inet_ntop(packed_ip):
469    cpt = 0
470    double = 0
471    string_ip = ""
472    tmp = binascii.hexlify(packed_ip[0:2])
473    if ( int(tmp,16)!=0 ):
474        string_ip += tmp
475        tmp = binascii.hexlify(packed_ip[2:4])
476        if ( int(tmp,16)==0 ):
477            cpt+=1
478            double = 1
479            if (cpt==1):
480                string_ip += ":"
481        else:
482            cpt=0
483            string_ip += ":"+tmp
484        tmp = binascii.hexlify(packed_ip[4:6])
485        if ( int(tmp,16)==0 ):
486            cpt+=1
487            double = 1
488            if (cpt==1):
489                string_ip += ":"
490        else:
491            cpt=0
492            string_ip += ":"+tmp
493        tmp = binascii.hexlify(packed_ip[6:8])
494        if ( int(tmp,16)==0 ):
495            if (double==1 and cpt==0):
496                string_ip += ":0"
497            else:
498                cpt+=1
499                double = 1
500                if (cpt==1):
501                    string_ip += ":"
502        else:
503            cpt=0
504            string_ip += ":"+tmp
505        tmp = binascii.hexlify(packed_ip[8:10])
506        if ( int(tmp,16)==0 ):
507            if (double==1 and cpt==0):
508                string_ip += ":0"
509            else:
510                cpt+=1
511                double = 1
512                if (cpt==1):
513                    string_ip += ":"
514        else:
515            cpt=0
516            string_ip += ":"+tmp
517        tmp = binascii.hexlify(packed_ip[10:12])
518        if ( int(tmp,16)==0 ):
519            if (double==1 and cpt==0):
520                string_ip += ":0"
521            else:
522                cpt+=1
523                double = 1
524                if (cpt==1):
525                    string_ip += ":"
526        else:
527            cpt=0
528            string_ip += ":"+tmp
529        tmp = binascii.hexlify(packed_ip[12:14])
530        if ( int(tmp,16)==0 ):
531            if (double==1 and cpt==0):
532                string_ip += ":0"
533            else:
534                cpt+=1
535                double = 1
536                if (cpt==1):
537                    string_ip += ":"
538        else:
539            cpt=0
540            string_ip += ":"+tmp
541        tmp = binascii.hexlify(packed_ip[14:16])
542        if ( int(tmp,16) != 0 ):
543            string_ip += ":"+tmp
544        else:
545            string_ip += ":"
546    else:
547        string_ip = "::"
548    return string_ip
549
550def timer_action():
551    global record_file, record_file_name, myTimer, myCPT, rrt
552    myCPT+=1
553    myTimer.cancel()
554    my_new_file_name = "%s_%s.txt" % (record_file_name,time.strftime("%Y%m%d%H%M", time.gmtime()))
555    ##my_new_file_name = "%s_%d" % (record_file_name,myCPT)
556    print my_new_file_name
557    new_record_file = file(my_new_file_name, 'a+')
558    old_record_file = record_file
559    record_file = new_record_file
560    old_record_file.close()
561    now2 = time.time()
562    reste = rrt-(operator.mod(now2,rrt))
563    myTimer = threading.Timer(rrt,timer_action)
564    myTimer.start()
565
566def RotRec():
567    global record, myTimer, rrt
568
569if __name__ == "__main__":
570    global comboRouter, os_type, printShit
571
572    os_type = 0
573    print ""
574    print ""
575    print ""
576 
577    print "----------------------------------------------------------------------------"
578    print " renetcolRC is part of renetcol "
579    print " This module writed in python is a remote client which can received flows "
580    print " information from renetcol. It was built from renetcolGUI source without "
581    print " the gtk interface and without the interaction with renetcol."
582    print " To receive flows from renetcol the filter with the field number 69 MUST be"
583    print " actived on renetcol (in your file rules.txt)"
584    print "----------------------------------------------------------------------------"
585   
586    if (os.name =="nt"):
587        os_type = 1
588    elif (os.name =="posix"):
589        os_type = 0
590    else:
591        os_type = 3
592
593    parser = OptionParser()
594    parser.add_option("-o", "--output", dest="out", help ="Output filename prefix, ex: \"/tmp/myrecord\", timestamp will be added to the filename")
595    parser.add_option("-t", "--time", dest="tim", help ="Round robin interval (in seconde), default is \"3600\" for 1h")
596    (options, args) = parser.parse_args()
597    outputFileName = options.out
598    rrt = int(options.tim)
599
600    if (outputFileName!=None):
601        record = 1
602        record_file_name = outputFileName
603        my_file_name = "%s_%s.txt" % (record_file_name,time.strftime("%Y%m%d%H%M", time.gmtime()))
604    ##my_new_file_name = "%s_%d" % (record_file_name,myCPT)
605        print my_file_name
606        new_record_file = file(my_file_name, 'a+')
607        record_file = new_record_file
608        RotRec()
609    else:
610        record = 0
611
612    print ""
613    print ""
614    print ""
615    print "---------------------------------------"
616    print " STARTING RECORD ROTATION"
617    print " with following parameters:"
618    print " output filename prefix :",outputFileName
619    print " interval: ",rrt, " seconds"
620    print "---------------------------------------"
621    now2 = time.time()
622    reste = rrt-(operator.mod(now2,rrt))
623    myTimer = threading.Timer(rrt,timer_action)
624    myTimer.start()
625    ##myTimer.cancel()
626    ##print "STOPPING RECORD ROTATION"
627
628    myInputControlThread = InputControl(localAddr, localPort)
629    myInputControlThread.start()
630       
Note: See TracBrowser for help on using the browser.