diff --git a/honeypot/server.go b/honeypot/server.go index ee4b430..a08a2d5 100644 --- a/honeypot/server.go +++ b/honeypot/server.go @@ -6,6 +6,7 @@ import ( "net" "os" "time" + "unicode/utf8" gossh "golang.org/x/crypto/ssh" @@ -90,11 +91,17 @@ func (hs *HoneypotServer) passwordHandler(ctx ssh.Context, password string) bool ConnectionUUID: sessUUID, } country := hs.LookupCountry(la.RemoteIP) + if utf8.RuneCountInString(country) > 2 { + hs.Logger.Warnw("Too many characters in country", "country", country, "runecount", utf8.RuneCountInString(country)) + country = "??" + } + la.Country = country hs.Logger.Infow("Login attempt", "remote_ip", la.RemoteIP.String(), "username", la.Username, - "password", la.Password) + "password", la.Password, + "country", la.Country) if err := hs.attemptStore.AddAttempt(&la); err != nil { hs.Logger.Warnw("Error adding attempt to store", "error", err) diff --git a/version.go b/version.go index 56a1314..e84afe6 100644 --- a/version.go +++ b/version.go @@ -5,7 +5,7 @@ import ( "runtime" ) -var Version = "v0.1.8" +var Version = "v0.1.9" var Build string func FullVersion() string {