tomatome / grdp

pure golang rdp protocol
GNU General Public License v3.0
190 stars 70 forks source link

Does not work against Windows 2019 #23

Open CaledoniaProject opened 11 months ago

CaledoniaProject commented 11 months ago

I believe the library is completely broken, does not work on any recent Windows version.

[INFO]2023/09/29 17:20:40 sec.go:721: sec ERROR_ALERT and ErrorCode: 7 [ERROR]2023/09/29 17:20:40 caps.go:647: unsupported Capability type 0x001e

olljanat commented 10 months ago

Are using latest version of code from master branch?

As far I see this works fine even with Windows Server 2022 with these security hardenings enabled: image

TLS 1.0, TLS 1.1 and 3DES cipher disabled (verified with sslscan): image

~Only challenge which I noticed is that this cannot be build with latest Go version so I used 1.18.10 instead of.~ EDIT: Building with latest Go version works fine as long you are using amd64 version instead of 386. However you need to have CGO support or include change from #26

CaledoniaProject commented 10 months ago

@CaledoniaProject Can you provide an example of your code on gist?

olljanat commented 10 months ago

I simply copied example code from integration test: https://github.com/tomatome/grdp/blob/b1e80faa1cf2df88e1b734eeb4d32239c3059457/client/client_test.go#L11-L19

CaledoniaProject commented 10 months ago

The test is broken

# go test github.com/tomatome/grdp/client -run TestClient
# github.com/tomatome/grdp/plugin/cliprdr
plugin/cliprdr/cliprdr.go:223:27: undefined: FILE_ATTRIBUTE_DIRECTORY
plugin/cliprdr/cliprdr.go:318:2: undefined: Control
plugin/cliprdr/cliprdr.go:328:5: undefined: ClipWatcher
plugin/cliprdr/cliprdr.go:434:4: c.withOpenClipboard undefined (type *CliprdrClient has no field or method withOpenClipboard)
plugin/cliprdr/cliprdr.go:435:7: undefined: EmptyClipboard
plugin/cliprdr/cliprdr.go:443:5: c.SendCliprdrMessage undefined (type *CliprdrClient has no field or method SendCliprdrMessage)
plugin/cliprdr/cliprdr.go:445:5: c.withOpenClipboard undefined (type *CliprdrClient has no field or method withOpenClipboard)
plugin/cliprdr/cliprdr.go:446:8: undefined: EmptyClipboard
plugin/cliprdr/cliprdr.go:451:5: undefined: SetClipboardData
plugin/cliprdr/cliprdr.go:475:37: undefined: GetFileInfo
plugin/cliprdr/cliprdr.go:475:37: too many errors
FAIL    github.com/tomatome/grdp/client [build failed]
FAIL

With cgo disabled

# CGO_ENABLED=0 go test github.com/tomatome/grdp/client -run TestClient
package github.com/tomatome/grdp/client
    imports github.com/tomatome/grdp/plugin: build constraints exclude all Go files in /home/tmp/grdp-master/plugin
olljanat commented 10 months ago

I mean, copy that code to new Go app and build normally.

CaledoniaProject commented 10 months ago

Same issue, the library is broken or incompatible with go1.21.4

../../../../go/pkg/mod/github.com/tomatome/grdp@v0.1.0/client/rfb.go:28:14: c.vnc.Connect undefined (type *rfb.RFB has no field or method Connect)
CaledoniaProject commented 10 months ago

@tomatome Can you take a look at this?

olljanat commented 10 months ago

Same issue, the library is broken or incompatible with go1.21.4

../../../../go/pkg/mod/github.com/tomatome/grdp@v0.1.0/client/rfb.go:28:14: c.vnc.Connect undefined (type *rfb.RFB has no field or method Connect)

Ah, this VNC error I did see also before disabled CGO. I would assume that it needs some very specific version of gcc. You can include #26 by adding this line to go.mod and running go mod tidy again:

replace github.com/tomatome/grdp => github.com/olljanat/grdp v0.0.0-20231109070701-045cbccd0693
CaledoniaProject commented 10 months ago

I've patched the code manually, your repo need to fix the mod name

go: github.com/olljanat/grdp@v0.0.0-20231109070701-045cbccd0693: parsing go.mod: module declares its path as: github.com/tomatome/grdp but was required as: github.com/olljanat/grdp

olljanat commented 10 months ago

Don't change require command, just add that replace command. Like this:

require github.com/tomatome/grdp v0.1.1-0.20230622130233-b1e80faa1cf2
replace github.com/tomatome/grdp => github.com/olljanat/grdp v0.0.0-20231109070701-045cbccd0693