/// <summary> /// Actually starts the demo /// </summary> /// <param name="Server">Reference to the Telnet Server</param> private static void Start(TelnetServer Server) { NetworkInterface[] Ips = NetworkInterface.GetAllNetworkInterfaces(); for (int IpCnt = 0; IpCnt < Ips.Length; ++IpCnt) { Server.Print("Network interface " + IpCnt.ToString() + ":"); Server.Print("MAC Address: " + NetworkInfo.MacToString(Ips[IpCnt].PhysicalAddress)); Server.Print("- IP Address: " + Ips[IpCnt].IPAddress.ToString() + " (" + Ips[IpCnt].SubnetMask.ToString() + ")"); Server.Print("- Gateway: " + Ips[IpCnt].GatewayAddress.ToString()); for (int DnsCnt = 0; DnsCnt < Ips[IpCnt].DnsAddresses.Length; ++DnsCnt) { Server.Print("- DNS-server " + DnsCnt.ToString() + ": " + Ips[IpCnt].DnsAddresses[DnsCnt].ToString()); } } Server.Print("Connected to: " + Server.RemoteAddress); }
/// <summary> /// Triggered when a command has been given /// </summary> /// <param name="Shell">Reference to the shell</param> /// <param name="Arguments">Command line arguments</param> /// <param name="SuspressError">Set to 'true' if you could do anything with the command</param> /// <param name="Time">Current timestamp</param> private static void Shell_OnCommandReceived(ShellCore Shell, string[] Arguments, ref bool SuspressError, DateTime Time) { if (Arguments[0].ToUpper() == "NETWORKINFO") { NetworkInfo.Start(Shell.TelnetServer); SuspressError = true; } if (Arguments[0].ToUpper() == "HELP") { if (Arguments.Length == 1 || Arguments[1].ToUpper() == "NETWORKINFO") { Shell.TelnetServer.Print("NETWORKINFO Shows details about all network interfaces"); SuspressError = true; } } }