internal SessionListTreeNode(PacketParser.NetworkHost host, bool sessionsAreIncoming)
 {
     this.host = host;
     this.sessionsAreIncoming = sessionsAreIncoming;
     if (sessionsAreIncoming)
     {
         int sessionCount = host.IncomingSessionList.Count;
         this.Text = "Incoming sessions: " + sessionCount;
         if (sessionCount > 0)
         {
             this.Nodes.Add("dummie node");
             this.ImageKey = "incoming";
         }
     }
     else
     {
         int sessionCount = host.OutgoingSessionList.Count;
         this.Text = "Outgoing sessions: " + sessionCount;
         if (sessionCount > 0)
         {
             this.Nodes.Add("dummie node");
             this.ImageKey = "outgoing";
         }
     }
     this.SelectedImageKey = this.ImageKey;
 }
Ejemplo n.º 2
0
 public static string GetOsImageKey(PacketParser.NetworkHost networkHost)
 {
     if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.Windows)
     {
         return("windows");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.Linux)
     {
         return("linux");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.MacOS || networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.Apple_iOS)
     {
         return("apple");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.UNIX)
     {
         return("unix");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.FreeBSD)
     {
         return("freebsd");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.NetBSD)
     {
         return("netbsd");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.Solaris)
     {
         return("solaris");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.Cisco)
     {
         return("cisco");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.Android)
     {
         return("android");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.ABB)
     {
         return("abb");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.Siemens)
     {
         return("siemens");
     }
     else if (networkHost.OS == PacketParser.NetworkHost.OperatingSystemID.ICS_device)
     {
         return("ICS device");
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 3
0
 internal SubNetworkHostTreeNode(PacketParser.NetworkHost sourceHost, PacketParser.NetworkHost destinationHost, PacketParser.NetworkPacketList packetList)
 {
     this.sourceHost      = sourceHost;
     this.destinationHost = destinationHost;
     this.packetList      = packetList;
     this.Text            = sourceHost.ToString() + " -> " + destinationHost.ToString() + " : " + packetList.ToString();
     if (packetList.Count > 0)
     {
         this.Nodes.Add("dummie node");//so that it can be expanded
     }
 }
 //private TreeNode treeNode;
 internal SentReceivedTreeNode(PacketParser.NetworkHost host, bool hostIsSender)
 {
     this.host         = host;
     this.hostIsSender = hostIsSender;
     if (hostIsSender)
     {
         this.Text     = "Sent: " + host.SentPackets.ToString();
         this.ImageKey = "sent";
     }
     else  //host is reciever
     {
         this.Text     = "Received: " + host.ReceivedPackets.ToString();
         this.ImageKey = "received";
     }
     this.SelectedImageKey = this.ImageKey;
 }
Ejemplo n.º 5
0
        internal NetworkHostTreeNode(PacketParser.NetworkHost networkHost, Func <System.Net.IPAddress, string> ipLocator, ToolInterfaces.IHostDetailsGenerator hostDetailsGenerator, Func <System.Net.NetworkInformation.PhysicalAddress, System.Net.IPAddress, IEnumerable <NetworkHostTreeNode> > macSiblingsFunction = null)
        {
            this.networkHost          = networkHost;
            this.ipLocator            = ipLocator;
            this.hostDetailsGenerator = hostDetailsGenerator;
            this.macSiblingsFunction  = macSiblingsFunction;

            this.Text = networkHost.ToString();
            this.Nodes.Add("dummie node");

            if (networkHost.SentPackets.Count == 0)
            {
                this.ForeColor = System.Drawing.Color.Gray;
            }

            if (this.networkHost.FaviconKey != null)
            {
                this.ImageKey = this.networkHost.FaviconKey;
            }
            else if (GetIpImageKey() != null)
            {
                this.ImageKey = GetIpImageKey();
            }
            else if (GetOsImageKey() != null)
            {
                this.ImageKey = GetOsImageKey();
            }
            else if (networkHost.SentPackets.Count > 0)
            {
                this.ImageKey = "computer";
            }
            else
            {
                this.ImageKey = "white";
            }

            this.SelectedImageKey = this.ImageKey;


            this.ToolTipText = "Sent packets: " + networkHost.SentPackets.Count + "\nReceived packets: " + networkHost.ReceivedPackets;
        }
        internal NetworkHostTreeNode(PacketParser.NetworkHost networkHost, ToolInterfaces.IIPLocator ipLocator, ToolInterfaces.IHostDetailsGenerator hostDetailsGenerator)
        {
            this.networkHost          = networkHost;
            this.ipLocator            = ipLocator;
            this.hostDetailsGenerator = hostDetailsGenerator;

            this.Text = networkHost.ToString();
            this.Nodes.Add("dummie node");

            if (networkHost.SentPackets.Count == 0)
            {
                this.ForeColor = System.Drawing.Color.Gray;
            }

            if (this.networkHost.FaviconKey != null)
            {
                this.ImageKey = this.networkHost.FaviconKey;
            }
            else if (GetIpImageKey() != null)
            {
                this.ImageKey = GetIpImageKey();
            }
            else if (GetOsImageKey() != null)
            {
                this.ImageKey = GetOsImageKey();
            }
            else if (networkHost.SentPackets.Count > 0)
            {
                this.ImageKey = "computer";
            }
            else
            {
                this.ImageKey = "white";
            }

            this.SelectedImageKey = this.ImageKey;


            this.ToolTipText = "Sent packets: " + networkHost.SentPackets.Count + "\nReceived packets: " + networkHost.ReceivedPackets;
        }
            internal ServiceListTreeNode(PacketParser.NetworkHost host)
            {
                this.host = host;
                {
                    StringBuilder sb = new StringBuilder("Open TCP Ports:");
                    foreach (uint port in host.OpenTcpPorts)
                    {
                        sb.Append(" " + port);
                        if (host.NetworkServiceMetadataList.ContainsKey((ushort)port) && host.NetworkServiceMetadataList[(ushort)port].ApplicationLayerProtocol != PacketParser.ApplicationLayerProtocol.Unknown)
                        {
                            sb.Append(" (" + host.NetworkServiceMetadataList[(ushort)port].ApplicationLayerProtocol.ToString() + ")");
                        }
                    }

                    this.Text = sb.ToString();
                    //this.Nodes.Add(sb.ToString());
                }
                if (host.NetworkServiceMetadataList.Count > 0)
                {
                    this.Nodes.Add("dummie node");//so that it can be expanded
                }
            }
Ejemplo n.º 8
0
 //private TreeNode treeNode;
 internal SentReceivedTreeNode(PacketParser.NetworkHost host, bool hostIsSender)
 {
     this.host         = host;
     this.hostIsSender = hostIsSender;
     if (hostIsSender)
     {
         this.Text = "Sent: " + host.SentPackets.ToString();
         if (host.SentPackets.Count > 0)
         {
             this.Nodes.Add("dummie node");//so that it can be expanded
             this.ImageKey = "sent";
         }
     }
     else  //host is reciever
     {
         this.Text = "Received: " + host.ReceivedPackets.ToString();
         if (host.ReceivedPackets.Count > 0)
         {
             this.Nodes.Add("dummie node");//so that it can be expanded
             this.ImageKey = "received";
         }
     }
     this.SelectedImageKey = this.ImageKey;
 }