private static void setPreferredKeyTypesOrder(Session session) { HostKeyRepository hkr = session.getHostKeyRepository(); List<String> known = Stream.of(hkr.getHostKey(hostName(session), null)) .map(HostKey::getType) .collect(toList()); if (!known.isEmpty()) { String serverHostKey = "server_host_key"; //$NON-NLS-1$ String current = session.getConfig(serverHostKey); if (current == null) { session.setConfig(serverHostKey, String.join(",", known)); //$NON-NLS-1$ return; } String knownFirst = Stream.concat( known.stream(), Stream.of(current.split(",")) //$NON-NLS-1$ .filter(s -> !known.contains(s))) .collect(joining(",")); //$NON-NLS-1$ session.setConfig(serverHostKey, knownFirst); } }
public String getFingerPrint() { HASH hash = null; try { Class<?> c = Class.forName(session.getConfig("md5")); hash = (HASH) (c.newInstance()); } catch (Exception e) { logger.log(Level.SEVERE, "getFingerPrint: " + e.getMessage()); } return Util.getFingerPrint(hash, getHostKey()); }
public String getFingerPrint(){ HASH hash=null; try{ Class c=Class.forName(session.getConfig("md5")); hash=(HASH)(c.newInstance()); } catch(Exception e){ System.err.println("getFingerPrint: "+e); } return Util.getFingerPrint(hash, getHostKey()); } byte[] getK(){ return K; }
public String getFingerPrint(){ HASH hash=null; try{ Class c=Class.forName(session.getConfig("md5")); hash=(HASH)(c.newInstance()); } catch(Exception e){ System.err.println("getFingerPrint: "+e); } return Util.getFingerPrint(hash, getHostKey()); } byte[] getK(){ return K; }
public String getFingerPrint(){ HASH hash=null; try{ Class c=Class.forName(session.getConfig("md5")); hash=(HASH)(c.newInstance()); } catch(Exception e){ System.err.println("getFingerPrint: "+e); } return Util.getFingerPrint(hash, getHostKey()); } byte[] getK(){ return K; }
private String[] checkKexes(String kexes) { if (kexes == null || kexes.length() == 0) return null; logger.log(Level.FINE, () -> "CheckKexes: " + kexes); List<String> result = new ArrayList<>(); String[] _kexes = Util.split(kexes, ","); for (String _kexe : _kexes) { if (!checkKex(this, getConfig(_kexe))) { result.add(_kexe); } } if (result.size() == 0) return null; String[] foo = new String[result.size()]; System.arraycopy(result.toArray(), 0, foo, 0, result.size()); for (String aFoo : foo) { logger.log(Level.FINE, aFoo + " is not available."); } return foo; }
private void initInflater(String method) throws JSchException { if (method.equals("none")) { inflater = null; return; } String foo = getConfig(method); if (foo != null) { if (method.equals("zlib") || (isAuthed && method.equals("zlib@openssh.com"))) { try { Class<?> c = Class.forName(foo); inflater = (Compression) (c.newInstance()); inflater.init(Compression.INFLATER, 0); } catch (Exception ee) { throw new JSchException(ee.toString(), ee); } } } }
private void initInflater(String method) throws JSchException{ if(method.equals("none")){ inflater=null; return; } String foo=getConfig(method); if(foo!=null){ if(method.equals("zlib") || (isAuthed && method.equals("zlib@openssh.com"))){ try{ Class c=Class.forName(foo); inflater=(Compression)(c.newInstance()); inflater.init(Compression.INFLATER, 0); } catch(Exception ee){ throw new JSchException(ee.toString(), ee); //System.err.println(foo+" isn't accessible."); } } } }
private static void setPreferredKeyTypesOrder(Session session) { HostKeyRepository hkr = session.getHostKeyRepository(); List<String> known = Stream.of(hkr.getHostKey(hostName(session), null)) .map(HostKey::getType) .collect(toList()); if (!known.isEmpty()) { String serverHostKey = "server_host_key"; //$NON-NLS-1$ String current = session.getConfig(serverHostKey); if (current == null) { session.setConfig(serverHostKey, String.join(",", known)); //$NON-NLS-1$ return; } String knownFirst = Stream.concat( known.stream(), Stream.of(current.split(",")) //$NON-NLS-1$ .filter(s -> !known.contains(s))) .collect(joining(",")); //$NON-NLS-1$ session.setConfig(serverHostKey, knownFirst); } }
private void initInflater(String method) throws JSchException{ if(method.equals("none")){ inflater=null; return; } String foo=getConfig(method); if(foo!=null){ if(method.equals("zlib") || (isAuthed && method.equals("zlib@openssh.com"))){ try{ Class c=Class.forName(foo); inflater=(Compression)(c.newInstance()); inflater.init(Compression.INFLATER, 0); } catch(Exception ee){ throw new JSchException(ee.toString(), ee); //System.err.println(foo+" isn't accessible."); } } } }
private void initInflater(String method) throws JSchException{ if(method.equals("none")){ inflater=null; return; } String foo=getConfig(method); if(foo!=null){ if(method.equals("zlib") || (isAuthed && method.equals("zlib@openssh.com"))){ try{ Class c=Class.forName(foo); inflater=(Compression)(c.newInstance()); inflater.init(Compression.INFLATER, 0); } catch(Exception ee){ throw new JSchException(ee.toString(), ee); //System.err.println(foo+" isn't accessible."); } } } }
/** * returns the finger print of the server's public key. * * This uses the {@link HASH} implementation given by * {@link Session#getConfig(String) session.getConfig("md5")}. * @return the (lowercase) hexadecimal representation of * the MD5 hash of the server's public key. */ public String getFingerPrint(){ HASH hash=null; try{ Class c=Class.forName(session.getConfig("md5")); hash=(HASH)(c.newInstance()); } catch(Exception e){ System.err.println("getFingerPrint: "+e); } return Util.getFingerPrint(hash, getHostKey()); } byte[] getK(){ return K; }
public InputStream getExtInputStream() throws IOException { int max_input_buffer_size = 32 * 1024; try { max_input_buffer_size = Integer.parseInt(getSession().getConfig("max_input_buffer_size")); } catch (Exception e) { } PipedInputStream in = new MyPipedInputStream( 32 * 1024, // this value should be customizable. max_input_buffer_size ); boolean resizable = 32 * 1024 < max_input_buffer_size; io.setExtOutputStream(new PassiveOutputStream(in, resizable), false); return in; }
public InputStream getExtInputStream() throws IOException { int max_input_buffer_size = 32*1024; try { max_input_buffer_size = Integer.parseInt(getSession().getConfig("max_input_buffer_size")); } catch(Exception e){} PipedInputStream in = new MyPipedInputStream( 32*1024, // this value should be customizable. max_input_buffer_size ); boolean resizable = 32*1024<max_input_buffer_size; io.setExtOutputStream(new PassiveOutputStream(in, resizable), false); return in; } public OutputStream getOutputStream() throws IOException {
public InputStream getInputStream() throws IOException { int max_input_buffer_size = 32 * 1024; try { max_input_buffer_size = Integer.parseInt(getSession().getConfig("max_input_buffer_size")); } catch (Exception e) { } PipedInputStream in = new MyPipedInputStream( 32 * 1024, // this value should be customizable. max_input_buffer_size ); boolean resizable = 32 * 1024 < max_input_buffer_size; io.setOutputStream(new PassiveOutputStream(in, resizable), false); return in; }
public InputStream getExtInputStream() throws IOException { int max_input_buffer_size = 32*1024; try { max_input_buffer_size = Integer.parseInt(getSession().getConfig("max_input_buffer_size")); } catch(Exception e){} PipedInputStream in = new MyPipedInputStream( 32*1024, // this value should be customizable. max_input_buffer_size ); boolean resizable = 32*1024<max_input_buffer_size; io.setExtOutputStream(new PassiveOutputStream(in, resizable), false); return in; } public OutputStream getOutputStream() throws IOException {
public InputStream getInputStream() throws IOException { int max_input_buffer_size = 32*1024; try { max_input_buffer_size = Integer.parseInt(getSession().getConfig("max_input_buffer_size")); } catch(Exception e){} PipedInputStream in = new MyPipedInputStream( 32*1024, // this value should be customizable. max_input_buffer_size ); boolean resizable = 32*1024<max_input_buffer_size; io.setOutputStream(new PassiveOutputStream(in, resizable), false); return in; } public InputStream getExtInputStream() throws IOException {
public InputStream getInputStream() throws IOException { int max_input_buffer_size = 32*1024; try { max_input_buffer_size = Integer.parseInt(getSession().getConfig("max_input_buffer_size")); } catch(Exception e){} PipedInputStream in = new MyPipedInputStream( 32*1024, // this value should be customizable. max_input_buffer_size ); boolean resizable = 32*1024<max_input_buffer_size; io.setOutputStream(new PassiveOutputStream(in, resizable), false); return in; } public InputStream getExtInputStream() throws IOException {
private void requestPortForwarding() throws JSchException { if(getConfig("ClearAllForwardings").equals("yes")) return; ConfigRepository configRepository = jsch.getConfigRepository(); if(configRepository == null){ return; } ConfigRepository.Config config = configRepository.getConfig(org_host); String[] values = config.getValues("LocalForward"); if(values != null){ for(int i = 0; i < values.length; i++) { setPortForwardingL(values[i]); } } values = config.getValues("RemoteForward"); if(values != null){ for(int i = 0; i < values.length; i++) { setPortForwardingR(values[i]); } } }
private void requestPortForwarding() throws JSchException { if (getConfig("ClearAllForwardings").equals("yes")) return; ConfigRepository configRepository = jsch.getConfigRepository(); if (configRepository == null) { return; } ConfigRepository.Config config = configRepository.getConfig(org_host); String[] values = config.getValues("LocalForward"); if (values != null) { for (int i = 0; i < values.length; i++) { setPortForwardingL(values[i]); } } values = config.getValues("RemoteForward"); if (values != null) { for (int i = 0; i < values.length; i++) { setPortForwardingR(values[i]); } } }