func (this Scanner) executeCommand(cmd string, session *ssh.Session) (string, error) {
	out, err := session.CombinedOutput(cmd)
	if err != nil {
		return "", err
	}
	tmpOut := string(out)
	tmpOut = strings.Replace(tmpOut, "\n", "<br>", -1)
	return tmpOut, nil
}
Executes a command on an SSH session struct, return an error if there is one
package ssh
import (
	"io/ioutil"
	"strings"
	"github.com/emperorcow/go-netscan/scanners"
	"golang.org/x/crypto/ssh"
)
type Scanner struct{}
func (this Scanner) Name() string {
	return "ssh"
}
func (this Scanner) Description() string {
	return "Secure Shell (Scanner)"
}
func (this Scanner) SupportedAuthentication() []string {
	return []string{"basic", "sshkey"}
}
func (this Scanner) SupportedAuthenticationExample() map[string]string {
	return map[string]string{
		"basic":  "USERNAME,PASSWORD",
		"sshkey": "USERNAME,/path/to/key/file.pem",
	}
}
func (this Scanner) Scan(target, cmd string, cred scanners.Credential, outChan chan scanners.Result) {
	if !strings.Contains(target, ":") {
		target = target + ":22"
	}
	var config ssh.ClientConfig
	var err error
	result := scanners.Result{
		Host:    target,
		Auth:    cred,
		Message: "Successfully connected",
		Status:  true,
		Output:  "",
	}
	switch cred.Type {
	case "basic":
		config, err = this.prepPassConfig(cred.Account, cred.AuthData)
	case "sshkey":
		config, err = this.prepCertConfig(cred.Account, cred.AuthData)
	}
	if err != nil {
		result.Message = err.Error()
		result.Status = false
	}
	_, session, err := this.connect(cred.Account, target, config)
	if err != nil {
		result.Message = err.Error()
		result.Status = false
	}
	if err == nil && cmd != "" {
		result.Output, err = this.executeCommand(cmd, session)
		if err != nil {
			result.Output = "Script Error: " + err.Error()
		}
	}
	outChan <- result
}
func (this Scanner) connect(user, host string, conf ssh.ClientConfig) (*ssh.Client, *ssh.Session, error) {
	conn, err := ssh.Dial("tcp", host, &conf)
	if err != nil {
		return nil, nil, err
	}
	session, err := conn.NewSession()
	if err != nil {
		conn.Close()
		return nil, nil, err
	}
	return conn, session, nil
}