/// 将分析好的数据添加到列表 private void ShowDataRows(RawCapture packet) { try { temp_packetIndex = packetIndex + 1; dataGridPacket.Rows.Add(rowsBulider.Row(packet, temp_packetIndex));//加载DataGridRows; string[] rowsLinebuffer = new string[7]; rowsLinebuffer = rowsBulider.Row(packet, ++packetIndex); Console.WriteLine("rowsLinebuffer is " + rowsLinebuffer.Length); if (rowsLinebuffer[1] == "TCP" || rowsLinebuffer[1] == "SMTP" || rowsLinebuffer[1] == "POP3" || rowsLinebuffer[1] == "HTTP" || rowsLinebuffer[1] == "OICQ") { rowData = new ProcessingAllData(); rowData.Id = rowsLinebuffer[0]; rowData.Protocol = rowsLinebuffer[1]; rowData.Length = rowsLinebuffer[2]; rowData.SourceAddress = rowsLinebuffer[3]; rowData.DestinationAddress = rowsLinebuffer[4]; rowData.HardwareType = rowsLinebuffer[5]; rowData.Time = rowsLinebuffer[6]; rowData.BinaryData = packet.Data; rowData.Data = HexConvert.ConvertToAscii(packet.Data); //添加总的数据 lock (padList.SyncRoot) { padList.Add(rowData); } //saveAllData.SaveAll(saveAllData.MyConnect,rowData); if (rowsLinebuffer[1] == "OICQ") { pqll = new ProcessingQQLoginLogout(); countQQ += pqll.Analysis(rowData); if (pqll.QqLogin == 1 || pqll.QqLogin == 2) { lock (pqllList.SyncRoot) { pqllList.Add(pqll); //这里写存入数据库的代码 } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } this.qqNoticeLabel.Text = "已捕获QQ上下线记录" + countQQ + "条"; }
private void ShowDataRows(RawCapture packet) { try { temp_packetIndex = packetIndex + 1; dataGridPacket.Rows.Add(rowsBulider.Row(packet, temp_packetIndex));//加载DataGridRows; string[] rowsLinebuffer = new string[7]; rowsLinebuffer = rowsBulider.Row(packet, ++packetIndex); //Console.WriteLine("rowsLinebuffer的长度是:"+ rowsLinebuffer.Length); if (rowsLinebuffer[1] == "TCP" || rowsLinebuffer[1] == "SMTP" || rowsLinebuffer[1] == "POP3" || rowsLinebuffer[1] == "HTTP" || rowsLinebuffer[1] == "OICQ") { rowData = new ProcessingAllData(); rowData.Id = rowsLinebuffer[0]; rowData.Protocol = rowsLinebuffer[1]; rowData.Length = rowsLinebuffer[2]; rowData.SourceAddress = rowsLinebuffer[3]; rowData.DestinationAddress = rowsLinebuffer[4]; rowData.HardwareType = rowsLinebuffer[5]; //Console.WriteLine("305 索引前rowsLinebuffer的长度是:" + rowsLinebuffer.Length); rowData.Time = rowsLinebuffer[6]; //Console.WriteLine("308 索引后rowsLinebuffer的长度是:" + rowsLinebuffer.Length); rowData.BinaryData = packet.Data; //? rowData.Data = HexConvert.ConvertToAscii(packet.Data); //Console.WriteLine("311 rowsLinebuffer的长度是:" + rowsLinebuffer.Length); //添加总的数据 lock (padList.SyncRoot) { padList.Add(rowData); } if (rowsLinebuffer[1] == "OICQ") { pqll = new ProcessingQQLoginLogout(); countQQ += pqll.Analysis(rowData); if (pqll.QqLogin == 1 || pqll.QqLogin == 2) { lock (pqllList.SyncRoot) { pqllList.Add(pqll); //这里写存入数据库的代码 saveAllData.SaveAll(saveAllData.MyConnect, pqll); } } } //员工行为 if (rowsLinebuffer[1] == "TCP" || rowsLinebuffer[1] == "HTTP") { pb = new ProcessingBehave(); String key = pb.Analysis(rowData, ht, pbList); if (!key.Equals("key")) { ht.Remove(key); countBehave++; saveAllData.SaveAll(saveAllData.MyConnect, pb); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } this.qqNoticeLabel.Text = "已捕获QQ上下线记录" + countQQ + "条"; this.staffNoticeLabel.Text = "已捕获影音娱乐记录" + countBehave + "条"; }