Search in sources :

Example 26 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ClientInfoPDU method onStart.

@Override
protected void onStart() {
    super.onStart();
    // Length of packet
    ByteBuffer buf = new ByteBuffer(1024, true);
    // MCS Send Data Request PDU
    buf.writeByte(0x64);
    // Initiator: 0x03 + 1001 = 1004
    buf.writeShort(3);
    // Channel ID: 1003
    buf.writeShort(1003);
    // Data priority: high, segmentation: begin | end (0x40 | 0x20 | 0x10 = 0x70)
    buf.writeByte(0x70);
    // User data length: (variable length field)
    int length = 224 + userName.length + password.length + alternateShell.length + domain.length + workingDir.length + clientAddress.length + clientDir.length;
    buf.writeShort(length | 0x8000);
    // Flags: SEC_INFO_PKT (0x4000)
    buf.writeShort(0x4000);
    // TS_SECURITY_HEADER::flagsHi - ignored
    buf.writeShort(0x0000);
    // Codepage: 0 (UNKNOWN, LE) (use  0x04090409  (1033,1033) for EN_US)
    buf.writeIntLE(0x0000);
    // Flags
    buf.writeIntLE(INFO_MOUSE | INFO_DISABLECTRLALTDEL | INFO_UNICODE | INFO_MAXIMIZESHELL | INFO_LOGONNOTIFY | INFO_ENABLEWINDOWSKEY | INFO_MOUSE_HAS_WHEEL | INFO_NOAUDIOPLAYBACK);
    // 
    // Lengths
    // 
    // cbDomain length: 0 bytes (LE) (NOT including size of mandatory NULL terminator)
    buf.writeShortLE(domain.length);
    // cbUserName length: 16 bytes (0x10, LE) (NOT including size of mandatory NULL terminator)
    buf.writeShortLE(userName.length);
    // cbPassword length: (LE) (NOT including size of mandatory NULL terminator)
    buf.writeShortLE(password.length);
    // cbAlternateShell:  (LE) (NOT including size of mandatory NULL terminator)
    buf.writeShortLE(alternateShell.length);
    // cbWorkingDir: (LE) (NOT including size of mandatory NULL terminator)
    buf.writeShortLE(workingDir.length);
    // 
    // Values
    // 
    // Domain: (UCS2), see cbDomain
    buf.writeBytes(domain);
    buf.writeShort(0);
    // User name: (UCS2), see cbUserName
    buf.writeBytes(userName);
    buf.writeShort(0);
    // Password: (UCS2), see cbPassword
    buf.writeBytes(password);
    buf.writeShort(0);
    // Alternate shell: (UCS2), see cbAlternateShell
    buf.writeBytes(alternateShell);
    buf.writeShort(0);
    // Working directory: (UCS2), see cbWorkingDir
    buf.writeBytes(workingDir);
    buf.writeShort(0);
    // Client address family: 2 (AF_INET, LE)
    buf.writeShortLE(2);
    // cbClientAddress: ( LE) (including the size of the mandatory NULL terminator)
    buf.writeShortLE(clientAddress.length + 2);
    // Client address: (UCS2)
    buf.writeBytes(clientAddress);
    buf.writeShort(0);
    // cbClientDir: 64 bytes (0x40, LE) (including the size of the mandatory NULL terminator)
    buf.writeShortLE(clientDir.length + 2);
    // Client directory: (UCS2)
    buf.writeBytes(clientDir);
    buf.writeShort(0);
    // 
    // Client time zone:
    // 
    // Bias: 0 minutes (LE)
    buf.writeIntLE(0);
    // Standard name: "EET, Standard Time" (fixed string: 64 bytes, UCS2)
    buf.writeFixedString(62, standardTimeZoneName, RdpConstants.CHARSET_16);
    buf.writeShort(0);
    // Standard date
    buf.writeBytes(new byte[] { // wYear: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMonth: unknown (LE)
    (byte) 0x00, (byte) 0x00, // wDayOfWeek: Sunday (LE)
    (byte) 0x00, (byte) 0x00, // wDay: unknown (LE)
    (byte) 0x00, (byte) 0x00, // wHour: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMinute: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wSecond: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMilliseconds: 0
    (byte) 0x00, (byte) 0x00 });
    // StandardBias: 0 minutes (LE)
    buf.writeIntLE(standardTimeZoneBias);
    // Daylight name: "EET, Summer Time" (fixed string: 64 bytes, UCS2)
    buf.writeFixedString(62, daylightTimeZoneName, RdpConstants.CHARSET_16);
    buf.writeShort(0);
    // Daylight date
    buf.writeBytes(new byte[] { // wYear: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMonth: unknown (LE)
    (byte) 0x00, (byte) 0x00, // wDayOfWeek: Sunday (LE)
    (byte) 0x00, (byte) 0x00, // wDay: unknown (LE)
    (byte) 0x00, (byte) 0x00, // wHour: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMinute: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wSecond: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMilliseconds: 0
    (byte) 0x00, (byte) 0x00 });
    // Daylight bias: 60 minutes (LE)
    buf.writeIntLE(daylightTimeZoneBias);
    // Client session ID: 0x00000000 (LE)
    buf.writeIntLE(0);
    // Performance flags: 0x7 (LE) = PERF_DISABLE_WALLPAPER (0x1), PERF_DISABLE_FULLWINDOWDRAG (0x2), PERF_DISABLE_MENUANIMATIONS (0x4)
    buf.writeIntLE(PERF_DISABLE_WALLPAPER | PERF_DISABLE_FULLWINDOWDRAG | PERF_DISABLE_MENUANIMATIONS);
    // cbAutoReconnectCookie: 0 bytes (LE)
    buf.writeShortLE(0);
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    pushDataToOTOut(buf);
    switchOff();
}
Also used : ByteBuffer(streamer.ByteBuffer)

