Exemplo n.º 1
0
        public CcmBridge(string name, string ipPrefix, bool instantiateSshClient = false)
        {
            Name     = name;
            IpPrefix = ipPrefix;
            CcmDir   = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
            if (instantiateSshClient)
            {
                string sshHost     = "TBD";
                int    sshPort     = -1;
                string sshUser     = "******";
                string sshPassword = "******";
                _sshClient = new Renci.SshNet.SshClient(sshHost, sshPort, sshUser, sshPassword);
                _sshClient.Connect();

                _sshShellStream = _sshClient.CreateShellStream("CCM", 80, 60, 100, 100, 1000);
                var outp = new StringBuilder();
                while (true)
                {
                    outp.Append(_sshShellStream.Read());
                    if (outp.ToString().Trim().EndsWith("$"))
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private CCMBridge()
        {
            _ccmDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
            _ssh_client = new Renci.SshNet.SshClient(Options.Default.SSH_HOST, Options.Default.SSH_PORT, Options.Default.SSH_USERNAME, Options.Default.SSH_PASSWORD);
            _ssh_client.Connect();

            _ssh_shellStream = _ssh_client.CreateShellStream("CCM", 80, 60, 100, 100, 1000);
            var outp = new StringBuilder();
            while (true)
            {
                outp.Append(_ssh_shellStream.Read());
                if (outp.ToString().Trim().EndsWith("$"))
                    break;
            }
        }
Exemplo n.º 3
0
        private CCMBridge()
        {
            _ccmDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
            _ssh_client = new Renci.SshNet.SshClient(_ssh_host, _ssh_port, _ssh_username, _ssh_password);
            _ssh_client.Connect();

            _ssh_shellStream = _ssh_client.CreateShellStream("CCM", 80, 60, 100, 100, 1000);
            var outp = new StringBuilder();
            while (true)
            {
                outp.Append(_ssh_shellStream.Read());
                if (outp.ToString().Trim().EndsWith("$"))
                    break;
            }
        }
Exemplo n.º 4
0
        private CCMBridge()
        {
            _ccmDir     = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
            _ssh_client = new Renci.SshNet.SshClient(Options.Default.SSH_HOST, Options.Default.SSH_PORT, Options.Default.SSH_USERNAME, Options.Default.SSH_PASSWORD);
            _ssh_client.Connect();

            _ssh_shellStream = _ssh_client.CreateShellStream("CCM", 80, 60, 100, 100, 1000);
            var outp = new StringBuilder();

            while (true)
            {
                outp.Append(_ssh_shellStream.Read());
                if (outp.ToString().Trim().EndsWith("$"))
                {
                    break;
                }
            }
        }
Exemplo n.º 5
0
        public void Login(string host)
        {
            if (isLoggedIn)
            {
                return;
            }

            client = new Renci.SshNet.SshClient(host, port, username, password);
            client.Connect();

            stream = client.CreateShellStream("xterm", 80, 24, 800, 600, 1024);

            reader           = new StreamReader(stream);
            writer           = new StreamWriter(stream);
            writer.AutoFlush = true;

            isLoggedIn = true;
        }
Exemplo n.º 6
0
        private CCMBridge()
        {
            _ccmDir     = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
            _ssh_client = new Renci.SshNet.SshClient(_ssh_host, _ssh_port, _ssh_username, _ssh_password);
            _ssh_client.Connect();

            _ssh_shellStream = _ssh_client.CreateShellStream("CCM", 80, 60, 100, 100, 1000);
            var outp = new StringBuilder();

            while (true)
            {
                outp.Append(_ssh_shellStream.Read());
                if (outp.ToString().Trim().EndsWith("$"))
                {
                    break;
                }
            }
        }
Exemplo n.º 7
0
        public CcmBridge(string name, string ipPrefix, bool instantiateSshClient = false)
        {
            Name = name;
            IpPrefix = ipPrefix;
            CcmDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
            if (instantiateSshClient)
            {
                string sshHost = "TBD";
                int sshPort = -1;
                string sshUser  = "******";
                string sshPassword = "******";
                _sshClient = new Renci.SshNet.SshClient(sshHost, sshPort, sshUser, sshPassword);
                _sshClient.Connect();

                _sshShellStream = _sshClient.CreateShellStream("CCM", 80, 60, 100, 100, 1000);
                var outp = new StringBuilder();
                while (true)
                {
                    outp.Append(_sshShellStream.Read());
                    if (outp.ToString().Trim().EndsWith("$"))
                        break;
                }
            }
        }