0
|
1 package com.trilead.ssh2.packets;
|
|
2
|
|
3
|
|
4 /**
|
|
5 * PacketSessionExecCommand.
|
|
6 *
|
|
7 * @author Christian Plattner, plattner@trilead.com
|
|
8 * @version $Id: PacketSessionExecCommand.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
|
|
9 */
|
|
10 public class PacketSessionExecCommand {
|
|
11 byte[] payload;
|
|
12
|
|
13 public int recipientChannelID;
|
|
14 public boolean wantReply;
|
|
15 public String command;
|
|
16
|
|
17 public PacketSessionExecCommand(int recipientChannelID, boolean wantReply, String command) {
|
|
18 this.recipientChannelID = recipientChannelID;
|
|
19 this.wantReply = wantReply;
|
|
20 this.command = command;
|
|
21 }
|
|
22
|
|
23 public byte[] getPayload() {
|
|
24 if (payload == null) {
|
|
25 TypesWriter tw = new TypesWriter();
|
|
26 tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST);
|
|
27 tw.writeUINT32(recipientChannelID);
|
|
28 tw.writeString("exec");
|
|
29 tw.writeBoolean(wantReply);
|
|
30 tw.writeString(command);
|
|
31 payload = tw.getBytes();
|
|
32 }
|
|
33
|
|
34 return payload;
|
|
35 }
|
|
36 }
|