mcs

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RDP_VERSION_4      = 0x00080001 // RDP 4.0 clients
	RDP_VERSION_5_PLUS = 0x00080004 // RDP 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, 7.1, 8.0, and 8.1 clients
	RDP_VERSION_10     = 0x00080005 // RDP 10.0 clients
	RDP_VERSION_10_0   = 0x00080005
	RDP_VERSION_10_1   = 0x00080006
	RDP_VERSION_10_2   = 0x00080007
	RDP_VERSION_10_3   = 0x00080008
	RDP_VERSION_10_4   = 0x00080009
	RDP_VERSION_10_5   = 0x0008000a
	RDP_VERSION_10_6   = 0x0008000b
	RDP_VERSION_10_7   = 0x0008000C
	RDP_VERSION_10_8   = 0x0008000D
	RDP_VERSION_10_9   = 0x0008000E
	RDP_VERSION_10_10  = 0x0008000F
	RDP_VERSION_10_11  = 0x00080010
)

ClientCoreData Version

View Source
const (
	RNS_UD_COLOR_8BPP      = 0xCA01
	RNS_UD_COLOR_16BPP_555 = 0xCA02
	RNS_UD_COLOR_16BPP_565 = 0xCA03
	RNS_UD_COLOR_24BPP     = 0xCA04
)
View Source
const (
	ARABIC              uint32 = 0x00000401
	BULGARIAN                  = 0x00000402
	CHINESE_US_KEYBOARD        = 0x00000404
	CZECH                      = 0x00000405
	DANISH                     = 0x00000406
	GERMAN                     = 0x00000407
	GREEK                      = 0x00000408
	US                         = 0x00000409
	SPANISH                    = 0x0000040a
	FINNISH                    = 0x0000040b
	FRENCH                     = 0x0000040c
	HEBREW                     = 0x0000040d
	HUNGARIAN                  = 0x0000040e
	ICELANDIC                  = 0x0000040f
	ITALIAN                    = 0x00000410
	JAPANESE                   = 0x00000411
	KOREAN                     = 0x00000412
	DUTCH                      = 0x00000413
	NORWEGIAN                  = 0x00000414
)
View Source
const (
	KT_IBM_PC_XT_83_KEY = 0x00000001
	KT_OLIVETTI         = 0x00000002
	KT_IBM_PC_AT_84_KEY = 0x00000003
	KT_IBM_101_102_KEYS = 0x00000004
	KT_NOKIA_1050       = 0x00000005
	KT_NOKIA_9140       = 0x00000006
	KT_JAPANESE         = 0x00000007
)
View Source
const (
	HIGH_COLOR_4BPP  = 0x0004
	HIGH_COLOR_8BPP  = 0x0008
	HIGH_COLOR_15BPP = 0x000f
	HIGH_COLOR_16BPP = 0x0010
	HIGH_COLOR_24BPP = 0x0018
)
View Source
const (
	RNS_UD_24BPP_SUPPORT uint16 = 0x0001
	RNS_UD_16BPP_SUPPORT        = 0x0002
	RNS_UD_15BPP_SUPPORT        = 0x0004
	RNS_UD_32BPP_SUPPORT        = 0x0008
)
View Source
const (
	RNS_UD_CS_SUPPORT_ERRINFO_PDU        uint16 = 0x0001
	RNS_UD_CS_WANT_32BPP_SESSION                = 0x0002
	RNS_UD_CS_SUPPORT_STATUSINFO_PDU            = 0x0004
	RNS_UD_CS_STRONG_ASYMMETRIC_KEYS            = 0x0008
	RNS_UD_CS_UNUSED                            = 0x0010
	RNS_UD_CS_VALID_CONNECTION_TYPE             = 0x0020
	RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU        = 0x0040
	RNS_UD_CS_SUPPORT_NETCHAR_AUTODETECT        = 0x0080
	RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL        = 0x0100
	RNS_UD_CS_SUPPORT_DYNAMIC_TIME_ZONE         = 0x0200
	RNS_UD_CS_SUPPORT_HEARTBEAT_PDU             = 0x0400
)
View Source
const (
	CHANNEL_OPTION_INITIALIZED   = 0x80000000
	CHANNEL_OPTION_ENCRYPT_RDP   = 0x40000000
	CHANNEL_OPTION_ENCRYPT_SC    = 0x20000000
	CHANNEL_OPTION_ENCRYPT_CS    = 0x10000000
	CHANNEL_OPTION_PRI_HIGH      = 0x08000000
	CHANNEL_OPTION_PRI_MED       = 0x04000000
	CHANNEL_OPTION_PRI_LOW       = 0x02000000
	CHANNEL_OPTION_COMPRESS_RDP  = 0x00800000
	CHANNEL_OPTION_COMPRESS      = 0x00400000
	CHANNEL_OPTION_SHOW_PROTOCOL = 0x00200000
	REMOTE_CONTROL_PERSISTENT    = 0x00100000
)

