-
Notifications
You must be signed in to change notification settings - Fork 4
/
bitvise.go
55 lines (42 loc) · 1.18 KB
/
bitvise.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"fmt"
"os/exec"
)
// Bitvise parameter list
// https://www.bitvise.com/files/guides/BvSshClient-Params.txt
// Also supports loading a profile
// BvSsh.exe -profile=<full-path-to-profile.tlp>
var path_bitvise = "C:\\Program Files (x86)\\Bitvise SSH Client\\BvSsh.exe"
func exec_bitvise(params CloudShellEnv) {
key, err := env_get_ssh_ppk()
if err != nil {
fmt.Println("\nTip: Run the command: \"gcloud alpha cloud-shell ssh --dry-run\" to setup Cloud Shell SSH keys")
return
}
sshUsername := params.SshUsername
sshHost := params.SshHost
sshPort := fmt.Sprint(params.SshPort)
sshUrl := "sftp://" + sshUsername + "@" + sshHost + ":" + sshPort
args := []string{}
args = append(args, "-host=" + sshHost)
args = append(args, "-port=" + sshPort)
args = append(args, "-user=" + sshUsername)
args = append(args, "-keypairFile=" + key)
args = append(args, "-loginOnStartup")
if config.Debug == true {
fmt.Println(key)
fmt.Println(sshUsername)
fmt.Println(sshHost)
fmt.Println(sshPort)
fmt.Println(sshUrl)
fmt.Println(args)
}
path := path_bitvise
cmd := exec.Command(path, args...)
err = cmd.Start()
if err != nil {
fmt.Println(err)
return
}
}