Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-dnslib for openSUSE:Factory 
checked in at 2022-09-29 18:12:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-dnslib (Old)
 and      /work/SRC/openSUSE:Factory/.python-dnslib.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-dnslib"

Thu Sep 29 18:12:07 2022 rev:5 rq:1006507 version:0.9.20

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-dnslib/python-dnslib.changes      
2022-01-23 18:38:49.513891674 +0100
+++ /work/SRC/openSUSE:Factory/.python-dnslib.new.2275/python-dnslib.changes    
2022-09-29 18:12:17.595130539 +0200
@@ -1,0 +2,13 @@
+Tue Sep 27 18:30:29 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com>
+
+- update to 0.9.21: 
+  *  Issue #43 (0.9.21 Raises TypeError instead of DNSError when failing to 
parse HTTPS records)
+  *  setup.py
+
+- update 0.9.20
+  * Merge pull request #41 from felixonmars/patch-1
+    Correct typos in dns.py
+  * Add wheel instructions
+  * Set theme jekyll-theme-minimal
+
+-------------------------------------------------------------------

Old:
----
  dnslib-0.9.19.tar.gz

New:
----
  dnslib-0.9.20.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-dnslib.spec ++++++
--- /var/tmp/diff_new_pack.deL0EX/_old  2022-09-29 18:12:18.047131423 +0200
+++ /var/tmp/diff_new_pack.deL0EX/_new  2022-09-29 18:12:18.051131431 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-dnslib
-Version:        0.9.19
+Version:        0.9.20
 Release:        0
 Summary:        Simple library to encode/decode DNS wire-format packets
 License:        BSD-2-Clause

++++++ dnslib-0.9.19.tar.gz -> dnslib-0.9.20.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnslib-0.9.19/PKG-INFO new/dnslib-0.9.20/PKG-INFO
--- old/dnslib-0.9.19/PKG-INFO  2022-01-17 23:22:18.456132200 +0100
+++ new/dnslib-0.9.20/PKG-INFO  2022-07-17 23:58:51.444941800 +0200
@@ -1,11 +1,10 @@
 Metadata-Version: 2.1
 Name: dnslib
-Version: 0.9.19
+Version: 0.9.20
 Summary: Simple library to encode/decode DNS wire-format packets
 Home-page: https://github.com/paulc/dnslib
 Author: PaulC
 License: BSD
-Platform: UNKNOWN
 Classifier: Topic :: Internet :: Name Service (DNS)
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 3
@@ -381,7 +380,16 @@
                             Issue 16: uncaught exceptions leak open sockets
  *   0.9.18  2022-01-09  Validate TXID in client.py (Issue #30 - thanks to 
@daniel4x)
  *   0.9.19  2022-01-09  Allow custom log function (logf) in  DNSLogger
