예제 #1
0
        private void OnNewPacket(PacketMonitor pm, Packet p)
        {
            // add the new packet to the list
            m_Packets.Add(p);
            m_PacketsSize += p.TotalLength;

            this.Invoke(new UpdatePacketList(OnUpdatePacketList), p);
            //PacketList.Items.Add(new ListViewItem(new string[] { p.Time.ToString(), p.Protocol.ToString(), p.Source, p.Destination, p.TotalLength.ToString() }));
            //StatusBar.Text = string.Format("Intercepted {0} packet(s) [{1} bytes]", m_Packets.Count, m_PacketsSize);
            //UpdatePacketList
        }
예제 #2
0
 private void Initialize()
 {
     // get all interfaces on this computer and list them
     IPAddress[] hosts = Dns.Resolve(Dns.GetHostName()).AddressList;
     if (hosts.Length == 0)
     {
         throw new NotSupportedException("This computer does not have non-loopback interfaces installed!");
     }
     for (int i = 0; i < hosts.Length; i++)
     {
         MonitorMenuItem.MenuItems.Add(hosts[i].ToString(), new EventHandler(this.OnHostsClick));
         HostsMenu.MenuItems.Add(hosts[i].ToString(), new EventHandler(this.OnHostsClick));
     }
     m_PacketMonitors = new PacketMonitor[HostsMenu.MenuItems.Count];
     for (int i = 0; i < m_PacketMonitors.Length; i++)
     {
         m_PacketMonitors[i]            = new PacketMonitor(hosts[i]);
         m_PacketMonitors[i].NewPacket += new NewPacketEventHandler(this.OnNewPacket);
     }
     m_Packets = new ArrayList();
 }
예제 #3
0
		private void OnNewPacket(PacketMonitor pm, Packet p) {
			// add the new packet to the list
			m_Packets.Add(p);
			m_PacketsSize += p.TotalLength;

            this.Invoke(new UpdatePacketList(OnUpdatePacketList), p);
			//PacketList.Items.Add(new ListViewItem(new string[] { p.Time.ToString(), p.Protocol.ToString(), p.Source, p.Destination, p.TotalLength.ToString() }));
			//StatusBar.Text = string.Format("Intercepted {0} packet(s) [{1} bytes]", m_Packets.Count, m_PacketsSize);
            //UpdatePacketList
		}
예제 #4
0
		private void Initialize() {
			// get all interfaces on this computer and list them
			IPAddress[] hosts = Dns.Resolve(Dns.GetHostName()).AddressList;
			if (hosts.Length == 0)
				throw new NotSupportedException("This computer does not have non-loopback interfaces installed!");
			for(int i = 0; i < hosts.Length; i++) {
				MonitorMenuItem.MenuItems.Add(hosts[i].ToString(), new EventHandler(this.OnHostsClick));
				HostsMenu.MenuItems.Add(hosts[i].ToString(), new EventHandler(this.OnHostsClick));
			}
			m_PacketMonitors = new PacketMonitor[HostsMenu.MenuItems.Count];
			for(int i = 0; i < m_PacketMonitors.Length; i++) {
				m_PacketMonitors[i] = new PacketMonitor(hosts[i]);
				m_PacketMonitors[i].NewPacket += new NewPacketEventHandler(this.OnNewPacket);
			}
			m_Packets = new ArrayList();
		}