sshpoke/internal/server/driver/ssh/sshtun/printer.go

22 lines
378 B
Go

package sshtun
import (
"bufio"
"github.com/Neur0toxine/sshpoke/pkg/proto/ssh"
"go.uber.org/zap"
)
func StdoutPrinterSessionCallback(log *zap.SugaredLogger) SessionCallback {
return func(session *ssh.Session) {
stdout, err := session.StdoutPipe()
if err != nil {
return
}
scan := bufio.NewScanner(stdout)
for scan.Scan() {
log.Debug(scan.Text())
}
}
}