diff --git a/sql/sites-top.sh b/sql/sites-top.sh new file mode 100755 index 0000000..78f1189 --- /dev/null +++ b/sql/sites-top.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +sqlite3 badger.sqlite3 -batch "SELECT s.fqdn AS site, + COUNT(DISTINCT t.base) AS num_trackers + FROM site s + JOIN tracking tr ON tr.site_id = s.id + JOIN tracker t ON t.id = tr.tracker_id + JOIN scan ON scan.id = tr.scan_id + WHERE scan.start_time > DATETIME('now', '-30 day') + GROUP BY s.id + ORDER BY num_trackers DESC + LIMIT 30" | column -s '|' -t