SkillAgentSearch skills...

Easyssh

SSH wrapper for Go

Install / Use

/learn @srri-zz/Easyssh
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

easyssh

SSH wrapper for Go

Features:

  • Supports PEM key authentication (password protected, and non-password protected)
  • Supports password based authentication
  • Batch and single command processing

Docs:

http://godoc.org/github.com/stevenbrichards/easyssh

Usage:

go get github.com/stevenbrichards/easyssh

Single command:

sshSession := easyssh.Config{
	User:    username,
	KeyPath: pathToFile,
	Host:    host,
	Port:    "22",
}
err := sshSession.Connect()
if err != nil {
	panic(err)
}
result, err := sshSession.Command("whoami")
if err != nil {
	panic(err)
}
fmt.Println(result)

Batch commands

sshSession := easyssh.Config{
        User:    username,
        KeyPath: pathToFile,
        Host:    host,
        Port:    "22",
}
err := sshSession.Connect()
if err != nil {
        panic(err)
}
results, err := sshSession.BatchCommands([]string{"whoami","uptime"},"\n")
if err != nil {
        panic(err)
}
for _, result := range results {
	fmt.Println(result)
}
View on GitHub
GitHub Stars4
CategoryDevelopment
Updated2y ago
Forks1

Languages

Go

Security Score

65/100

Audited on Jul 28, 2023

No findings