update generators
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
parent
834a967c2b
commit
930badb789
46
security.go
46
security.go
@ -5,12 +5,12 @@ type SecurityType uint8
|
|||||||
//go:generate stringer -type=SecurityType
|
//go:generate stringer -type=SecurityType
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SecTypeUnknown = SecurityType(0)
|
SecTypeUnknown SecurityType = SecurityType(0)
|
||||||
SecTypeNone = SecurityType(1)
|
SecTypeNone SecurityType = SecurityType(1)
|
||||||
SecTypeVNC = SecurityType(2)
|
SecTypeVNC SecurityType = SecurityType(2)
|
||||||
SecTypeTight = SecurityType(16)
|
SecTypeTight SecurityType = SecurityType(16)
|
||||||
SecTypeATEN = SecurityType(16)
|
SecTypeATEN SecurityType = SecurityType(16)
|
||||||
SecTypeVeNCrypt = SecurityType(19)
|
SecTypeVeNCrypt SecurityType = SecurityType(19)
|
||||||
)
|
)
|
||||||
|
|
||||||
type SecuritySubType uint32
|
type SecuritySubType uint32
|
||||||
@ -18,29 +18,29 @@ type SecuritySubType uint32
|
|||||||
//go:generate stringer -type=SecuritySubType
|
//go:generate stringer -type=SecuritySubType
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SecSubTypeUnknown = SecuritySubType(0)
|
SecSubTypeUnknown SecuritySubType = SecuritySubType(0)
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SecSubTypeVeNCrypt01Unknown = SecuritySubType(0)
|
SecSubTypeVeNCrypt01Unknown SecuritySubType = SecuritySubType(0)
|
||||||
SecSubTypeVeNCrypt01Plain = SecuritySubType(19)
|
SecSubTypeVeNCrypt01Plain SecuritySubType = SecuritySubType(19)
|
||||||
SecSubTypeVeNCrypt01TLSNone = SecuritySubType(20)
|
SecSubTypeVeNCrypt01TLSNone SecuritySubType = SecuritySubType(20)
|
||||||
SecSubTypeVeNCrypt01TLSVNC = SecuritySubType(21)
|
SecSubTypeVeNCrypt01TLSVNC SecuritySubType = SecuritySubType(21)
|
||||||
SecSubTypeVeNCrypt01TLSPlain = SecuritySubType(22)
|
SecSubTypeVeNCrypt01TLSPlain SecuritySubType = SecuritySubType(22)
|
||||||
SecSubTypeVeNCrypt01X509None = SecuritySubType(23)
|
SecSubTypeVeNCrypt01X509None SecuritySubType = SecuritySubType(23)
|
||||||
SecSubTypeVeNCrypt01X509VNC = SecuritySubType(24)
|
SecSubTypeVeNCrypt01X509VNC SecuritySubType = SecuritySubType(24)
|
||||||
SecSubTypeVeNCrypt01X509Plain = SecuritySubType(25)
|
SecSubTypeVeNCrypt01X509Plain SecuritySubType = SecuritySubType(25)
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SecSubTypeVeNCrypt02Unknown = SecuritySubType(0)
|
SecSubTypeVeNCrypt02Unknown SecuritySubType = SecuritySubType(0)
|
||||||
SecSubTypeVeNCrypt02Plain = SecuritySubType(256)
|
SecSubTypeVeNCrypt02Plain SecuritySubType = SecuritySubType(256)
|
||||||
SecSubTypeVeNCrypt02TLSNone = SecuritySubType(257)
|
SecSubTypeVeNCrypt02TLSNone SecuritySubType = SecuritySubType(257)
|
||||||
SecSubTypeVeNCrypt02TLSVNC = SecuritySubType(258)
|
SecSubTypeVeNCrypt02TLSVNC SecuritySubType = SecuritySubType(258)
|
||||||
SecSubTypeVeNCrypt02TLSPlain = SecuritySubType(259)
|
SecSubTypeVeNCrypt02TLSPlain SecuritySubType = SecuritySubType(259)
|
||||||
SecSubTypeVeNCrypt02X509None = SecuritySubType(260)
|
SecSubTypeVeNCrypt02X509None SecuritySubType = SecuritySubType(260)
|
||||||
SecSubTypeVeNCrypt02X509VNC = SecuritySubType(261)
|
SecSubTypeVeNCrypt02X509VNC SecuritySubType = SecuritySubType(261)
|
||||||
SecSubTypeVeNCrypt02X509Plain = SecuritySubType(262)
|
SecSubTypeVeNCrypt02X509Plain SecuritySubType = SecuritySubType(262)
|
||||||
)
|
)
|
||||||
|
|
||||||
type SecurityHandler interface {
|
type SecurityHandler interface {
|
||||||
|
@ -73,18 +73,19 @@ func (auth *ClientAuthVNC) Auth(c Conn) error {
|
|||||||
if len(auth.Password) == 0 {
|
if len(auth.Password) == 0 {
|
||||||
return fmt.Errorf("Security Handshake failed; no password provided for VNCAuth.")
|
return fmt.Errorf("Security Handshake failed; no password provided for VNCAuth.")
|
||||||
}
|
}
|
||||||
|
|
||||||
var challenge [16]byte
|
var challenge [16]byte
|
||||||
if err := binary.Read(c, binary.BigEndian, &challenge); err != nil {
|
if err := binary.Read(c, binary.BigEndian, &challenge); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
crypted, err := AuthVNCEncode(auth.Password, challenge[:])
|
encrypted, err := AuthVNCEncode(auth.Password, challenge[:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
fmt.Printf("rrrr\n")
|
||||||
// Send the encrypted challenge back to server
|
// Send the encrypted challenge back to server
|
||||||
if err := binary.Write(c, binary.BigEndian, crypted); err != nil {
|
if err := binary.Write(c, binary.BigEndian, encrypted); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,9 +93,6 @@ func (auth *ClientAuthVNC) Auth(c Conn) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AuthVNCEncode(password []byte, challenge []byte) ([]byte, error) {
|
func AuthVNCEncode(password []byte, challenge []byte) ([]byte, error) {
|
||||||
if len(password) > 8 {
|
|
||||||
return nil, fmt.Errorf("password too long")
|
|
||||||
}
|
|
||||||
if len(challenge) != 16 {
|
if len(challenge) != 16 {
|
||||||
return nil, fmt.Errorf("challenge size not 16 byte long")
|
return nil, fmt.Errorf("challenge size not 16 byte long")
|
||||||
}
|
}
|
||||||
|
32
securitysubtype_string.go
Normal file
32
securitysubtype_string.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Code generated by "stringer -type=SecuritySubType"; DO NOT EDIT.
|
||||||
|
|
||||||
|
package vnc
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
const (
|
||||||
|
_SecuritySubType_name_0 = "SecSubTypeUnknown"
|
||||||
|
_SecuritySubType_name_1 = "SecSubTypeVeNCrypt01PlainSecSubTypeVeNCrypt01TLSNoneSecSubTypeVeNCrypt01TLSVNCSecSubTypeVeNCrypt01TLSPlainSecSubTypeVeNCrypt01X509NoneSecSubTypeVeNCrypt01X509VNCSecSubTypeVeNCrypt01X509Plain"
|
||||||
|
_SecuritySubType_name_2 = "SecSubTypeVeNCrypt02PlainSecSubTypeVeNCrypt02TLSNoneSecSubTypeVeNCrypt02TLSVNCSecSubTypeVeNCrypt02TLSPlainSecSubTypeVeNCrypt02X509NoneSecSubTypeVeNCrypt02X509VNCSecSubTypeVeNCrypt02X509Plain"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_SecuritySubType_index_0 = [...]uint8{0, 17}
|
||||||
|
_SecuritySubType_index_1 = [...]uint8{0, 25, 52, 78, 106, 134, 161, 190}
|
||||||
|
_SecuritySubType_index_2 = [...]uint8{0, 25, 52, 78, 106, 134, 161, 190}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (i SecuritySubType) String() string {
|
||||||
|
switch {
|
||||||
|
case i == 0:
|
||||||
|
return _SecuritySubType_name_0
|
||||||
|
case 19 <= i && i <= 25:
|
||||||
|
i -= 19
|
||||||
|
return _SecuritySubType_name_1[_SecuritySubType_index_1[i]:_SecuritySubType_index_1[i+1]]
|
||||||
|
case 256 <= i && i <= 262:
|
||||||
|
i -= 256
|
||||||
|
return _SecuritySubType_name_2[_SecuritySubType_index_2[i]:_SecuritySubType_index_2[i+1]]
|
||||||
|
default:
|
||||||
|
return fmt.Sprintf("SecuritySubType(%d)", i)
|
||||||
|
}
|
||||||
|
}
|
30
securitytype_string.go
Normal file
30
securitytype_string.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Code generated by "stringer -type=SecurityType"; DO NOT EDIT.
|
||||||
|
|
||||||
|
package vnc
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
const (
|
||||||
|
_SecurityType_name_0 = "SecTypeUnknownSecTypeNoneSecTypeVNC"
|
||||||
|
_SecurityType_name_1 = "SecTypeTight"
|
||||||
|
_SecurityType_name_2 = "SecTypeVeNCrypt"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_SecurityType_index_0 = [...]uint8{0, 14, 25, 35}
|
||||||
|
_SecurityType_index_1 = [...]uint8{0, 12}
|
||||||
|
_SecurityType_index_2 = [...]uint8{0, 15}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (i SecurityType) String() string {
|
||||||
|
switch {
|
||||||
|
case 0 <= i && i <= 2:
|
||||||
|
return _SecurityType_name_0[_SecurityType_index_0[i]:_SecurityType_index_0[i+1]]
|
||||||
|
case i == 16:
|
||||||
|
return _SecurityType_name_1
|
||||||
|
case i == 19:
|
||||||
|
return _SecurityType_name_2
|
||||||
|
default:
|
||||||
|
return fmt.Sprintf("SecurityType(%d)", i)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user