Example 27 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ClientMCSChannelJoinRequestServerMCSChannelConfirmPDUs method sendChannelRequest.

private void sendChannelRequest(int channel) {
    ByteBuffer buf = new ByteBuffer(5, true);
    // Channel Join request
    buf.writeByte(0x38);
    // ChannelJoinRequest::initiator: 1004
    buf.writeShort(state.serverUserChannelId - 1001);
    buf.writeShort(channel);
    pushDataToOTOut(buf);
}
Also used : ByteBuffer(streamer.ByteBuffer)

Example 28 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ClientPreConnectionBlob method sendPreConnectionBlobData.

protected void sendPreConnectionBlobData(String data) {
    // Length of packet
    ByteBuffer buf = new ByteBuffer(1024, true);
    // Header
    buf.writeBytes(new byte[] { (byte) 0x5e, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 });
    // Length of string in wide characters + two wide \0 (LE)
    buf.writeShortLE(data.length() + 2);
    // Wide string + two wide '\0' characters
    buf.writeString(data + "\0\0", RdpConstants.CHARSET_16);
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    pushDataToOTOut(buf);
    switchOff();
}
Also used : ByteBuffer(streamer.ByteBuffer)

Example 29 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ClientNtlmsspNegotiate method generateNegotiateMessage.

private ByteBuffer generateNegotiateMessage() {
    ByteBuffer buf = new ByteBuffer(1024);
    // Signature
    buf.writeString("NTLMSSP", RdpConstants.CHARSET_8);
    buf.writeByte(0);
    // Message type
    buf.writeIntLE(NtlmConstants.NEGOTIATE);
    // Flags
    buf.writeIntLE(clientConfigFlags.value);
    // If the NTLMSSP_NEGOTIATE_VERSION flag is set by the client application,
    // the Version field MUST be set to the current version (section 2.2.2.10),
    // the DomainName field MUST be set to a zero-length string, and the
    // Workstation field MUST be set to a zero-length string.
    // Domain: ""
    // Length
    buf.writeShortLE(0);
    // Allocated space
    buf.writeShortLE(0);
    // Offset
    buf.writeIntLE(0);
    // Workstation: ""
    // Length
    buf.writeShortLE(0);
    // Allocated space
    buf.writeShortLE(0);
    // Offset
    buf.writeIntLE(0);
    // OS Version: 6.1 (Build 7601); NTLM Current Revision 15
    buf.writeBytes(new byte[] { (byte) 0x06, (byte) 0x01, (byte) 0xb1, (byte) 0x1d, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0f });
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    return buf;
}
Also used : ByteBuffer(streamer.ByteBuffer)

Example 30 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ClientNtlmsspNegotiate method onStart.

@Override
protected void onStart() {
    super.onStart();
    ByteBuffer negoToken = generateNegotiateMessage();
    // Store message for MIC calculation in AUTH message
    ntlmState.negotiateMessage = negoToken.toByteArray();
    // Length of packet
    ByteBuffer buf = new ByteBuffer(1024, true);
    TSRequest tsRequest = new TSRequest("TSRequest");
    tsRequest.version.value = 2L;
    NegoItem negoItem = new NegoItem("NegoItem");
    negoItem.negoToken.value = negoToken;
    tsRequest.negoTokens.tags = new Tag[] { negoItem };
    tsRequest.writeTag(buf);
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    pushDataToOTOut(buf);
    switchOff();
}
Also used : NegoItem(rdpclient.ntlmssp.asn1.NegoItem) ByteBuffer(streamer.ByteBuffer) TSRequest(rdpclient.ntlmssp.asn1.TSRequest)

Aggregations

ByteBuffer (streamer.ByteBuffer)110 Element (streamer.Element)12 BaseElement (streamer.BaseElement)9 Pipeline (streamer.Pipeline)7 PipelineImpl (streamer.PipelineImpl)7 TSRequest (rdpclient.ntlmssp.asn1.TSRequest)6 MockSink (streamer.debug.MockSink)5 MockSource (streamer.debug.MockSource)5 BitmapRectangle (common.BitmapRectangle)3 ScreenDescription (common.ScreenDescription)3 SyncLink (streamer.SyncLink)3 AssertingByteBuffer (streamer.debug.AssertingByteBuffer)3 BitmapOrder (common.BitmapOrder)2 KeyOrder (common.KeyOrder)2 MouseOrder (common.MouseOrder)2 NegoItem (rdpclient.ntlmssp.asn1.NegoItem)2 Link (streamer.Link)2 FakeSink (streamer.debug.FakeSink)2 BufferedImageCanvas (common.BufferedImageCanvas)1 CopyRectOrder (common.CopyRectOrder)1