Ejemplo n.º 1
0
        public Message(SharpPcap.RawCapture packet)
        {
            PacketDotNet.TcpPacket tcpPacket = (PacketDotNet.TcpPacket)PacketDotNet.Packet.ParsePacket(packet.LinkLayerType, packet.Data).PayloadPacket.PayloadPacket;
            this.packets = new List <PacketDotNet.TcpPacket>();
            this.packets.Add(tcpPacket);
            this.Ack = tcpPacket.AcknowledgmentNumber;

            this.RawData     = packet.Data;
            this.PayloadData = tcpPacket.PayloadData;
            this.Length      = tcpPacket.PayloadData.Length;

            this.Timestamp = packet.Timeval.Date;

            this.Complete = this.Length != 1460;
        }
Ejemplo n.º 2
0
        public void AddPacket(SharpPcap.RawCapture packet)
        {
            PacketDotNet.TcpPacket tcpPacket = (PacketDotNet.TcpPacket)PacketDotNet.Packet.ParsePacket(packet.LinkLayerType, packet.Data).PayloadPacket.PayloadPacket;

            if (tcpPacket.AcknowledgmentNumber == this.Ack)
            {
                packets.Add(tcpPacket);

                this.Complete = tcpPacket.PayloadData.Length != 1460;

                byte[] raw = new byte[tcpPacket.PayloadData.Length + this.PayloadData.Length];

                Array.Copy(this.PayloadData, raw, this.PayloadData.Length);
                Array.Copy(tcpPacket.PayloadData, 0, raw, this.PayloadData.Length, tcpPacket.PayloadData.Length);
                this.PayloadData = raw;
                this.Length      = this.PayloadData.Length;
            }
        }
Ejemplo n.º 3
0
        public packet(SharpPcap.RawCapture pPacket)
        {
            var timestamp = pPacket.Timeval.Date;

            this.layer    = pPacket.LinkLayerType;
            this.time     = timestamp.Hour.ToString() + ":" + timestamp.Minute.ToString() + ":" + timestamp.Second.ToString() + "," + timestamp.Millisecond.ToString();
            this.srcIp    = "";
            this.destIp   = "";
            this.protocol = "";
            this.info     = "";
            this.color    = "White";

            this.pPacket = pPacket;
            this.rPacket = PacketDotNet.Packet.ParsePacket(pPacket.LinkLayerType, pPacket.Data);

            this.frame_info    = new Dictionary <string, string>();
            this.ethernet_info = new Dictionary <string, string>();

            this.ip_info  = new Dictionary <string, string>();
            this.arp_info = new Dictionary <string, string>();

            this.icmp_info = new Dictionary <string, string>();
            this.igmp_info = new Dictionary <string, string>();
            this.tcp_info  = new Dictionary <string, string>();
            this.udp_info  = new Dictionary <string, string>();

            this.application_info = new Dictionary <string, string>();
            this.application_byte = null;

            this.mf     = false;
            this.df     = true;
            this.offset = 0;


            analysis_packet();

            // 计算校验和
            if (this.tcp_info.Count > 0 && this.tcp_info["Checksum(校验和)"] != this.tcp_info["tcpPacket计算校验和函数计算结果"])
            {
                this.color = "Red";
            }
        }
Ejemplo n.º 4
0
        public packet(SharpPcap.RawCapture pPacket)
        {
            var timestamp = pPacket.Timeval.Date;
            this.layer = pPacket.LinkLayerType;
            this.time = timestamp.Hour.ToString() + ":" + timestamp.Minute.ToString() + ":" + timestamp.Second.ToString() + "," + timestamp.Millisecond.ToString();
            this.srcIp = "";
            this.destIp = "";
            this.protocol = "";
            this.info = "";
            this.color = "White";

            this.pPacket = pPacket;
            this.rPacket = PacketDotNet.Packet.ParsePacket(pPacket.LinkLayerType, pPacket.Data);

            this.frame_info = new Dictionary<string, string>();
            this.ethernet_info = new Dictionary<string, string>();

            this.ip_info = new Dictionary<string, string>();
            this.arp_info = new Dictionary<string, string>();

            this.icmp_info = new Dictionary<string, string>();
            this.igmp_info = new Dictionary<string, string>();
            this.tcp_info = new Dictionary<string, string>();
            this.udp_info = new Dictionary<string, string>();

            this.application_info = new Dictionary<string, string>();
            this.application_byte = null;

            analysis_packet();

            // 计算校验和
            if (this.tcp_info.Count > 0 && this.tcp_info["Checksum(校验和)"] != this.tcp_info["tcpPacket计算校验和函数计算结果"])
            {
                this.color = "Red";
            }
        }