Package com.trilead.ssh2.transport

Examples of com.trilead.ssh2.transport.ClientServerHello


  private void executeCommand(String command, int logLevel) throws Exception{
    Session session = getSshConnection().openSession();
    try{
      session.execCommand(command);
      spooler_log.log(logLevel,"output to stdout for remote command: " + command);
      stdout = new StreamGobbler(this.getSshSession().getStdout());
      stderr = new StreamGobbler(this.getSshSession().getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));

      while (true) {
        String line = stdoutReader.readLine();
        if (line == null) break;
View Full Code Here


            }

            this.getSshSession().execCommand(currentCommand);

            getLogger().debug("output to stdout for remote command: " + normalizedPassword(this.getCommands()[i]));
            stdout = new StreamGobbler(this.getSshSession().getStdout());
            stderr = new StreamGobbler(this.getSshSession().getStderr());
            BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
            int pid = 0;
            while (true) {
              String line = stdoutReader.readLine();
              if (line == null)
View Full Code Here

      session = this.getSshConnection().openSession();
      getLogger().debug9("Executing command " + checkShellCommand);
      session.execCommand(checkShellCommand);

      getLogger().debug9("output to stdout for remote command: " + checkShellCommand);
      stdout = new StreamGobbler(session.getStdout());
      stderr = new StreamGobbler(session.getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
      String stdOut = "";
      while (true) {
        String line = stdoutReader.readLine();
        if (line == null)
View Full Code Here

    }
    try {
      session = conn.openSession();
      final String path = uri.getPath();
      session.execCommand(String.format("hg -R %s serve --stdio", path.charAt(0) == '/' ? path.substring(1) : path));
      remoteErr = new StreamGobbler(session.getStderr());
      remoteOut = new StreamGobbler(session.getStdout());
      remoteIn = session.getStdin();
      sessionUse = 1;
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Failed to create ssh session", ex);
    }
View Full Code Here

      sess = startProcess(commands);

      OutputStuff ndxOutput = new OutputStuff();
      ndxOutput.output(sess.getStdin(), ndxCommands);

      InputStream stdout = new StreamGobbler(sess.getStdout());
      commandResult = new BufferedReader(new InputStreamReader(stdout));

      ndxCommands = GromacsCommandBuilder.getInstance()
          .createRenameGroupNdxCommand(commandResult, groupName);
View Full Code Here

    DataHandler handler = getHandler();
    handler.delete(commands.get(4));
  }

  private void outputStdout(InputStream stream) throws IOException {
    InputStream stdout = new StreamGobbler(stream);
    BufferedReader commandResult = new BufferedReader(
        new InputStreamReader(stdout));
    try {
      String s;
      while ((s = commandResult.readLine()) != null) {
View Full Code Here

    /**
     * Compresses a string into an integer with MD5.
     */
    private int md5(String s) {
        MD5 md5 = new MD5();
        md5.update(s.getBytes());
        byte[] digest = new byte[16];
        md5.digest(digest);

        // 16 bytes -> 4 bytes
        for (int i=0; i<4; i++)
            digest[i] ^= digest[i+4]+digest[i+8]+digest[i+12];
        return (b2i(digest[0])<< 24)|(b2i(digest[1])<<16)|(b2i(digest[2])<< 8)|b2i(digest[3]);
View Full Code Here

            lock(Thread.currentThread());
            if (myConnection == null) {
                return false;
            }
            try {
                ClientServerHello csh = null;
                try {
                    Method getVersionInfoMethod = myConnection.getClass().getMethod("getVersionInfo", new Class[0]);
                    if (getVersionInfoMethod != null) {
                        Object result = getVersionInfoMethod.invoke(myConnection, new Object[0]);
                        if (result instanceof ClientServerHello) {
                            csh = (ClientServerHello) result;
                        }
                    }
                } catch (SecurityException e1) {
                } catch (NoSuchMethodException e1) {
                } catch (IllegalArgumentException e) {
                } catch (IllegalAccessException e) {
                } catch (InvocationTargetException e) {
                }
                String version = null;
                if (csh != null && csh.getServerString() != null) {
                    version = new String(csh.getServerString());
                } else {
                    return false;
                }
                if (version != null && version.indexOf("OpenSSH") >= 0) {
                    return true;
View Full Code Here

            lock(Thread.currentThread());
            if (myConnection == null) {
                return false;
            }
            try {
                ClientServerHello csh = null;
                try {
                    Method getVersionInfoMethod = myConnection.getClass().getMethod("getVersionInfo", new Class[0]);
                    if (getVersionInfoMethod != null) {
                        Object result = getVersionInfoMethod.invoke(myConnection, new Object[0]);
                        if (result instanceof ClientServerHello) {
                            csh = (ClientServerHello) result;
                        }
                    }
                } catch (SecurityException e1) {
                } catch (NoSuchMethodException e1) {
                } catch (IllegalArgumentException e) {
                } catch (IllegalAccessException e) {
                } catch (InvocationTargetException e) {
                }
                String version = null;
                if (csh != null && csh.getServerString() != null) {
                    version = new String(csh.getServerString());
                } else {
                    return false;
                }
                if (version != null && version.indexOf("OpenSSH") >= 0) {
                    return true;
View Full Code Here

        }
       
        public boolean isSessionPingSupported() {
            lock(Thread.currentThread());
            try {
                ClientServerHello csh = null;
                try {
                    Method getVersionInfoMethod = myConnection.getClass().getMethod("getVersionInfo", new Class[0]);
                    if (getVersionInfoMethod != null) {
                        Object result = getVersionInfoMethod.invoke(myConnection, new Object[0]);
                        if (result instanceof ClientServerHello) {
                            csh = (ClientServerHello) result;
                        }
                    }
                } catch (SecurityException e1) {
                } catch (NoSuchMethodException e1) {
                } catch (IllegalArgumentException e) {
                } catch (IllegalAccessException e) {
                } catch (InvocationTargetException e) {
                }
                String version = null;
                if (csh != null && csh.getServerString() != null) {
                    version = new String(csh.getServerString());
                } else {
                    return false;
                }
                if (version != null && version.indexOf("OpenSSH") >= 0) {
                    return true;
View Full Code Here

TOP

Related Classes of com.trilead.ssh2.transport.ClientServerHello

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.