Changeset 18 for trunk/tool
- Timestamp:
- 06/09/06 18:18:15 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/tool/renetcolGUI_0_0_3.py
r14 r18 60 60 1,0,0,0,0,0,0,1,1,0, 61 61 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, 66 66 0,0,0,0,0,0,0,0,0,0 67 67 ] … … 86 86 0,0,0,0,0,0,0,0,0,0 87 87 ] 88 fieldsName = 89 90 91 92 "","","","","","","","","","",93 94 95 "","","","","","","","","","",96 97 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 "","","","","","","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 ] 98 98 flowCpt = 0 99 99 mask = [ 0,0,0 ] … … 154 154 for i in range (0, len(tpl_def[self.flow[0]])): 155 155 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 ): 157 157 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]) ) 158 158 elif ( i==27 or i==28 ): … … 186 186 for k in range (0, 40): 187 187 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 ): 189 189 strField += str(fieldsName[f]) 190 190 l = len(str(fieldsName[f])) … … 231 231 for j in range (0, tabNb): 232 232 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 ): 234 234 strFlow += str(self.flow[1][i]) 235 235 l = len(str(self.flow[1][i])) … … 329 329 value = struct.unpack('>H',flow[14+index:16+index]) 330 330 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) 331 337 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): 333 339 value = socket.inet_ntoa(flow[14+index:18+index]) 334 340 field_list.insert(i,value) … … 718 724 operator = rule[1] 719 725 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'): 721 727 if (re.match('^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2})?$',value)): 722 728 splitter = value.split('/') … … 750 756 is_good = 1 751 757 ##here, check the prefix value? 752 if (field=='60' ):758 if (field=='60' or field=='46'): 753 759 if (int(value) < 256): 754 760 is_good = 1 … … 986 992 987 993 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:" 989 995 print "IPV4_SRC_ADDR: 8," 990 996 print "IPV4_DST_ADDR: 12," … … 993 999 print "IPV6_SRC_ADDR: 27," 994 1000 print "IPV6_DST_ADDR: 28," 1001 print "MPLS_TOP_LABEL_TYPE: 46," 995 1002 print "IPV6_NEXT_HOP: 62," 996 1003 print "BPG_IPV6_NEXT_HOP: 63,"