Exemplo n.º 1
0
        public void Strat()
        {
            if (telnet.Connect() == false)
            {
                Console.WriteLine("connect fail ");
            }
            else
            {
                telnet.WaitStr("login");
                telnet.WriteLine("telnet");
                telnet.WaitStr("password");
                telnet.WriteLine("lijie1515");
                telnet.WaitStr("$");
                Console.WriteLine(telnet.GetAndMoveShowData());

                //Console.WriteLine("-------------------------------------------");
                //Console.WriteLine(telnet.SessionLog);
                //Console.WriteLine("-------------------------------------------");



                Console.WriteLine(telnet.GetAndMoveShowData());
                telnet.WriteLine("ls");
                telnet.WaitStr("$");
                Console.WriteLine(telnet.GetAndMoveShowData());

                Console.WriteLine("-------------------------------------------");
                Console.WriteLine(telnet.AllLogData);
                Console.WriteLine("-------------------------------------------");

                Console.ReadLine();
                telnet.OnMesageReport += telnet_OnMesageReport;
                for (int i = 0; i < 10; i++)
                {
                    telnet.WriteLine("netstat");
                }
                telnet.OnMesageReport -= telnet_OnMesageReport;

                Console.ReadLine();
                Console.WriteLine("******************************************");
                Console.WriteLine(telnet.DoRequest("ll", "$ "));
                Console.WriteLine("******************************************");
                Console.WriteLine(telnet.DoRequest("mkdir 123", "$ "));
                Console.WriteLine("******************************************");
                Console.WriteLine(telnet.DoRequest("ll", "$ "));
                Console.WriteLine("******************************************");

                Console.ReadLine();
                telnet.DisConnect();
            }
        }
Exemplo n.º 2
0
 public void ExecutionDeviceClose()
 {
     telnetShell.DisConnect();
     isConnect = false;
 }