ssh: fix shell payload string length (#2)
Using ssh.Unmarshal since commit c11ed6a015a8da means the "shell" payload should be propely formatted, with a specified string length. Otherwise, when attempting to connect, you'll see this message in the gokrazy stderr: ssh: parse error in message type 0 that's because in x/crypto/ssh, the parseString() method expects a length before the string. If length is 0, there will be remaining unparsed data, and an error.
This commit is contained in:
parent
05fda29dea
commit
9d10c020d8
2
ssh.go
2
ssh.go
@ -151,7 +151,7 @@ func (s *session) request(ctx context.Context, req *ssh.Request) error {
|
|||||||
s.env = append(s.env, fmt.Sprintf("%s=%s", r.VariableName, r.VariableValue))
|
s.env = append(s.env, fmt.Sprintf("%s=%s", r.VariableName, r.VariableValue))
|
||||||
|
|
||||||
case "shell":
|
case "shell":
|
||||||
req.Payload = []byte("\x00\x00\x00\x00sh")
|
req.Payload = []byte("\x00\x00\x00\x02sh")
|
||||||
fallthrough
|
fallthrough
|
||||||
|
|
||||||
case "exec":
|
case "exec":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user