Skip to content

Commit

Permalink
few more verbose errors returned
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Jul 11, 2024
1 parent 69f925d commit 2bd7f26
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Payload_Type/poseidon/poseidon/agent_code/sshauth/sshauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func SSHLogin(host string, port int, cred Credential, debug bool, command string
res := SSHResult{
Host: host,
Username: cred.Username,
Success: true,
}
var sshConfig *ssh.ClientConfig
if cred.PrivateKey == "" {
Expand Down Expand Up @@ -118,6 +119,7 @@ func SSHLogin(host string, port int, cred Credential, debug bool, command string
fmt.Println(errStr)
}
res.Success = false
res.Status = err.Error()
sshResultChan <- res
return
}
Expand All @@ -132,6 +134,8 @@ func SSHLogin(host string, port int, cred Credential, debug bool, command string
if source != "" && destination != "" {
err = scp.CopyPath(source, destination, session)
if err != nil {
res.Success = false
res.Status = err.Error()
res.CopyStatus = "Failed to copy: " + err.Error()
} else {
res.CopyStatus = "Successfully copied"
Expand All @@ -153,14 +157,16 @@ func SSHLogin(host string, port int, cred Credential, debug bool, command string
}
output, err := session.Output(command)
if err != nil {

res.Success = false
res.Status = err.Error()
} else {
res.Output = string(output)
}
res.Output = string(output)

} else {
res.Output = ""
}
//session.Close()
res.Success = true
sshResultChan <- res
}

Expand Down

0 comments on commit 2bd7f26

Please sign in to comment.