Skip to content

Instantly share code, notes, and snippets.

@wrfly
Created January 13, 2018 15:01
Show Gist options
  • Save wrfly/791644407cf8b7be6ba7befd3de4ee59 to your computer and use it in GitHub Desktop.
Save wrfly/791644407cf8b7be6ba7befd3de4ee59 to your computer and use it in GitHub Desktop.
A fake ssh server to record passwords.
package main
import (
"log"
"github.com/gliderlabs/ssh"
)
func main() {
log.Println("starting ssh server on port 2222...")
opts := ssh.PasswordAuth(func(ctx ssh.Context, password string) bool {
log.Printf("Auth from: [%s], user: [%s], passwd: [%s]",
ctx.RemoteAddr().String(), ctx.User(), password)
return false
})
log.Fatal(ssh.ListenAndServe(":2222", nil, opts))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment