From 433cefa1f4b4f0bf3da736cac3d4fe75bbb69a8b Mon Sep 17 00:00:00 2001 From: Andrey Vertiprahov Date: Sat, 25 Sep 2021 11:55:19 +0500 Subject: [PATCH] Generation reverse IPv6 DNS zone with hex characters --- core/dns/rr.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/dns/rr.py b/core/dns/rr.py index 23bdf6e336..de75fb97ab 100644 --- a/core/dns/rr.py +++ b/core/dns/rr.py @@ -1,10 +1,13 @@ # ---------------------------------------------------------------------- # RR helper class # ---------------------------------------------------------------------- -# Copyright (C) 2007-2020 The NOC Project +# Copyright (C) 2007-2021 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- +# python modules +import string + # NOC modules from .encoding import to_idna @@ -96,4 +99,9 @@ class RR(object): try: return int(v) except ValueError: - return v + return int(v, base=16) if RR.is_hex(v) else v + + @staticmethod + def is_hex(s): + hex_digits = set(string.hexdigits) + return all(c in hex_digits for c in s) -- GitLab