From a5b344277c04bfc5b38ddbdf6f97f13ed3624f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sat, 10 Apr 2021 12:07:11 +0200 Subject: [PATCH] Fix some queries in postgres store --- honeypot/store/postgres.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 {