/** * puts a byte sequence formatted as a SSH string into the buffer. * @see #putString(byte[], int, int) */ public void putString(byte[] foo){ putString(foo, 0, foo.length); } /**
public byte[] getPublicKeyBlob(){ byte[] foo=super.getPublicKeyBlob(); if(foo!=null) return foo; if(pub_array==null) return null; Buffer buf=new Buffer(sshrsa.length+4+ pub_array.length+4+ n_array.length+4); buf.putString(sshrsa); buf.putString(pub_array); buf.putString(n_array); return buf.buffer; }
static Buffer fromBytes(byte[][] args){ int length = args.length*4; for(int i = 0; i < args.length; i++){ length += args[i].length; } Buffer buf = new Buffer(length); for(int i = 0; i < args.length; i++){ buf.putString(args[i]); } return buf; }
static Buffer fromBytes(byte[][] args) { int length = args.length * 4; for (int i = 0; i < args.length; i++) { length += args[i].length; } Buffer buf = new Buffer(length); for (int i = 0; i < args.length; i++) { buf.putString(args[i]); } return buf; }
static Buffer fromBytes(byte[][] args){ int length = args.length*4; for(int i = 0; i < args.length; i++){ length += args[i].length; } Buffer buf = new Buffer(length); for(int i = 0; i < args.length; i++){ buf.putString(args[i]); } return buf; }
private void sendPacketPath(byte fxp, byte[] path) throws Exception{ packet.reset(); putHEAD(fxp, 9+path.length); buf.putInt(seq++); buf.putString(path); // path getSession().write(packet, this, 9+path.length+4); } private void sendPacketPath(byte fxp, byte[] p1, byte[] p2) throws Exception{
public void sendKeepAliveMsg() throws Exception{ Buffer buf=new Buffer(); Packet packet=new Packet(buf); packet.reset(); buf.putByte((byte)SSH_MSG_GLOBAL_REQUEST); buf.putString(keepalivemsg); buf.putByte((byte)1); write(packet); }
private void send(byte[] message){ packet.reset(); wbuf.putByte((byte)Session.SSH_MSG_CHANNEL_DATA); wbuf.putInt(recipient); wbuf.putInt(4+message.length); wbuf.putString(message); try{ getSession().write(packet, this, 4+message.length); } catch(Exception e){ } }
public void sendKeepAliveMsg() throws Exception { Buffer buf = new Buffer(); Packet packet = new Packet(buf); packet.reset(); buf.putByte((byte) SSH_MSG_GLOBAL_REQUEST); buf.putString(keepalivemsg); buf.putByte((byte) 1); write(packet); }
public void sendKeepAliveMsg() throws Exception{ Buffer buf=new Buffer(); Packet packet=new Packet(buf); packet.reset(); buf.putByte((byte)SSH_MSG_GLOBAL_REQUEST); buf.putString(keepalivemsg); buf.putByte((byte)1); write(packet); }
private void send(byte[] message){ packet.reset(); wbuf.putByte((byte)Session.SSH_MSG_CHANNEL_DATA); wbuf.putInt(recipient); wbuf.putInt(4+message.length); wbuf.putString(message); try{ getSession().write(packet, this, 4+message.length); } catch(Exception e){ } }
private void send(byte[] message){ packet.reset(); wbuf.putByte((byte)Session.SSH_MSG_CHANNEL_DATA); wbuf.putInt(recipient); wbuf.putInt(4+message.length); wbuf.putString(message); try{ getSession().write(packet, this, 4+message.length); } catch(Exception e){ } }
private void sendOPEN(byte[] path, int mode) throws Exception{ packet.reset(); putHEAD(SSH_FXP_OPEN, 17+path.length); buf.putInt(seq++); buf.putString(path); buf.putInt(mode); buf.putInt(0); // attrs getSession().write(packet, this, 17+path.length+4); } private void sendPacketPath(byte fxp, byte[] path) throws Exception{
private void sendSETSTAT(byte[] path, SftpATTRS attr) throws Exception{ packet.reset(); putHEAD(SSH_FXP_SETSTAT, 9+path.length+attr.length()); buf.putInt(seq++); buf.putString(path); // path attr.dump(buf); getSession().write(packet, this, 9+path.length+attr.length()+4); } private void sendREMOVE(byte[] path) throws Exception{
private void sendSETSTAT(byte[] path, SftpATTRS attr) throws Exception { packet.reset(); putHEAD(SSH_FXP_SETSTAT, 9 + path.length + attr.length()); buf.putInt(seq++); buf.putString(path); attr.dump(buf); getSession().write(packet, this, 9 + path.length + attr.length() + 4); }
private void sendSETSTAT(byte[] path, SftpATTRS attr) throws Exception{ packet.reset(); putHEAD(SSH_FXP_SETSTAT, 9+path.length+attr.length()); buf.putInt(seq++); buf.putString(path); // path attr.dump(buf); getSession().write(packet, this, 9+path.length+attr.length()+4); } private void sendREMOVE(byte[] path) throws Exception{
private void sendMKDIR(byte[] path, SftpATTRS attr) throws Exception{ packet.reset(); putHEAD(SSH_FXP_MKDIR, 9+path.length+(attr!=null?attr.length():4)); buf.putInt(seq++); buf.putString(path); // path if(attr!=null) attr.dump(buf); else buf.putInt(0); getSession().write(packet, this, 9+path.length+(attr!=null?attr.length():4)+4); } private void sendRMDIR(byte[] path) throws Exception{
private void sendMKDIR(byte[] path, SftpATTRS attr) throws Exception{ packet.reset(); putHEAD(SSH_FXP_MKDIR, 9+path.length+(attr!=null?attr.length():4)); buf.putInt(seq++); buf.putString(path); // path if(attr!=null) attr.dump(buf); else buf.putInt(0); getSession().write(packet, this, 9+path.length+(attr!=null?attr.length():4)+4); } private void sendRMDIR(byte[] path) throws Exception{
private void sendMKDIR(byte[] path, SftpATTRS attr) throws Exception{ packet.reset(); putHEAD(SSH_FXP_MKDIR, 9+path.length+(attr!=null?attr.length():4)); buf.putInt(seq++); buf.putString(path); // path if(attr!=null) attr.dump(buf); else buf.putInt(0); getSession().write(packet, this, 9+path.length+(attr!=null?attr.length():4)+4); } private void sendRMDIR(byte[] path) throws Exception{
private void sendMKDIR(byte[] path, SftpATTRS attr) throws Exception { packet.reset(); putHEAD(SSH_FXP_MKDIR, 9 + path.length + (attr != null ? attr.length() : 4)); buf.putInt(seq++); buf.putString(path); if (attr != null) attr.dump(buf); else buf.putInt(0); getSession().write(packet, this, 9 + path.length + (attr != null ? attr.length() : 4) + 4); }