ChannelDef Options

View Source
const (
	ENCRYPTION_FLAG_40BIT  uint32 = 0x00000001
	ENCRYPTION_FLAG_128BIT        = 0x00000002
	ENCRYPTION_FLAG_56BIT         = 0x00000008
	FIPS_ENCRYPTION_FLAG          = 0x00000010
)

ClientSecurityData EncryptionMethods

View Source
const (
	MCS_TYPE_CONNECT_INITIAL  = 0x65
	MCS_TYPE_CONNECT_RESPONSE = 0x66
)

for MCS Message

View Source
const (
	MCS_PDUTYPE_ERECT_DOMAIN_REQUEST = 1
	MCS_PDUTYPE_ATTACH_USER_REQUEST  = 10
	MCS_PDUTYPE_ATTACH_USER_CONFIRM  = 11
	MCS_PDUTYPE_CHANNEL_JOIN_REQUEST = 14
	MCS_PDUTYPE_CHANNEL_JOIN_CONFIRM = 15
	MCS_PDUTYPE_SEND_DATA_REQUEST    = 25
	MCS_PDUTYPE_SEND_DATA_INDICATION = 26
)

for MCS PDU type

View Source
const (
	MCS_CHANNEL_USERID_BASE = 1001
	MCS_CHANNEL_GLOBAL      = 1003
)
View Source
const (
	CERT_CHAIN_VERSION_1 = 0x00000001
	CERT_CHAIN_VERSION_2 = 0x00000002
)
View Source
const (
	ENCRYPTION_METHOD_NONE   = 0x00000000
	ENCRYPTION_METHOD_40BIT  = 0x00000001
	ENCRYPTION_METHOD_128BIT = 0x00000002
	ENCRYPTION_METHOD_56BIT  = 0x00000008
	ENCRYPTION_METHOD_FIPS   = 0x00000010
)

encryptionMethod

View Source
const (
	ENCRYPTION_LEVEL_NONE              = 0x00000000
	ENCRYPTION_LEVEL_LOW               = 0x00000001
	ENCRYPTION_LEVEL_CLIENT_COMPATIBLE = 0x00000002
	ENCRYPTION_LEVEL_HIGH              = 0x00000003
	ENCRYPTION_LEVEL_FIPS              = 0x00000004
)

encryptionLevel

View Source
const (
	//client -> server
	CS_CORE     = 0xC001
	CS_SECURITY = 0xC002
	CS_NET      = 0xC003
	CS_CLUSTER  = 0xC004
	CS_MONITOR  = 0xC005

	//server -> client
	SC_CORE           = 0x0C01
	SC_SECURITY       = 0x0C02
	SC_NET            = 0x0C03
	SC_MCS_MSGCHANNEL = 0x0C04
	SC_MULTITRANSPORT = 0x0C08
)

UserDataHeader Type

View Source
const (
	RNS_UD_SAS_DEL = 0xAA03
)

Variables

This section is empty.

Functions

func ReadMcsPduHeader

func ReadMcsPduHeader(r io.Reader) uint8

func WriteMcsPduHeader

func WriteMcsPduHeader(w io.Writer, pduType, option uint8)

Types

type CertBlob

