Package com.trilead.ssh2

Examples of com.trilead.ssh2.SFTPv3Client


    }
  }

  private SFTPv3Client FtpClient() throws Exception {
    if (sftpClient == null) {
      sftpClient = new SFTPv3Client(this.getSshConnection());
    }
    return sftpClient;
  }
View Full Code Here


   */
  protected Connection getBaseAuthentication() throws Exception {

    try { // to connect and authenticate
      boolean isAuthenticated = false;
      this.setSshConnection(new Connection(this.host, this.port));

      if (proxyHost != null && this.proxyHost.length() > 0) {
        if (this.proxyUser != null && this.proxyUser.length() > 0) {
          this.getSshConnection().setProxyData(new HTTPProxyData(this.proxyHost, this.proxyPort));
        }
View Full Code Here

    @SuppressWarnings("unused")
    final String conMethodName = conClassName + "::Connect";

    try {
      isConnected = false;
      this.setSshConnection(new Connection(pstrHostName, pintPortNumber));

    }
    catch (Exception e) {
      if (this.getSshConnection() != null)
        try {
View Full Code Here

    try {
      isConnected = false;
      String strHostName = objCO.getHost().Value();
      int intPortNo = objCO.getPort().value();
      this.setSshConnection(new Connection(strHostName, intPortNo));

      if (objCO.getProxy_host().IsNotEmpty()) {
        HTTPProxyData objProxy = null;
        if (objCO.getProxy_user().IsEmpty()) {
          objProxy = new HTTPProxyData(objCO.getProxy_host().Value(), objCO.getProxy_port().value());
View Full Code Here

     */
    public Connection getBaseAuthentication() throws Exception {
       
        try { // to connect and authenticate
            boolean isAuthenticated = false;
            this.setSshConnection(new Connection(this.getHost(), this.getPort()));
               
            if (this.getProxyHost() != null && this.getProxyHost().length() > 0) {
                if (this.getProxyUser() != null && this.getProxyUser().length() > 0) {
                    this.getSshConnection().setProxyData(new HTTPProxyData(this.getProxyHost(), this.getProxyPort()));
                } else {
View Full Code Here

    }
   
    public void connect() throws Exception{
      try { // to connect and authenticate
            boolean isAuthenticated = false;
            sshConnection = new Connection(this.getHost(), this.getPort());
               
            if (this.getProxyHost() != null && this.getProxyHost().length() > 0) {
                if (this.getProxyUser() != null && this.getProxyUser().length() > 0) {                   
                    sshConnection.setProxyData(new HTTPProxyData(this.getProxyHost(), this.getProxyPort(), this.getProxyUser(), this.getProxyPassword()));
                } else {
View Full Code Here

    try {
      host = phost;
      port = pport;
      logger.debug(String.format("Try to connect to host '%1$s' at Port '%2$d'.", host, port));
      if (isConnected() == false) {
        sshConnection = new Connection(host, port);
        sshConnection.connect();
        isConnected = true;
        logger.debug(String.format("Connected to '%1$s' at Port '%2$d'.", host, port));
        LogReply();
      }
View Full Code Here

    final String conMethodName = conClassName + "::getBaseAuthentication";

    try { // to connect and authenticate
      boolean isAuthenticated = false;
      this.setSshConnection(new Connection(Options().host.Value(), objOptions.port.value()));

      if (objOptions.proxy_host.IsEmpty() == false) {
        if (objOptions.proxy_user.IsEmpty() == false) {
          this.getSshConnection().setProxyData(new HTTPProxyData(objOptions.proxy_host.Value(), objOptions.proxy_port.value()));
        }
View Full Code Here

    setURI(remote.getURI());
  }
 
  public void connect() throws HgAuthFailedException, HgRemoteConnectionException, HgRuntimeException {
    try {
      conn = new Connection(uri.getHost(), uri.getPort() == -1 ? 22 : uri.getPort());
      conn.connect();
      authenticateClient();
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Failed to establish connection").setServerInfo(getServerLocation());
    }
View Full Code Here

          for (int j=0; j<ipList.getLength(); j++) {
            Element itemVariableElement = (Element) ipList.item(j);
           
            s_logger.info("Attempting to SSH into agent " + itemVariableElement.getTextContent());
            try {
              Connection conn = new Connection(itemVariableElement.getTextContent());
            conn.connect(null, 60000, 60000);

            s_logger.info("SSHed successfully into agent " + itemVariableElement.getTextContent());

            boolean isAuthenticated = conn.authenticateWithPassword("root",
                "password");

            if (isAuthenticated == false) {
              s_logger.info("Authentication failed for root with password");
              return false;
            }
           
            Session sess = conn.openSession();
            s_logger.info("Executing : " + commandElement.getTextContent());
            sess.execCommand(commandElement.getTextContent());
            Thread.sleep(60000);
            sess.close();
            conn.close();
           
            } catch (Exception ex) {
              s_logger.error(ex);
              return false;
           
View Full Code Here

TOP

Related Classes of com.trilead.ssh2.SFTPv3Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.