mirror of
https://github.com/saily/vnc-recorder.git
synced 2025-06-28 14:36:58 +00:00
fix when password is empty
This commit is contained in:
parent
9a1ec51ddb
commit
0aff2846b2
3
.gitignore
vendored
3
.gitignore
vendored
@ -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
|
||||
|
14
main.go
14
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)},
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user