From 735114edbd74b36b7168d2343b055d3234124999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sat, 10 Apr 2021 15:18:55 +0200 Subject: [PATCH] Attempt to fix postgres stats --- honeypot/store/postgres.go | 2 ++ honeypot/store/store.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/honeypot/store/postgres.go b/honeypot/store/postgres.go index 095b0f4..06a37d6 100644 --- a/honeypot/store/postgres.go +++ b/honeypot/store/postgres.go @@ -97,6 +97,8 @@ func (s *PostgresStore) Stats(statType LoginStats, limit int) ([]StatsResult, er 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 group by username order by count desc` + default: + return nil, fmt.Errorf("invalid stat type") } if limit > 0 { diff --git a/honeypot/store/store.go b/honeypot/store/store.go index a0c06ff..c3939bf 100644 --- a/honeypot/store/store.go +++ b/honeypot/store/store.go @@ -8,9 +8,9 @@ const ( LoginStatsUndefined LoginStats = "" LoginStatsPasswords LoginStats = "password" LoginStatsCountry LoginStats = "country" - LoginStatsIP LoginStats = "ips" + LoginStatsIP LoginStats = "ip" LoginStatsUsername LoginStats = "username" - LoginStatsTotals LoginStats = "totals" + LoginStatsTotals LoginStats = "total" ) type StatsResult struct {