def load_single(self, items): from flow import FlowRecord rec = FlowRecord() rec.start_time = items[0].strip() rec.duration = items[1].strip() rec.protocol = items[2].strip() rec.src_ip = items[3].strip() rec.src_port = items[4].strip() rec.bidirectional = items[5].strip() rec.dest_ip = items[6].strip() rec.dest_port = items[7].strip() rec.state = items[8].strip() rec.sTos = items[9].strip() rec.dTos = items[10].strip() rec.total_pckts = items[11].strip() rec.total_bytes = items[12].strip() rec.total_srcbytes = items[13].strip() rec.label = items[14].strip() return rec
def get_flow_record(self): from flow import FlowRecord f = FlowRecord() f.start_time = self.start_time f.duration = self.last_time - self.start_time f.protocol = self.protocol.lower() f.src_port = self.src_port f.dest_port = self.dst_port f.src_ip = self.src_ip f.dest_ip = self.dst_ip f.bidirectional = "->" f.state = "" f.sTos = 0 f.dTos = 0 f.total_pckts = self.packets f.total_bytes = self.size f.total_srcbytes = self.size return f