chg: [pdns] filter option to exclude records added
parent
94042a198e
commit
853e1144b9
|
@ -27,7 +27,7 @@ config = configparser.RawConfigParser()
|
||||||
config.read('../etc/analyzer.conf')
|
config.read('../etc/analyzer.conf')
|
||||||
|
|
||||||
expirations = config.items('expiration')
|
expirations = config.items('expiration')
|
||||||
|
excludesubstrings = config.get('exclude', 'substring').split(',')
|
||||||
myuuid = config.get('global', 'my-uuid')
|
myuuid = config.get('global', 'my-uuid')
|
||||||
myqueue = "analyzer:8:{}".format(myuuid)
|
myqueue = "analyzer:8:{}".format(myuuid)
|
||||||
mylogginglevel = config.get('global', 'logging-level')
|
mylogginglevel = config.get('global', 'logging-level')
|
||||||
|
@ -89,7 +89,7 @@ def process_format_passivedns(line=None):
|
||||||
|
|
||||||
while (True):
|
while (True):
|
||||||
expiration = None
|
expiration = None
|
||||||
d4_record_line = r_d4.rpop(myqueue)
|
d4_record_line = r_d4.rpop(myqueue)
|
||||||
if d4_record_line is None:
|
if d4_record_line is None:
|
||||||
time.sleep (1)
|
time.sleep (1)
|
||||||
continue
|
continue
|
||||||
|
@ -103,6 +103,13 @@ while (True):
|
||||||
logger.debug('Parsing of passive DNS line is incomplete: {}'.format(l.strip()))
|
logger.debug('Parsing of passive DNS line is incomplete: {}'.format(l.strip()))
|
||||||
continue
|
continue
|
||||||
if rdns['q'] and rdns['type']:
|
if rdns['q'] and rdns['type']:
|
||||||
|
excludeflag = False
|
||||||
|
for exclude in excludesubstrings:
|
||||||
|
if exclude in rdns['q']:
|
||||||
|
excludeflag = True
|
||||||
|
if excludeflag:
|
||||||
|
logger.debug('Excluded {}'.format(rdns['q']))
|
||||||
|
continue
|
||||||
for y in expirations:
|
for y in expirations:
|
||||||
if y[0] == rdns['type']:
|
if y[0] == rdns['type']:
|
||||||
expiration=y[1]
|
expiration=y[1]
|
||||||
|
|
|
@ -6,3 +6,5 @@ logging-level = INFO
|
||||||
[expiration]
|
[expiration]
|
||||||
16 = 24000
|
16 = 24000
|
||||||
99 = 26000
|
99 = 26000
|
||||||
|
[exclude]
|
||||||
|
substring = spamhaus.org,asn.cymru.com
|
||||||
|
|
Loading…
Reference in New Issue