mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2025-08-17 22:13:50 +02:00
Add tests WIP
This commit is contained in:
parent
7bace85c15
commit
bfe300c3dc
4 changed files with 93 additions and 1 deletions
46
protocol/client.go
Normal file
46
protocol/client.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
package protocol
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
)
|
||||
|
||||
const (
|
||||
MajorVersion = 0x0
|
||||
MinorVersion = 0x0
|
||||
Version = 0x00
|
||||
)
|
||||
|
||||
type ClientConfig struct {
|
||||
SmartCardAuth bool
|
||||
PAAToken string
|
||||
NTLMAuth bool
|
||||
}
|
||||
|
||||
func (c *ClientConfig) handshakeRequest() []byte {
|
||||
var caps uint16
|
||||
|
||||
if c.SmartCardAuth {
|
||||
caps = caps | HTTP_EXTENDED_AUTH_SC
|
||||
}
|
||||
|
||||
if len(c.PAAToken) > 0 {
|
||||
caps = caps | HTTP_EXTENDED_AUTH_PAA
|
||||
}
|
||||
|
||||
if c.NTLMAuth {
|
||||
caps = caps | HTTP_EXTENDED_AUTH_SSPI_NTLM
|
||||
}
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
binary.Write(buf, binary.LittleEndian, byte(MajorVersion))
|
||||
binary.Write(buf, binary.LittleEndian, byte(MinorVersion))
|
||||
binary.Write(buf, binary.LittleEndian, uint16(Version))
|
||||
|
||||
binary.Write(buf, binary.LittleEndian, uint16(caps))
|
||||
|
||||
return createPacket(PKT_TYPE_HANDSHAKE_REQUEST, buf.Bytes())
|
||||
}
|
||||
|
||||
func (c *ClientConfig) readServerHandshakeResponse(data []byte) ()
|
Loading…
Add table
Add a link
Reference in a new issue