diff --git a/honeypot/store/postgres.go b/honeypot/store/postgres.go index d4ed193..095b0f4 100644 --- a/honeypot/store/postgres.go +++ b/honeypot/store/postgres.go @@ -90,13 +90,13 @@ func (s *PostgresStore) Stats(statType LoginStats, limit int) ([]StatsResult, er switch statType { case LoginStatsCountry: - stmt = `select country, count(country) from login_attempts order by count desc` + stmt = `select country, count(country) from login_attempts group by country order by count desc` case LoginStatsIP: - stmt = `select remote_ip, count(remote_ip) from login_attempts order by count desc` + stmt = `select remote_ip, count(remote_ip) from login_attempts group by remote_ip order by count desc` case LoginStatsPasswords: - stmt = `select password, count(password) from login_attempts order by count desc` + stmt = `select password, count(password) from login_attempts group by password order by count desc` case LoginStatsUsername: - stmt = `select username, count(username) from login_attempts order by count desc` + stmt = `select username, count(username) from login_attempts group by username order by count desc` } if limit > 0 {