-                         (Issue #31 - trhanks to @DmitryFrolovTri)
+                            (Issue #31 - thanks to @DmitryFrolovTri)
+ *   0.9.20  2022-07-17  Fix DeprecationWarnings about invalid escape sequences
+                            (Pull-Request #39 - thanks to @brianmaissy)
+                         Make DNSLabel matchSuffix and stripSuffix 
case-insensitive
+                            (Pull-Request #37 - thanks to @NiKiZe)
+                         Add support for HTTPS RR
+                            (Pull-Request #35 - thanks to @jkl-caliber)
+                         Fix display of non-printable characters in TXT records
+                            (Issue #32 - thanks to @sbv-csis)
+                         Add --strip-aaaa option to dnslib.proxy 
 
 License:
 --------
@@ -399,5 +407,3 @@
  *   https://github.com/paulc/dnslib
 
  (Note: https://bitbucket.org/paulc/dnslib has been deprecated and will not be 
updated)
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnslib-0.9.19/README new/dnslib-0.9.20/README
--- old/dnslib-0.9.19/README    2022-01-17 23:22:11.000000000 +0100
+++ new/dnslib-0.9.20/README    2022-07-17 23:51:51.000000000 +0200
@@ -367,7 +367,16 @@
                             Issue 16: uncaught exceptions leak open sockets
  *   0.9.18  2022-01-09  Validate TXID in client.py (Issue #30 - thanks to 
@daniel4x)
  *   0.9.19  2022-01-09  Allow custom log function (logf) in  DNSLogger
-                         (Issue #31 - trhanks to @DmitryFrolovTri)
+                            (Issue #31 - thanks to @DmitryFrolovTri)
+ *   0.9.20  2022-07-17  Fix DeprecationWarnings about invalid escape sequences
+                            (Pull-Request #39 - thanks to @brianmaissy)
+                         Make DNSLabel matchSuffix and stripSuffix 
case-insensitive
+                            (Pull-Request #37 - thanks to @NiKiZe)
+                         Add support for HTTPS RR
+                            (Pull-Request #35 - thanks to @jkl-caliber)
+                         Fix display of non-printable characters in TXT records
+                            (Issue #32 - thanks to @sbv-csis)
+                         Add --strip-aaaa option to dnslib.proxy 
 
 License:
 --------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnslib-0.9.19/dnslib/__init__.py 
new/dnslib-0.9.20/dnslib/__init__.py
--- old/dnslib-0.9.19/dnslib/__init__.py        2022-01-17 23:22:02.000000000 
+0100
+++ new/dnslib-0.9.20/dnslib/__init__.py        2022-07-17 23:51:27.000000000 
+0200
@@ -369,7 +369,16 @@
                             Issue 16: uncaught exceptions leak open sockets
  *   0.9.18  2022-01-09  Validate TXID in client.py (Issue #30 - thanks to 
@daniel4x)
  *   0.9.19  2022-01-09  Allow custom log function (logf) in  DNSLogger
-                         (Issue #31 - trhanks to @DmitryFrolovTri)
+                            (Issue #31 - thanks to @DmitryFrolovTri)
+ *   0.9.20  2022-07-17  Fix DeprecationWarnings about invalid escape sequences
+                            (Pull-Request #39 - thanks to @brianmaissy)
+                         Make DNSLabel matchSuffix and stripSuffix 
case-insensitive
+                            (Pull-Request #37 - thanks to @NiKiZe)
+                         Add support for HTTPS RR
+                            (Pull-Request #35 - thanks to @jkl-caliber)
+                         Fix display of non-printable characters in TXT records
+                            (Issue #32 - thanks to @sbv-csis)
+                         Add --strip-aaaa option to dnslib.proxy 
 
 License:
 --------
@@ -392,7 +401,7 @@
 
 from dnslib.dns import *
 
-version = "0.9.19"
+version = "0.9.20"
 
 if __name__ == '__main__':
     import doctest,sys,textwrap
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnslib-0.9.19/dnslib/dns.py 
new/dnslib-0.9.20/dnslib/dns.py
--- old/dnslib-0.9.19/dnslib/dns.py     2021-05-07 18:06:41.000000000 +0200
+++ new/dnslib-0.9.20/dnslib/dns.py     2022-07-17 23:49:03.000000000 +0200
@@ -1058,16 +1058,27 @@
     else:
         return x.encode()
 
+# Python 2 does not have isprintable()
+def _isprint(c):
+    return (32 <= ord(c) <= 126) or (ord(c) > 127)
+
+
+def _bytes_to_printable(b):
+    return '"' + ''.join([ (c if _isprint(c) else "\\{0:03o}".format(ord(c))) 
for c in b.decode(errors='replace') ]) + '"'
+
 class TXT(RD):
     """
-        DNS TXT record. Pass in either a single string, or a tuple/list of 
strings.
+        DNS TXT record. Pass in either a single byte/unicode string, or a 
tuple/list of byte/unicode strings.
+        (byte strings are prefered as this avoids possible encoding issues)
 
-        >>> TXT('txtvers=1')
+        >>> TXT(b'txtvers=1')
         "txtvers=1"
-        >>> TXT(('txtvers=1',))
+        >>> TXT((b'txtvers=1',))
         "txtvers=1"
-        >>> TXT(['txtvers=1',])
+        >>> TXT([b'txtvers=1',])
         "txtvers=1"
+        >>> TXT([b'txtvers=1',b'swver=2.5'])
+        "txtvers=1","swver=2.5"
         >>> TXT(['txtvers=1','swver=2.5'])
         "txtvers=1","swver=2.5"
         >>> a = DNSRecord()
@@ -1121,10 +1132,10 @@
             buffer.append(ditem)
 
     def toZone(self):
-        return " ".join([ '"%s"' % x.decode(errors='replace') for x in 
self.data ])
+        return " ".join([ _bytes_to_printable(x) for x in self.data ])
 
     def __repr__(self):
-        return ",".join([ '"%s"' % x.decode(errors='replace') for x in 
self.data ])
+        return ",".join([ _bytes_to_printable(x) for x in self.data ])
 
 class A(RD):
 
@@ -1761,14 +1772,328 @@
         return "%d %s \"%s\"" % (self.flags, self.tag, self.value)
 
 
+class HTTPS(RD):
+    """
+        HTTPS record.
+
+        >>> HTTPS.fromZone(["1", "cloudflare.com."])
+        1 cloudflare.com.
+        >>> HTTPS.fromZone(["1", ".", "mandatory=key65444,echconfig"])
+        1 . mandatory=key65444,echconfig
+        >>> HTTPS.fromZone(["1", ".", "alpn=h3,h3-29,h2"])
+        1 . alpn=h3,h3-29,h2
+        >>> HTTPS.fromZone(["1", ".", "no-default-alpn"])
+        1 . no-default-alpn
+        >>> HTTPS.fromZone(["1", ".", "port=443"])
+        1 . port=443
+        >>> HTTPS.fromZone(["1", ".", 
"ipv4hint=104.16.132.229,104.16.133.229"])
+        1 . ipv4hint=104.16.132.229,104.16.133.229
+        >>> HTTPS.fromZone(["1", ".", "echconfig=Z2FyYmFnZQ=="])
+        1 . echconfig=Z2FyYmFnZQ==
+        >>> HTTPS.fromZone(["1", ".", 
"ipv6hint=2606:4700::6810:84e5,2606:4700::6810:85e5"])
+        1 . ipv6hint=2606:4700::6810:84e5,2606:4700::6810:85e5
+        >>> HTTPS.fromZone(["1", ".", "key9999=X"])
+        1 . key9999=X
+        >>> pcap = 
binascii.unhexlify(b"0001000001000c0268330568332d323902683200040008681084e5681085e500060020260647000000000000000000681084e5260647000000000000000000681085e5")
+        >>> obj = HTTPS.parse(Buffer(pcap), len(pcap))
+        >>> obj
+        1 . alpn=h3,h3-29,h2 ipv4hint=104.16.132.229,104.16.133.229 
ipv6hint=2606:4700::6810:84e5,2606:4700::6810:85e5
+        >>> b = Buffer()
+        >>> obj.pack(b)
+        >>> b.data == pcap
+        True
+        >>> pcap = binascii.unhexlify(b"00010000040004c0a80126")
+        >>> obj = HTTPS.parse(Buffer(pcap), len(pcap))
+        >>> obj
+        1 . ipv4hint=192.168.1.38
+        >>> b = Buffer()
+        >>> obj.pack(b)
+        >>> b.data == pcap
+        True
+    """
+
+    attrs = ('priority', 'target', 'params')
+
+    def __init__(self, priority, target, params):
+        self.priority = priority
+        self.target = target
+        self.params = params
+
+    @classmethod
+    def parse(cls,buffer,length):
+        try:
+            priority, = buffer.unpack("!H")
+            target = []
+            while True:
+                n, = buffer.unpack("B")
+                if n == 0:
+                    break
+                seg = bytearray(buffer.get(n))
+                target.append(seg)
+            params = []
+            while buffer.remaining() > 0:
+                k, = buffer.unpack("!H")
+                n, = buffer.unpack("!H")
+                v = bytearray(buffer.get(n))
+                params.append((k, v))
+            return cls(priority, target, params)
+        except (BufferError,BimapError) as e:
+            raise DNSError("Error unpacking HTTPS: " + str(e) + 
buffer.data[buffer.offset:].hex())
+
+    def pack(self,buffer):
+        buffer.pack("!H", self.priority)
+        for seg in self.target:
+            buffer.pack("B", len(seg))
+            buffer.append(seg)
+        buffer.pack("B", 0)
+        for k, v in self.params:
+            buffer.pack("!H", k)
+            buffer.pack("!H", len(v))
+            buffer.append(v)
+
+    @classmethod
+    def zf_parse_valuelist(cls, s):
+        """
+            >>> HTTPS.zf_parse_valuelist(bytearray(b'"part1,part2\\\\,part3"'))
+            [bytearray(b'part1'), bytearray(b'part2,part3')]
+            >>> HTTPS.zf_parse_valuelist(bytearray(b'part1,part2\\\\044part3'))
+            [bytearray(b'part1'), bytearray(b'part2,part3')]
+        """
+        quot = 0x22
+        slash = 0x5c
+        comma = 0x2c
+        if len(s) == 0:
+            return []
+        if s[0] == quot:
+            if len(s) < 2 or s[-1] != quot:
+                raise DNSError("Error decoding HTTPS SvcParamKey value list: 
unmatched \"")
+            s = s[1:-1]
+        if len(s) == 0:
+            return []
+        esc = False
+        i = 0
+        ret = [bytearray()]
+        while i < len(s):
+            c = s[i]
+            if esc:
+                esc = False
+                if c >= 0x30 and c <= 0x32: #0 1 2
+                    ret[-1].append(int(s[i:i+3]))
+                    i += 3
+                else:
+                    ret[-1].append(c)
+                    i += 1
+            else:
+                if c == slash:
+                    esc = True
+                    i += 1
+                elif c == comma:
+                    ret.append(bytearray())
+                    i += 1
+                else:
+                    ret[-1].append(c)
+                    i += 1
+        if esc:
+            raise DNSError("Error decoding HTTPS SvcParamKey value list: 
hanging slash")
+        return ret
+
+    @classmethod
+    def zf_parse_charstr(cls, s):
+        """
+            >>> HTTPS.zf_parse_charstr(bytearray(b'"part1,part2\\\\,part3"'))
+            bytearray(b'part1,part2,part3')
+            >>> HTTPS.zf_parse_charstr(bytearray(b'part1,part2\\\\044part3'))
+            bytearray(b'part1,part2,part3')
+        """
+        quot = 0x22
+        slash = 0x5c
+        if len(s) == 0:
+            return bytearray()
+        if s[0] == quot:
+            if len(s) < 2 or s[-1] != quot:
+                raise DNSError("Error decoding HTTPS SvcParamKey charstring: 
unmatched \"")
+            s = s[1:-1]
+        esc = False
+        i = 0
+        ret = bytearray()
+        while i < len(s):
+            c = s[i]
+            if esc:
+                esc = False
+                if c >= 0x30 and c <= 0x32: #0 1 2
+                    ret.append(int(s[i:i+3]))
+                    i += 3
+                else:
+                    ret.append(c)
+                    i += 1
+            else:
+                if c == slash:
+                    esc = True
+                    i += 1
+                else:
+                    ret.append(c)
+                    i += 1
+        if esc:
+            raise DNSError("Error decoding HTTPS SvcParamKey charstring: 
hanging slash")
+        return ret
+
+    @classmethod
+    def zf_tobytes(cls, s):
+        ''' for py2-3 compatibility '''
+        return bytearray(s.encode("ASCII"))
+
+    @classmethod
+    def zf_tostr(cls, b):
+        return b.decode("ASCII")
+
+    paramkeys = [
+        (0, b"mandatory"),
+        (1, b"alpn"),
+        (2, b"no-default-alpn"),
+        (3, b"port"),
+        (4, b"ipv4hint"),
+        (5, b"echconfig"),
+        (6, b"ipv6hint")
+    ]
+
+    @classmethod
+    def zf_parse_key(cls, k):
+        if k.startswith(b"key"):
+            return int(k[3:])
+        for i, n in cls.paramkeys:
+            if k == n:
+                return i
+        raise DNSError("Error reading HTTPS from zone: unrecognized 
SvcParamKey")
+
+    @classmethod
+    def zf_parse_param(cls, k, v):
+        b = Buffer()
+        i = cls.zf_parse_key(k)
+        if   i == 0: #mandatory
+            for s in cls.zf_parse_valuelist(v):
+                si = cls.zf_parse_key(s)
+                b.pack("!H", si)
+        elif i == 1: #alpn
+            for s in cls.zf_parse_valuelist(v):
+                b.pack("B", len(s))
+                b.append(s)
+        elif i == 2: #no alpn
+            if v:
+                raise DNSError("Error encoding HTTPS SvcParamKey: 
no-default-alpn should not have a value")
+        elif i == 3: #port
+            b.pack("!H", int(v))
+        elif i == 4: #ipv4
+            for ip in cls.zf_parse_valuelist(v):
+                b.pack("!4B", *[int(x) for x in ip.split(b".")])
+        elif i == 5: #ech
+            s = cls.zf_parse_charstr(v)
+            b.data = binascii.a2b_base64(s)
+        elif i == 6: #ipv6
+            for ip in cls.zf_parse_valuelist(v):
+                oc = _parse_ipv6(cls.zf_tostr(ip))
+                b.pack("!16B", *oc)
+        else:
+            b.data = v
+        return (i, b.data)
+
+    @classmethod
+    def fromZone(cls,rd,origin=None):
+        pri = int(rd[0])
+        targ = [] if rd[1] == "." else cls.zf_tobytes(rd[1]).split(b".")[:-1]
+        params = []
+        for kv in [cls.zf_tobytes(v) for v in rd[2:]]:
+            eq = kv.find(b"=")
+            if eq < 0:
+                k = kv
+                v = bytearray()
+            else:
+                k = kv[:eq]
+                v = kv[eq+1:]
+            params.append(cls.zf_parse_param(k, v))
+        return cls(pri, targ, params)
+
+    @classmethod
+    def zf_is_special(cls, c):
+        return not (c == 0x21 or \
+            c >= 0x23 and c<=0x27 or \
+            c >= 0x2A and c<=0x3A or \
+            c >= 0x3C and c<=0x5B or \
+            c >= 0x5D and c<=0x7E)
+
+    @classmethod
+    def zf_escape_charstr(cls, s, escape_commas=False):
+        ret = bytearray()
+        for c in s:
+            if cls.zf_is_special(c) or escape_commas and c == 0x2c:
+                ret.extend(b"\\")
+                ret.extend(b"%.3d" % c)
+            else:
+                ret.append(c)
+        return cls.zf_tostr(ret)
+
+    @classmethod
+    def zf_format_valuelist(cls, lst):
+        return ",".join(cls.zf_escape_charstr(s, True) for s in lst)
 
+    @classmethod
+    def zf_format_key(cls, k):
+        for i, n in cls.paramkeys:
+            if k == i:
+                return cls.zf_tostr(n)
+        return "key" + str(k)
+
+    @classmethod
+    def zf_format_param(cls, i, v):
+        b = Buffer(v)
+        k = cls.zf_format_key(i)
+        if i == 0: #mandatory
+            ret = []
+            while b.remaining() > 0:
+                ki, = b.unpack("!H")
+                ret.append(cls.zf_format_key(ki))
+            ret = ",".join(ret)
+        elif i == 1: #alpn
+            ret = []
+            while b.remaining() > 0:
+                n, = b.unpack("B")
+                ret.append(bytearray(b.get(n)))
+            ret = cls.zf_format_valuelist(ret)
+        elif i == 2: #no-alpn
+            if b.remaining() > 0:
+                raise DNSError("Error decoding HTTPS SvcParamKey: 
no-default-alpn should not have a value")
+            ret = ""
+        elif i == 3: #port
+            ret = str(b.unpack("!H")[0])
+        elif i == 4: #ipv4
+            ret = []
+            while b.remaining() > 0:
+                ip = "%d.%d.%d.%d" % b.unpack("!4B")
+                ret.append(ip)
+            ret = ",".join(ret)
+        elif i == 5: #ech
+            ret = cls.zf_tostr(binascii.b2a_base64(v).rstrip())
+        elif i == 6: #ipv6
+            ret = []
+            while b.remaining() > 0:
+                ip = b.unpack("!16B")
+                ret.append(_format_ipv6(ip))
+            ret = ",".join(ret)
+        else:
+            ret = cls.zf_tostr(v)
+        return k + ("=" + ret if ret else "")
+
+    def __repr__(self):
+        pri = str(self.priority)
+        targ = ".".join([self.zf_tostr(t) for t in self.target]) + "."
+        return " ".join([pri, targ] + [self.zf_format_param(k, v) for k,v in 
self.params])
 
 # Map from RD type to class (used to pack/unpack records)
 # If you add a new RD class you must add to RDMAP
 
 RDMAP = { 'CNAME':CNAME, 'A':A, 'AAAA':AAAA, 'TXT':TXT, 'MX':MX,
           'PTR':PTR, 'SOA':SOA, 'NS':NS, 'NAPTR': NAPTR, 'SRV':SRV,
-          'DNSKEY':DNSKEY, 'RRSIG':RRSIG, 'NSEC':NSEC, 'CAA':CAA
+          'DNSKEY':DNSKEY, 'RRSIG':RRSIG, 'NSEC':NSEC, 'CAA':CAA,
+          'HTTPS': HTTPS
         }
 
 ##
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnslib-0.9.19/dnslib/label.py 
new/dnslib-0.9.20/dnslib/label.py
--- old/dnslib-0.9.19/dnslib/label.py   2021-05-07 17:46:56.000000000 +0200
+++ new/dnslib-0.9.20/dnslib/label.py   2022-07-17 23:44:57.000000000 +0200
@@ -50,6 +50,8 @@
     True
     >>> l3.matchSuffix("xxx.yyy.")
     False
+    >>> l3.matchSuffix("Bbb.ccc.")
+    True
     >>> l3.stripSuffix("bbb.ccc.")
     <DNSLabel: 'xxx.yyy.aaa.'>
     >>> l3.matchGlob("*.[abc]aa.BBB.ccc")
@@ -113,14 +115,14 @@
             Return True if label suffix matches
         """
         suffix = DNSLabel(suffix)
-        return self.label[-len(suffix.label):] == suffix.label
+        return DNSLabel(self.label[-len(suffix.label):]) == suffix
 
     def stripSuffix(self,suffix):
         """
             Strip suffix from label
         """
         suffix = DNSLabel(suffix)
-        if self.label[-len(suffix.label):] == suffix.label:
+        if self.matchSuffix(suffix):
             return DNSLabel(self.label[:-len(suffix.label)])
         else:
             return self
@@ -134,7 +136,7 @@
             return s.decode()
         else:
             # Need to encode
-            return "".join([(chr(c) if (c in LDH) else "\%03d" % c) for c in 
s])
+            return "".join([(chr(c) if (c in LDH) else "\\%03d" % c) for c in 
s])
 
     def __str__(self):
         return ".".join([ self._decode(bytearray(s)) for s in self.label ]) + 
"."
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnslib-0.9.19/dnslib/lex.py 
new/dnslib-0.9.20/dnslib/lex.py
--- old/dnslib-0.9.19/dnslib/lex.py     2020-06-09 10:01:28.000000000 +0200
+++ new/dnslib-0.9.20/dnslib/lex.py     2022-07-17 23:44:57.000000000 +0200
@@ -145,7 +145,7 @@
         To emit SPACE tokens: self.spacetok = ('SPACE',None)
         To emit NL tokens: self.nltok = ('NL',None)
 
-        >>> l = WordLexer(r'abc "def\100\x3d\. ghi" jkl')
+        >>> l = WordLexer(r'abc "def\100\x3d\\. ghi" jkl')
         >>> list(l)
         [('ATOM', 'abc'), ('ATOM', 'def@=. ghi'), ('ATOM', 'jkl')]
         >>> l = WordLexer(r"1 '2 3 4' 5")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnslib-0.9.19/dnslib/proxy.py 
new/dnslib-0.9.20/dnslib/proxy.py
--- old/dnslib-0.9.19/dnslib/proxy.py   2022-01-17 23:00:20.000000000 +0100
+++ new/dnslib-0.9.20/dnslib/proxy.py   2022-07-17 23:36:33.000000000 +0200
@@ -4,7 +4,7 @@
 
 import binascii,socket,struct
 
-from dnslib import DNSRecord,RCODE
+from dnslib import DNSRecord,RCODE,QTYPE
 from dnslib.server import DNSServer,DNSHandler,BaseResolver,DNSLogger
 
 class ProxyResolver(BaseResolver):
@@ -29,20 +29,25 @@
 
     """
 
-    def __init__(self,address,port,timeout=0):
+    def __init__(self,address,port,timeout=0,strip_aaaa=False):
         self.address = address
         self.port = port
         self.timeout = timeout
+        self.strip_aaaa = strip_aaaa
 
     def resolve(self,request,handler):
         try:
-            if handler.protocol == 'udp':
-                proxy_r = request.send(self.address,self.port,
-                                timeout=self.timeout)
+            if self.strip_aaaa and request.q.qtype == QTYPE.AAAA:
+                reply = request.reply()
+                reply.header.rcode = RCODE.NXDOMAIN
             else:
-                proxy_r = request.send(self.address,self.port,
-                                tcp=True,timeout=self.timeout)
-            reply = DNSRecord.parse(proxy_r)
+                if handler.protocol == 'udp':
+                    proxy_r = request.send(self.address,self.port,
+                                    timeout=self.timeout)
+                else:
+                    proxy_r = request.send(self.address,self.port,
+                                    tcp=True,timeout=self.timeout)
+                reply = DNSRecord.parse(proxy_r)
         except socket.timeout:
             reply = request.reply()
             reply.header.rcode = getattr(RCODE,'NXDOMAIN')
@@ -126,6 +131,8 @@
     p.add_argument("--timeout","-o",type=float,default=5,
                     metavar="<timeout>",
                     help="Upstream timeout (default: 5s)")
+    p.add_argument("--strip-aaaa",action='store_true',default=False,
+                    help="Retuen NXDOMAIN for AAAA queries (default: off)")
     p.add_argument("--passthrough",action='store_true',default=False,
                     help="Dont decode/re-encode request/response (default: 
off)")
     p.add_argument("--log",default="request,reply,truncated,error",
@@ -142,7 +149,7 @@
                         args.dns,args.dns_port,
                         "UDP/TCP" if args.tcp else "UDP"))
 
-    resolver = ProxyResolver(args.dns,args.dns_port,args.timeout)
+    resolver = 
ProxyResolver(args.dns,args.dns_port,args.timeout,args.strip_aaaa)
     handler = PassthroughDNSHandler if args.passthrough else DNSHandler
     logger = DNSLogger(args.log,prefix=args.log_prefix)
     udp_server = DNSServer(resolver,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnslib-0.9.19/dnslib.egg-info/PKG-INFO 
new/dnslib-0.9.20/dnslib.egg-info/PKG-INFO
--- old/dnslib-0.9.19/dnslib.egg-info/PKG-INFO  2022-01-17 23:22:18.000000000 
+0100
+++ new/dnslib-0.9.20/dnslib.egg-info/PKG-INFO  2022-07-17 23:58:50.000000000 
+0200
@@ -1,11 +1,10 @@
 Metadata-Version: 2.1
 Name: dnslib
-Version: 0.9.19
+Version: 0.9.20
 Summary: Simple library to encode/decode DNS wire-format packets
 Home-page: https://github.com/paulc/dnslib
 Author: PaulC
 License: BSD
-Platform: UNKNOWN
 Classifier: Topic :: Internet :: Name Service (DNS)
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 3
@@ -381,7 +380,16 @@
                             Issue 16: uncaught exceptions leak open sockets
  *   0.9.18  2022-01-09  Validate TXID in client.py (Issue #30 - thanks to 
@daniel4x)
  *   0.9.19  2022-01-09  Allow custom log function (logf) in  DNSLogger
-                         (Issue #31 - trhanks to @DmitryFrolovTri)
+                            (Issue #31 - thanks to @DmitryFrolovTri)
+ *   0.9.20  2022-07-17  Fix DeprecationWarnings about invalid escape sequences
+                            (Pull-Request #39 - thanks to @brianmaissy)
+                         Make DNSLabel matchSuffix and stripSuffix 
case-insensitive
+                            (Pull-Request #37 - thanks to @NiKiZe)
+                         Add support for HTTPS RR
+                            (Pull-Request #35 - thanks to @jkl-caliber)
+                         Fix display of non-printable characters in TXT records
+                            (Issue #32 - thanks to @sbv-csis)
+                         Add --strip-aaaa option to dnslib.proxy 
 
 License:
 --------
@@ -399,5 +407,3 @@
  *   https://github.com/paulc/dnslib
 
  (Note: https://bitbucket.org/paulc/dnslib has been deprecated and will not be 
updated)
-
-

Reply via email to