Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteSsh ¶
func ExecuteSsh(hostname string, port string, cmds []string, config *ssh.ClientConfig) (string, error)
executeSsh - подключится ао SSH (к cisco), выполнить команду и вернуть что она ответила.
Пример использования:
var (
User string = "developer" Password string = "C1sco12345" hostname string = "192.168.1.11" port string = "2222" cmds = []string{"show ip route | i 0.0.0.0/0", "show ip arp"}
)
results := make(chan string, 100)
config := &ssh.ClientConfig{ User: User, HostKeyCallback: ssh.InsecureIgnoreHostKey(), Auth: []ssh.AuthMethod { ssh.Password(Password), }, } results := executeCmd(hostname, port, cmds, config)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.