Changeset 18 for trunk/tool

Show
Ignore:
Timestamp:
06/09/06 18:18:15 (17 years ago)
Author:
andreu
Message:

ajout pour CRIHAN

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tool/renetcolGUI_0_0_3.py

    r14 r18  
    6060                    1,0,0,0,0,0,0,1,1,0, 
    6161                    0,0,0,0,0,0,0,0,0,0, 
    62                     0,0,0,0,0,0,0,0,0,0, 
    63                     0,0,0,0,0,0,0,0,0,0, 
    64                     0,0,0,0,0,0,0,0,0,0, 
    65                     0,0,0,0,0,0,0,0,0,0, 
     62                    0,0,0,0,0,0,1,1,0,0, 
     63                    0,0,0,0,0,0,0,0,0,0, 
     64                    0,0,0,0,0,0,0,0,0,0, 
     65                    1,1,1,1,1,1,1,1,1,1, 
    6666                    0,0,0,0,0,0,0,0,0,0 
    6767                    ] 
     
    8686                    0,0,0,0,0,0,0,0,0,0 
    8787                    ] 
    88 fieldsName =     [ "","IN_BYT","IN_PKTS","","PROT","TOS","TCP_FL","S_PORT","IPv4@S","S_MASK", 
    89                    "InSNMP","D_PORT","IPv4@D","D_MASK","OutSNMP","NextHop","S_AS","D_AS","","", 
    90                    "","Time","","","","","","IPv6@S","IPv6@D","", 
    91                    "","","","","","","","","","", 
    92                    "","","","","","","","","","", 
    93                    "","","","","","","","","","", 
    94                    "","","","","","","","","","ROUTER", 
    95                    "","","","","","","","","","", 
    96                    "","","","","","","","","","" 
    97                    ] 
     88fieldsName =  [ "","IN_BYT","IN_PKTS","","PROT","TOS","TCP_FL","S_PORT","IPv4@S","S_MASK", 
     89                "InSNMP","D_PORT","IPv4@D","D_MASK","OutSNMP","NextHop","S_AS","D_AS","","", 
     90                "","Time","","","","","","IPv6@S","IPv6@D","", 
     91                "","","","","","","","","","", 
     92                "","","","","","","M_T_L_T","M_T_L_@","","", 
     93                "","","","","","","","","","", 
     94                "","","","","","","","","","ROUTER", 
     95                "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", 
     96                "","","","","","","","","","" 
     97                ] 
    9898flowCpt = 0 
    9999mask = [ 0,0,0 ] 
     
    154154        for i in range (0, len(tpl_def[self.flow[0]])): 
    155155            f = tpl_def[self.flow[0]][i][0] 
    156             if ( f==8 or f==12 ) and ( checkUpValues[f]==1 ): 
     156            if ( f==8 or f==12 or f==15 or f==18 or f==47) and ( checkUpValues[f]==1 ): 
    157157                res = res & ( ((struct.unpack('>L',(socket.inet_aton(self.flow[1][i])))[0] & mask[1-1]) == firstParseValue[f])| ((struct.unpack('>L',(socket.inet_aton(self.flow[1][i])))[0] & mask[1-1]) == firstParseValue[f]) ) 
    158158            elif ( i==27 or i==28 ): 
     
    186186                        for k in range (0, 40): 
    187187                            underscore_line += "-" 
    188                     elif ( f==8 or f==15 or f==12 ): 
     188                    elif ( f==8 or f==15 or f==12 or f==18 or f==47 ): 
    189189                        strField += str(fieldsName[f]) 
    190190                        l = len(str(fieldsName[f])) 
     
    231231                    for j in range (0, tabNb):  
    232232                        strFlow += "\t" 
    233                 elif ( f==8 or f==12 or f==15 ): 
     233                elif ( f==8 or f==12 or f==15 or f==18 or f==47 ): 
    234234                    strFlow += str(self.flow[1][i]) 
    235235                    l = len(str(self.flow[1][i])) 
     
    329329                            value = struct.unpack('>H',flow[14+index:16+index]) 
    330330                            field_list.insert(i,value[0]) 
     331                        if (tpl_def[mykeystr][i][1]==3): 
     332                            value = struct.unpack('<BBB',flow[14+index:17+index]) 
     333                            valueTmp = struct.pack('<BBBB',value[2],value[1],value[0],0) 
     334                            valueFinal = struct.unpack('<L', valueTmp) 
     335                            valueFinal2 = (valueFinal[0])>>4 
     336                            field_list.insert(i,valueFinal2) 
    331337                        if (tpl_def[mykeystr][i][1]==4): 
    332                             if (tpl_def[mykeystr][i][0]==8 or tpl_def[mykeystr][i][0]==12 or tpl_def[mykeystr][i][0]==15): 
     338                            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): 
    333339                                value = socket.inet_ntoa(flow[14+index:18+index]) 
    334340                                field_list.insert(i,value) 
     
    718724            operator = rule[1] 
    719725            value = rule[2] 
    720             if (field=='8' or field=='12' or field=='15' or field=='18'): 
     726            if (field=='8' or field=='12' or field=='15' or field=='18' or field=='47'): 
    721727                if (re.match('^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2})?$',value)): 
    722728                    splitter = value.split('/') 
     
    750756                    is_good = 1 
    751757                ##here, check the prefix value? 
    752             if (field=='60'): 
     758            if (field=='60' or field=='46'): 
    753759                if (int(value) < 256): 
    754760                    is_good = 1 
     
    986992 
    987993    print "---------------------------------------------------------------" 
    988     print "In this version 0.0.2, you can apply rules on the collector based on the following fields:" 
     994    print "In this version 0.0.3, you can apply rules on the collector based on the following fields:" 
    989995    print "IPV4_SRC_ADDR: 8," 
    990996    print "IPV4_DST_ADDR: 12," 
     
    993999    print "IPV6_SRC_ADDR: 27," 
    9941000    print "IPV6_DST_ADDR: 28," 
     1001    print "MPLS_TOP_LABEL_TYPE: 46," 
    9951002    print "IPV6_NEXT_HOP: 62," 
    9961003    print "BPG_IPV6_NEXT_HOP: 63,"