Minimal statistics added

This commit is contained in:
Alexandre Dulaunoy 2017-04-20 18:14:04 +02:00
parent e32cab8ea4
commit 9302ce2306

24
bin/get_stats.py Normal file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# coding=utf-8
#
# passive-dns-atlas - basic stats extractor
#
# Experimental Passive DNS collector and stats from the RIPE Atlas Stream
#
# Free Software released under the GNU Affero General Public License v3.0
import redis
from prettytable import PrettyTable
fieldsSagan = ['Type', 'Name', 'TTL', 'Class']
limit = 100
r = redis.StrictRedis(host='localhost', port=6379)
for field in fieldsSagan:
c = r.zrange(field.upper(), 0, limit, desc=True, withscores=True)
table = PrettyTable()
table.field_names = ["Number of occurences",field.upper()]
for value in c:
table.add_row([value[1],value[0].decode()])
print (table)