Log country
This commit is contained in:
parent
2b016aecb2
commit
a76a95b300
@ -6,6 +6,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
gossh "golang.org/x/crypto/ssh"
|
gossh "golang.org/x/crypto/ssh"
|
||||||
|
|
||||||
@ -90,11 +91,17 @@ func (hs *HoneypotServer) passwordHandler(ctx ssh.Context, password string) bool
|
|||||||
ConnectionUUID: sessUUID,
|
ConnectionUUID: sessUUID,
|
||||||
}
|
}
|
||||||
country := hs.LookupCountry(la.RemoteIP)
|
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
|
la.Country = country
|
||||||
hs.Logger.Infow("Login attempt",
|
hs.Logger.Infow("Login attempt",
|
||||||
"remote_ip", la.RemoteIP.String(),
|
"remote_ip", la.RemoteIP.String(),
|
||||||
"username", la.Username,
|
"username", la.Username,
|
||||||
"password", la.Password)
|
"password", la.Password,
|
||||||
|
"country", la.Country)
|
||||||
|
|
||||||
if err := hs.attemptStore.AddAttempt(&la); err != nil {
|
if err := hs.attemptStore.AddAttempt(&la); err != nil {
|
||||||
hs.Logger.Warnw("Error adding attempt to store", "error", err)
|
hs.Logger.Warnw("Error adding attempt to store", "error", err)
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "v0.1.8"
|
var Version = "v0.1.9"
|
||||||
var Build string
|
var Build string
|
||||||
|
|
||||||
func FullVersion() string {
|
func FullVersion() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user