273
|
1 /*
|
|
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
|
|
3 * Please refer to the LICENSE.txt for licensing details.
|
|
4 */
|
|
5 package ch.ethz.ssh2.packets;
|
|
6
|
|
7 import java.io.IOException;
|
|
8 import java.io.UnsupportedEncodingException;
|
|
9
|
|
10 /**
|
|
11 * @author Christian Plattner
|
|
12 * @version $Id: PacketSessionExecCommand.java 160 2014-05-01 14:30:26Z dkocher@sudo.ch $
|
|
13 */
|
|
14 public final class PacketSessionExecCommand {
|
|
15 private final byte[] payload;
|
|
16
|
|
17 public PacketSessionExecCommand(int recipientChannelID, boolean wantReply, String command, String charsetName) throws UnsupportedEncodingException {
|
|
18 TypesWriter tw = new TypesWriter();
|
|
19 tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST);
|
|
20 tw.writeUINT32(recipientChannelID);
|
|
21 tw.writeString("exec");
|
|
22 tw.writeBoolean(wantReply);
|
|
23 tw.writeString(command, charsetName);
|
|
24 payload = tw.getBytes();
|
|
25 }
|
|
26
|
|
27 public byte[] getPayload() throws IOException {
|
|
28 return payload;
|
|
29 }
|
|
30 }
|