From c5ffc56c587c792aa6f8aca69d7d45f0a67c0f60 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 28 Sep 2018 16:08:10 +0200 Subject: [PATCH] ProtobufLogger: Add support for the ServerIdentity field --- contrib/ProtobufLogger.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/contrib/ProtobufLogger.py b/contrib/ProtobufLogger.py index 66f6d53939..7e9af015b8 100644 --- a/contrib/ProtobufLogger.py +++ b/contrib/ProtobufLogger.py @@ -152,9 +152,14 @@ class PDNSPBConnHandler(object): protostr = 'TCP' messageidstr = binascii.hexlify(bytearray(msg.messageId)) + + serveridstr = 'N/A' + if msg.HasField('serverIdentity'): + serveridstr = msg.serverIdentity + initialrequestidstr = '' if msg.HasField('initialRequestId'): - initialrequestidstr = ', initial uuid: ' + binascii.hexlify(bytearray(msg.initialRequestId)) + initialrequestidstr = ', initial uuid: %s ' % (binascii.hexlify(bytearray(msg.initialRequestId))) requestorstr = '' requestor = self.getRequestorSubnet(msg) @@ -165,7 +170,7 @@ class PDNSPBConnHandler(object): requestorId = msg.requestorId print('[%s] %s of size %d: %s%s -> %s (%s), id: %d, uuid: %s%s ' - 'requestorid: %s deviceid: %s' % (datestr, + 'requestorid: %s deviceid: %s serverid: %s' % (datestr, typestr, msg.inBytes, ipfromstr, @@ -176,7 +181,8 @@ class PDNSPBConnHandler(object): messageidstr, initialrequestidstr, requestorId, - deviceId)) + deviceId, + serveridstr)) def getRequestorSubnet(self, msg): requestorstr = None -- 2.47.2