Example #1
0
 public virtual void Connect(TargetInfo target)
 {
     this.CreateSSHExec(target);
     try
     {
         this.SSHExec.Connect(target.GetPort());
     }
     catch (JSchException ex)
     {
         throw new SshConnectingException(
             string.Format(
                 "Unable to connect to target machine {0} through port {1} using the user {2}. Check the target address (or host name), port number and that ssh service is running at target machine.",
                 target.GetAddress(), target.GetPort(), target.credentials.GetFullyQualifiedUsername()));
     }
 }
        private SshCommandLineRunner CreateSshCommandLineRunner(TargetInfo target)
        {
            var hostAddress = target.GetAddress();
            var sshPort     = target.GetPort();
            var username    = target.credentials.GetUserName();
            var password    = target.credentials.GetPassword();

            return(new SshCommandLineRunner(hostAddress, username, password, sshPort));
        }
        public SystemInformation GetSystemInformationFrom(TargetInfo target)
        {
            var sshExec = new SshExec(target.GetAddress(), target.credentials.GetUserName(), target.credentials.GetPassword());
            sshExec.Connect(target.GetPort());

            var collectedUnixSystemInformation = SystemInformationCollector.getSysInfo(sshExec);

            return this.CreateSystemInformationInstance(collectedUnixSystemInformation);
        }
        public SystemInformation GetSystemInformationFrom(TargetInfo target)
        {
            var hostAddress = target.GetAddress();
            var username = target.credentials.GetUserName();
            var password = target.credentials.GetPassword();

            var commandRunner = new SshCommandLineRunner(hostAddress, username, password, target.GetPort());
            var collectedUnixSystemInformation = SystemInformationCollector.getSysInfo(commandRunner);
            return CreateSystemInformationInstance(collectedUnixSystemInformation);
        }
        public virtual void Connect(TargetInfo target)
        {
            var connectionPort = target.GetPort(ConnectionType.Telnet);
            this.TelnetConnection = new TelnetConnection(target.GetAddress(), connectionPort);
            this.TelnetConnection.TimeOutLoginMs = 1000;
            this.TelnetConnection.TimeOutReadMs = 30000;
            this.TelnetConnection.CiscoLogin(target.credentials.GetUserName(), target.credentials.GetPassword());

            string adminPass = target.credentials.GetAdminPassword();
            if (!String.IsNullOrEmpty(adminPass))
                this.TelnetConnection.CiscoEnable(adminPass);
        }
 public virtual void Connect(TargetInfo target)
 {
     this.SshCommandLineRunner = CreateSshCommandLineRunner(target);
     try
     {
         this.SshCommandLineRunner.Connect();
     }
     catch (Exception ex)
     {
         throw new SshConnectingException(
                   string.Format(
                       "Unable to connect to target machine {0} through port {1} using the user {2}. Check the target address (or host name), port number and that ssh service is running at target machine. Error Message: '{3}'",
                       target.GetAddress(), target.GetPort(), target.credentials.GetFullyQualifiedUsername(), ex.Message));
     }
 }
Example #7
0
 public virtual void Connect(TargetInfo target)
 {
     this.SshCommandLineRunner = CreateSshCommandLineRunner(target);
     try
     {
         this.SshCommandLineRunner.Connect();
     }
     catch (Exception ex)
     {
         throw new SshConnectingException(
             string.Format(
                 "Unable to connect to target machine {0} through port {1} using the user {2}. Check the target address (or host name), port number and that ssh service is running at target machine. Error Message: '{3}'",
                 target.GetAddress(), target.GetPort(), target.credentials.GetFullyQualifiedUsername(), ex.Message));
     }
 }
Example #8
0
        public virtual void Connect(TargetInfo target)
        {
            var connectionPort = target.GetPort(ConnectionType.Telnet);

            this.TelnetConnection = new TelnetConnection(target.GetAddress(), connectionPort);
            this.TelnetConnection.TimeOutLoginMs = 1000;
            this.TelnetConnection.TimeOutReadMs  = 30000;
            this.TelnetConnection.CiscoLogin(target.credentials.GetUserName(), target.credentials.GetPassword());

            string adminPass = target.credentials.GetAdminPassword();

            if (!String.IsNullOrEmpty(adminPass))
            {
                this.TelnetConnection.CiscoEnable(adminPass);
            }
        }
Example #9
0
        private SshCommandLineRunner CreateSshCommandLineRunner(TargetInfo target)
        {
            var hostAddress = target.GetAddress();
            var sshPort = target.GetPort();
            var username = target.credentials.GetUserName();
            var password = target.credentials.GetPassword();

            return new SshCommandLineRunner(hostAddress, username, password, sshPort);
        }
        public SystemInformation GetSystemInformationFrom(TargetInfo target)
        {
            var hostAddress = target.GetAddress();
            var username    = target.credentials.GetUserName();
            var password    = target.credentials.GetPassword();

            var commandRunner = new SshCommandLineRunner(hostAddress, username, password, target.GetPort());
            var collectedUnixSystemInformation = SystemInformationCollector.getSysInfo(commandRunner);

            return(CreateSystemInformationInstance(collectedUnixSystemInformation));
        }