From 0aff2846b26ab5230575fa9a34389620007aad79 Mon Sep 17 00:00:00 2001 From: aluvare Date: Thu, 2 Dec 2021 18:08:26 +0100 Subject: [PATCH] fix when password is empty --- .gitignore | 3 +++ main.go | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8bdc449..7be3917 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ # Test binary, build with `go test -c` *.test +vnc-recorder +output.mp4 + # Output of the go coverage tool, specifically when used with LiteIDE *.out /vendor diff --git a/main.go b/main.go index 9b895cc..c11bec3 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ func main() { app := &cli.App{ Name: path.Base(os.Args[0]), Usage: "Connect to a vnc server and record the screen to a video.", - Version: "0.3.0", + Version: "0.4.2", Authors: []*cli.Author{ &cli.Author{ Name: "Daniel Widerin", @@ -80,6 +80,7 @@ func main() { } func recorder(c *cli.Context) error { + fmt.Println("PASSWORD", c.String("password")) address := fmt.Sprintf("%s:%d", c.String("host"), c.Int("port")) dialer, err := net.DialTimeout("tcp", address, 5*time.Second) if err != nil { @@ -96,13 +97,20 @@ func recorder(c *cli.Context) error { errorCh := make(chan error) var secHandlers []vnc.SecurityHandler - if c.String("password") == "" { + + var password string + + if c.String("password") != "secret" { + password = c.String("password") + } + + if password == "" { secHandlers = []vnc.SecurityHandler{ &vnc.ClientAuthNone{}, } } else { secHandlers = []vnc.SecurityHandler{ - &vnc.ClientAuthVNC{Password: []byte(c.String("password"))}, + &vnc.ClientAuthVNC{Password: []byte(password)}, } }