def __init__(self, stabilizedTree): self.hitTimes = 1 self.flow = stabilizedTree.flow self.ts = stabilizedTree.ts self.flowArray = stabilizedTree.flowArray self.dst = [] self.srcport = [] #self.host = [] self.t2ld = [] self.uri = [] self.packetIndex = [] for item in self.flowArray: if item[0] == "request": dst = item[3] srcport = item[4] t2ld = GlobalVariable.hostnameTop2LevelDomain(item[6]) uri = item[7] packetIndex = item[11] if dst != "": self.dst.append(dst) if srcport != "": self.srcport.append(srcport) if t2ld != "": self.t2ld.append(t2ld) if uri != "": self.uri.append(uri) self.packetIndex.append(packetIndex) if item[0] == "dnsresponse": self.packetIndex.append(item[8]) self.dst = set(self.dst) self.srcport = set(self.srcport) self.t2ld = set(self.t2ld) self.uri = set(self.uri) self.packetIndex = set(self.packetIndex) def show(self): return self.flow
def __compare_http_http(self, flow, item): if (item[4] != "" and flow[4] == item[4]) or (item[8] != "" and flow[10] == item[8]) or (item[7] != "" and item[7] != "/" and flow[7] == item[7]) or (item[6] != "" and flow[6] == item[6]) or (item[3] != "" and flow[3] == item[3]) or (item[6] != "" and GlobalVariable.hostnameTop2LevelDomain(flow[6]) == GlobalVariable.hostnameTop2LevelDomain(item[6])): if abs(float(flow[1]) - float(item[1])) > 10: #flagLargerThanFive = False #print "going to return false" return False self.flowArray.append(flow) #if "apple" in ",".join(flow) and "microsoft" in ",".join(item): #if "apple" in flow[6]: #print "growing tree append:", flow, item if self.queue.empty(): self.queue.put(1) return True else: return False