29 lines
525 B
Go
29 lines
525 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())
|
|
}
|
|
}
|
|
}
|
|
|
|
func StdoutPrinterBannerCallback(log *zap.SugaredLogger) ssh.BannerCallback {
|
|
return func(msg string) error {
|
|
log.Debug(msg)
|
|
return nil
|
|
}
|
|
}
|