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

29 lines
525 B
Go
Raw Normal View History

2023-11-18 21:23:29 +03:00
package sshtun
import (
"bufio"
2023-11-18 21:51:44 +03:00
"github.com/Neur0toxine/sshpoke/pkg/proto/ssh"
2023-11-18 21:23:29 +03:00
"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())
}
}
}
func StdoutPrinterBannerCallback(log *zap.SugaredLogger) ssh.BannerCallback {
return func(msg string) error {
log.Debug(msg)
return nil
}
}