type CertBlob struct {
	CbCert uint32 // This field specifies the number of bytes in abCert.
	AbCert []byte // binary data of a single X.509 certificate.
}

CertBlob https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpele/ad3d569f-9f38-4a33-ae41-071b55885376

type CertData

type CertData interface {
	GetPublicKey() (uint32, []byte)
	Verify() bool
	Read(io.Reader)
}

type ChannelDef

type ChannelDef struct {
	Name    [8]byte
	Options uint32
}

ChannelDef https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/a9b9dc4a-6ae4-4b04-a6f5-87e5ed6fd7e7

func (*ChannelDef) Write

func (d *ChannelDef) Write(w io.Writer)

type ClientAttachUser

type ClientAttachUser struct{}

func (*ClientAttachUser) Serialize

func (c *ClientAttachUser) Serialize() []byte

func (*ClientAttachUser) Write

func (c *ClientAttachUser) Write(w io.Writer)

type ClientChannelJoin

type ClientChannelJoin struct {
	UserId    uint16
	ChannelId uint16
}

ClientChannelJoin https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/64564639-3b2d-4d2c-ae77-1105b4cc011b

func NewClientChannelJoin

func NewClientChannelJoin(userId, channelId uint16) *ClientChannelJoin

func (*ClientChannelJoin) Serialize

func (j *ClientChannelJoin) Serialize() []byte

func (*ClientChannelJoin) Write

func (j *ClientChannelJoin) Write(w io.Writer)

type ClientCoreData

type ClientCoreData struct {
	Header                 UserDataHeader // CS_CORE
	Version                uint32         // RDP_VERSION_5_PLUS
	DesktopWidth           uint16
	DesktopHeight          uint16
	ColorDepth             uint16
	SasSequence            uint16
	KbdLayout              uint32
	ClientBuild            uint32
	ClientName             [32]byte
	KeyboardType           uint32
	KeyboardSubType        uint32
	KeyboardFnKeys         uint32
	ImeFileName            [64]byte
	PostBeta2ColorDepth    uint16
	ClientProductId        uint16
	SerialNumber           uint32
	HighColorDepth         uint16
	SupportedColorDepths   uint16
	EarlyCapabilityFlags   uint16
	ClientDigProductId     [64]byte
	ConnectionType         uint8
	Pad1octet              uint8
	ServerSelectedProtocol uint32
}

ClientCoreData https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/00f1da4a-ee9c-421a-852f-c19f92343d73

func NewClientCoreData

func NewClientCoreData() *ClientCoreData

func (*ClientCoreData) Serialize

func (coreData *ClientCoreData) Serialize() []byte

type ClientErectDomain

type ClientErectDomain struct{}

func (*ClientErectDomain) Serialize

func (e *ClientErectDomain) Serialize() []byte

func (*ClientErectDomain) Write

func (e *ClientErectDomain) Write(w io.Writer)

type ClientNetworkData

type ClientNetworkData struct {
	Header          UserDataHeader // 	CS_NET      = 0xC003
	ChannelCount    uint32
	ChannelDefArray []ChannelDef
}

ClientNetworkData https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/49f99e00-caf1-4786-b43c-d425de29a03f

func NewClientNetworkData

func NewClientNetworkData() *ClientNetworkData

func (*ClientNetworkData) Serialize

func (networkData *ClientNetworkData) Serialize() []byte

type ClientSecurityData

type ClientSecurityData struct {
	Header               UserDataHeader // CS_SECURITY
	EncryptionMethods    uint32
	ExtEncryptionMethods uint32 // only for French locale client, otherwise must be set to zero
}

ClientSecurityData https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/6b58e11e-a32b-4903-b736-339f3cfe46ec

func NewClientSecurityData

func NewClientSecurityData() *ClientSecurityData

func (*ClientSecurityData) Serialize

func (securityData *ClientSecurityData) Serialize() []byte

type ConnectInitial

