Ejemplo n.º 1
0
  public void request(Session session, Channel channel) throws Exception {
    super.request(session, channel);

    Buffer buf = new Buffer();
    Packet packet = new Packet(buf);

    // byte      SSH_MSG_CHANNEL_REQUEST(98)
    // uint32 recipient channel
    // string request type        // "x11-req"
    // boolean want reply         // 0
    // boolean   single connection
    // string    x11 authentication protocol // "MIT-MAGIC-COOKIE-1".
    // string    x11 authentication cookie
    // uint32    x11 screen number
    packet.reset();
    buf.putByte((byte) Session.SSH_MSG_CHANNEL_REQUEST);
    buf.putInt(channel.getRecipient());
    buf.putString(Util.str2byte("x11-req"));
    buf.putByte((byte) (waitForReply() ? 1 : 0));
    buf.putByte((byte) 0);
    buf.putString(Util.str2byte("MIT-MAGIC-COOKIE-1"));
    buf.putString(ChannelX11.getFakedCookie(session));
    buf.putInt(0);
    write(packet);

    session.x11_forwarding = true;
  }
  public void request(Session session, Channel channel) throws Exception {
    super.request(session, channel);

    Buffer buf = new Buffer();
    Packet packet = new Packet(buf);
    packet.reset();
    buf.putByte((byte) Session.SSH_MSG_CHANNEL_REQUEST);
    buf.putInt(channel.getRecipient());
    buf.putString(Util.str2byte("subsystem"));
    buf.putByte((byte) (waitForReply() ? 1 : 0));
    buf.putString(Util.str2byte("sftp"));
    write(packet);
  }
  public void request(Session session, Channel channel) throws Exception {
    super.request(session, channel);

    Buffer buf = new Buffer();
    Packet packet = new Packet(buf);

    // send
    // byte     SSH_MSG_CHANNEL_REQUEST(98)
    // uint32 recipient channel
    // string request type       // "shell"
    // boolean want reply        // 0
    packet.reset();
    buf.putByte((byte) Session.SSH_MSG_CHANNEL_REQUEST);
    buf.putInt(channel.getRecipient());
    buf.putString(Util.str2byte("shell"));
    buf.putByte((byte) (waitForReply() ? 1 : 0));
    write(packet);
  }
Ejemplo n.º 4
0
  public void request(Session session, Channel channel) throws Exception {
    Buffer buf = new Buffer();
    Packet packet = new Packet(buf);

    // byte      SSH_MSG_CHANNEL_REQUEST
    // uint32    recipient_channel
    // string    "window-change"
    // boolean   FALSE
    // uint32    terminal width, columns
    // uint32    terminal height, rows
    // uint32    terminal width, pixels
    // uint32    terminal height, pixels
    packet.reset();
    buf.putByte((byte) Session.SSH_MSG_CHANNEL_REQUEST);
    buf.putInt(channel.getRecipient());
    buf.putString("window-change".getBytes());
    buf.putByte((byte) (waitForReply() ? 1 : 0));
    buf.putInt(width_columns);
    buf.putInt(height_rows);
    buf.putInt(width_pixels);
    buf.putInt(height_pixels);
    session.write(packet);
  }