Exemple #1
0
        /// 将分析好的数据添加到列表
        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 + "条";
        }
Exemple #2
0
        /// <summary>
        /// 将分析好的数据添加到列表
        /// </summary>
        /// <param name="packet"></param>
        private void AddDataToList(RawCapture packet)
        {
            Console.Write("AddDataToList");

            try
            {
                string[] rowsLinebuffer = new string[7];
                rowsLinebuffer = rowsBulider.Row(packet, ++packetIndex);
                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);
                    }


                    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.staffNoticeLabel.Text = "今日新增记录" + countBehave + "条";
            this.qqNoticeLabel.Text = "今日新增记录" + countQQ + "条";
        }
Exemple #3
0
        /// <summary>
        /// 选中一行
        /// </summary>
        /// <param name="index">选定的数据行索引值</param>
        private void selectDataGridRow(int index)
        {
            if (index < 0 || index > dataGridPacket.Rows.Count)
            {
                return;
            }
            //获取数据包位置
            int i = Convert.ToInt32(dataGridPacket.Rows[index].Cells[0].Value.ToString());

            if (i > packetList.Count)
            {
                return;
            }
            RawCapture rawPacket = packetList[i - 1];

            treeView1.Nodes.Clear();
            pktInfo.GetProtcolTree(rawPacket);
            richTextBox1.Text = HexConvert.ConvertToHexText(rawPacket.Data);
        }
Exemple #4
0
        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 + "条";
        }