type ConnectInitial struct {
	CallingDomainSelector   []byte // 0x01
	CalledDomainSelector    []byte // 0x01
	UpwardFlag              bool   // true
	TargetDomainParameters  DomainParameters
	MinimumDomainParameters DomainParameters
	MaximumDomainParameters DomainParameters
	UserData                []byte
}

ConnectInitial [T125] section 11.1 -- https://www.itu.int/rec/T-REC-T.125-199802-I/en

func NewClientInitial

func NewClientInitial() *ConnectInitial

func (*ConnectInitial) Serialize

func (ci *ConnectInitial) Serialize() []byte

func (*ConnectInitial) Write

func (ci *ConnectInitial) Write(w *bytes.Buffer)

type ConnectResponse

type ConnectResponse struct {
	Result           uint8
	CalledConnectId  int
	DomainParameters DomainParameters
	UserData         []byte
}

ConnectResponse [T125] section 11.2 -- https://www.itu.int/rec/T-REC-T.125-199802-I/en

func (*ConnectResponse) Load

func (cr *ConnectResponse) Load(data []byte)

type DomainParameters

type DomainParameters struct {
	MaxChannelIds   int
	MaxUserIds      int
	MaxTokenIds     int
	NumPriorities   int
	MinThoughput    int
	MaxHeight       int
	MaxMCSPDUsize   int
	ProtocolVersion int
}

func (*DomainParameters) Read

func (p *DomainParameters) Read(r io.Reader)

func (*DomainParameters) Serialize

func (p *DomainParameters) Serialize() []byte

func (*DomainParameters) Write

func (p *DomainParameters) Write(w io.Writer)

type GccConferenceCreateRequest

type GccConferenceCreateRequest struct {
}

GccConferenceCreateRequest Copy From FreeRDP C.gcc_write_conference_create_request But I don't know what the CCR structure is.

func (*GccConferenceCreateRequest) Serialize

func (req *GccConferenceCreateRequest) Serialize(userData []byte) []byte

func (*GccConferenceCreateRequest) Write

func (req *GccConferenceCreateRequest) Write(w io.Writer, userData []byte)

type GccConferenceCreateResponse

type GccConferenceCreateResponse struct {
}

GccConferenceCreateResponse Copy From FreeRDP C.gcc_read_conference_create_response But I don't know what the CCR structure is.

func (*GccConferenceCreateResponse) Read

func (res *GccConferenceCreateResponse) Read(r io.Reader) []byte

type ProprietaryServerCertificate

type ProprietaryServerCertificate struct {
	DwSigAlgId        uint32 // This field MUST be set to SIGNATURE_ALG_RSA (0x00000001).
	DwKeyAlgId        uint32 // This field MUST be set to KEY_EXCHANGE_ALG_RSA (0x00000001).
	PublicKeyBlobType uint16 // This field MUST be set to BB_RSA_KEY_BLOB (0x0006).
	PublicKeyBlobLen  uint16 // The size in bytes of the PublicKeyBlob field.
	PublicKeyBlob     RSAPublicKey
	SignatureBlobType uint16 // This field is set to BB_RSA_SIGNATURE_BLOB (0x0008).
	SignatureBlobLen  uint16 // The size in bytes of the SignatureBlob field.
	SignatureBlob     []byte
	Padding           []byte
}

ProprietaryServerCertificate https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/a37d449a-73ac-4f00-9b9d-56cefc954634

func (*ProprietaryServerCertificate) GetPublicKey

func (p *ProprietaryServerCertificate) GetPublicKey() (uint32, []byte)

func (*ProprietaryServerCertificate) Read

func (*ProprietaryServerCertificate) Verify

func (p *ProprietaryServerCertificate) Verify() bool

type RSAPublicKey

type RSAPublicKey struct {
	Magic   uint32 // 0x31415352
	KeyLen  uint32 // MUST be ((BitLen / 8) + 8) bytes.
	BitLen  uint32 // The number of bits in the public key modulus.
	DataLen uint32 // This value is directly related to the BitLen field and MUST be ((BitLen / 8) - 1) bytes.
	PubExp  uint32 // The public exponent of the public key.
	Modulus []byte // The modulus field contains all (BitLen / 8) bytes of the public key
	Padding []byte // 8字节对齐
}

