Ejemplo n.º 1
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex > 0)
            {
                Tamir.IPLib.Packets.Packet           packet   = packets[listBox1.SelectedIndex];
                Be.Windows.Forms.DynamicByteProvider provider = new Be.Windows.Forms.DynamicByteProvider(packet.Data);
                this.hexBox1.ByteProvider = provider;
                this.textBox1.Text        = System.Text.ASCIIEncoding.Default.GetString(packet.Data);
                this.treeView1.Nodes.Clear();
                TreeNode header = this.treeView1.Nodes.Add("Header");
                header.Nodes.Add(string.Format("Length:{0}", packet.Header.Length));
                System.Text.StringBuilder sb = new StringBuilder();
                foreach (byte b in packet.Header)
                {
                    sb.Append(b.ToString("00"));
                    sb.Append(" ");
                }
                header.Nodes.Add(string.Format("Data:{0}", sb.ToString()));
                header.Nodes.Add(string.Format("Capture Length:{0}", packet.PcapHeader.CaptureLength.ToString()));
                header.Nodes.Add(string.Format("Packet Length:{0}", packet.PcapHeader.PacketLength.ToString()));
                header.Nodes.Add(string.Format("Date:{0}", packet.PcapHeader.Date.ToString()));
                header.Nodes.Add(string.Format("Microseconds:{0}", packet.PcapHeader.MicroSeconds.ToString()));
                header.Nodes.Add(string.Format("Seconds:{0}", packet.PcapHeader.Seconds.ToString()));

                this.treeView1.ExpandAll();
            }
        }
Ejemplo n.º 2
0
 void dev_PcapOnPacketArrival(object sender, Tamir.IPLib.Packets.Packet packet)
 {
     lock (packets) {
         packets.Add(packet);
         newpackets.Add(packet);
     }
     if (dev.PcapDumpOpened)
     {
         dev.PcapDump(packet);
     }
     this.Invoke(updater);
 }
Ejemplo n.º 3
0
 private void device_PcapOnPacketArrival(object sender, Tamir.IPLib.Packets.Packet packet)
 {
     Console.WriteLine(packet);
 }