Esempio n. 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 + "条";
        }
Esempio n. 2
0
        public List <ProcessingQQLoginLogout> SearchQQ(MySqlConnection myConnect, string startTime, string endTime, string qqNum, bool login, bool leave)
        {
            List <ProcessingQQLoginLogout> datalist = new List <ProcessingQQLoginLogout>();

            myConnect.Open();
            string       sql   = "";
            MySqlCommand myCmd = null;

            sql = "select * from qq_info where time >= '" + startTime + "' and time <= '" + endTime + "'";
            if (qqNum != "")
            {
                sql += "and qqnum = '" + qqNum + "'";
            }
            if (login && (!leave))
            {
                sql += "and qqLogin = "******"'上线'";
            }
            if ((!login) && leave)
            {
                sql += "and qqLogin = "******"'下线'";
            }
            if (login && leave)
            {
                sql += "and qqLogin = "******"'上线'" + "or qqLogin = "******"'下线'";
            }
            Debug.WriteLine(sql);
            try
            {
                myCmd = new MySqlCommand(get_uft8(sql), myConnect);
                MySqlDataReader         reader = myCmd.ExecuteReader();
                ProcessingQQLoginLogout row;
                while (reader.Read())
                {
                    row      = new ProcessingQQLoginLogout();
                    row.QqID = reader[1].ToString();
                    row.QqIP = reader[2].ToString();
                    if (reader[3].ToString() == "上线")
                    {
                        row.QqLogin = 1;
                    }
                    else
                    {
                        row.QqLogin = 2;
                    }
                    row.Time = reader[4].ToString();
                    datalist.Add(row);
                }
            }
            finally
            {
                myConnect.Close();
            }
            return(datalist);
        }
Esempio n. 3
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 + "条";
        }
Esempio n. 4
0
        private string SetSQLString(ProcessingQQLoginLogout qq)
        {
            string qqnum;
            string IP;
            string logn_out;
            string time;

            qqnum = qq.QqID;
            IP    = qq.QqIP;
            if (qq.QqLogin == 1)
            {
                logn_out = "上线";
            }
            else
            {
                logn_out = "下线";
            }
            time = qq.Time;
            return("insert into qq_info(qqnum,qqIP,qqLogin,time) values('" + qqnum + "','" + IP + "','" + logn_out + "','" + time + "')");
        }
Esempio n. 5
0
        private void ShowDataRows(ProcessingQQLoginLogout qqll)
        {
            try
            {
                rowsLine[0] = qqll.Time;
                rowsLine[1] = qqll.QqIP;
                rowsLine[2] = qqll.QqID;
                if (qqll.QqLogin == 1)
                {
                    rowsLine[3] = "上线";
                }
                else
                {
                    rowsLine[3] = "下线";
                }

                monitoringResultslistView.Rows.Add(rowsLine);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 6
0
        public void SaveAll(MySqlConnection myConnect, ProcessingQQLoginLogout rowData)
        {
            myConnect.Open();

            string sql = "";

            MySqlCommand myCmd = null;

            ///
            sql = SetSQLString(rowData);
            Debug.WriteLine(sql);
            try
            {
                myCmd = new MySqlCommand(get_uft8(sql), myConnect);
                myCmd.ExecuteNonQuery();
            }
            finally
            {
                myConnect.Close();
            }

            //MySqlCommand mycmd = new MySqlCommand("insert into buyer(name,password,email) values('小王','dikd3939','*****@*****.**')", mycon);
        }
Esempio n. 7
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 + "条";
        }