RSAPublicKey https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/fe93545c-772a-4ade-9d02-ad1e0d81b6af

type ReceiveDataResponse

type ReceiveDataResponse struct{}

func (*ReceiveDataResponse) Read

func (res *ReceiveDataResponse) Read(r io.Reader) (uint16, []byte)

type SendDataRequest

type SendDataRequest struct {
	UserId    uint16
	ChannelId uint16
}

SendDataRequest --- Copy From FreeRDP C.rdp_write_header

func NewSendDataRequest

func NewSendDataRequest(userId, channelId uint16) *SendDataRequest

func (*SendDataRequest) Serialize

func (r *SendDataRequest) Serialize(data []byte) []byte

func (*SendDataRequest) Write

func (r *SendDataRequest) Write(w io.Writer, data []byte)

type ServerAttachUserConfirm

type ServerAttachUserConfirm struct {
	UserId uint16
}

func (*ServerAttachUserConfirm) Read

func (c *ServerAttachUserConfirm) Read(r io.Reader)

type ServerCertificate

type ServerCertificate struct {
	DwVersion uint32
	CertData  CertData
}

ServerCertificate https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/54e72cc6-3422-404c-a6b4-2486db125342

func (*ServerCertificate) Read

func (c *ServerCertificate) Read(r io.Reader)

type ServerChannelJoinConfirm

type ServerChannelJoinConfirm struct {
	Confirm   uint8
	UserId    uint16
	ChannelId uint16
}

func (*ServerChannelJoinConfirm) Read

func (c *ServerChannelJoinConfirm) Read(r io.Reader)

type ServerCoreData

type ServerCoreData struct {
	Version                  uint32
	ClientRequestedProtocols uint32
	EarlyCapabilityFlags     uint32
}

ServerCoreData https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/379a020e-9925-4b4f-98f3-7d634e10b411

func (*ServerCoreData) Read

func (d *ServerCoreData) Read(r io.Reader)

type ServerMultitransportChannelData

type ServerMultitransportChannelData struct {
	Header uint32
	Flags  uint32
}

ServerMultitransportChannelData https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/bf7201d4-9ed9-4dfe-9f6f-f2d68a7367ed

type ServerNetworkData

type ServerNetworkData struct {
	McsChannelId   uint16
	ChannelCount   uint16
	ChannelIdArray []uint16
}

ServerNetworkData https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/89fa11de-5275-4106-9cf1-e5aa7709436c

func (*ServerNetworkData) Read

func (d *ServerNetworkData) Read(r io.Reader)

type ServerSecurityData

type ServerSecurityData struct {
	EncryptionMethod  uint32
	EncryptionLevel   uint32
	ServerRandomLen   uint32 //0x00000020
	ServerCertLen     uint32
	ServerRandom      []byte
	ServerCertificate ServerCertificate
}

ServerSecurityData https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/3e86b68d-3e2e-4433-b486-878875778f4b

func (*ServerSecurityData) Read

func (d *ServerSecurityData) Read(r io.Reader)

type UserDataHeader

type UserDataHeader struct {
	Type uint16
	Len  uint16
}

UserDataHeader https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/8a36630c-9c8e-4864-9382-2ec9d6f368ca

func (*UserDataHeader) Read

func (h *UserDataHeader) Read(r io.Reader)

type X509CertificateChain

type X509CertificateChain struct {
	NumCertBlobs  uint32     // Must between 2 and 200
	CertBlobArray []CertBlob // An array of CertBlob structures
	Padding       []byte     // A byte array of the length 8 + 4*NumCertBlobs is appended at the end the packet.
}

X509CertificateChain https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpele/bf2cc9cc-2b01-442e-a288-6ddfa3b80d59

func (*X509CertificateChain) GetPublicKey

func (p *X509CertificateChain) GetPublicKey() (uint32, []byte)

func (*X509CertificateChain) Read

func (p *X509CertificateChain) Read(r io.Reader)

func (*X509CertificateChain) Verify

func (p *X509CertificateChain) Verify() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL