Additional and optional fields added

This commit is contained in:
Alexandre Dulaunoy 2017-04-20 23:12:56 +02:00
parent 04497ab6b3
commit 5513d6290b
2 changed files with 4 additions and 2 deletions

View file

@ -10,7 +10,7 @@
import redis
from prettytable import PrettyTable
fieldsSagan = ['Type', 'Name', 'TTL', 'Class']
fieldsSagan = ['Type', 'Name', 'TTL', 'Class', 'Serial', 'Rname', 'MasterServerName', 'MaintainerName', 'Data']
limit = 100
r = redis.StrictRedis(host='localhost', port=6379)

View file

@ -19,7 +19,7 @@ import base64
# Fields name are different in sagan and cousteau for parsed DNS
fields = ['TYPE', 'NAME']
fieldsSagan = ['Type', 'Name', 'TTL', 'Class']
fieldsSagan = ['Type', 'Name', 'TTL', 'Class', 'Serial', 'Rname', 'MasterServerName', 'MaintainerName', 'Data']
def process_answers(data=None, sagan=False):
if data is None:
@ -31,6 +31,8 @@ def process_answers(data=None, sagan=False):
#r.zincrby('mname', answer['MNAME'], 1)
else:
for field in fieldsSagan:
if field not in data:
continue
r.zincrby(field.upper(), data[field], 1)
def truncating(default=50):