twosshlibSsh

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 5 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL