executing command via ssh on different router models

37 views
Skip to first unread message

mishanya alpseilsevv

unread,
Aug 13, 2020, 12:58:54 PM8/13/20
to golang-nuts
Hi.

My task is execute command on different routers and receive command output

I'm using golang.org/x/crypto/ssh package

Cisco works fine. But on HP output ends on prompt right before actual command.

Maybe someone have experience executing commands via ssh on HP routers and can give me some advice?

Code samples look like this:

cmd := "dis int brief" 

config := &ssh.ClientConfig{ 

  User: user, 

Auth: []ssh.AuthMethod{

ssh.Password(password), }, ... } 

... 

conn, err := ssh.Dial("tcp", hostip+":22", config) 

session, err := conn.NewSession() 

output, err := session.CombinedOutput(cmd)  




Reply all
Reply to author
Forward
0 new messages