OwlCyberSecurity - MANAGER
Edit File: node.cpython-312.pyc
� ����\��gw1���������������������������d�Z�ddlZddlZddlmZmZmZ�ddlZddl Zddl ZddlZddlZddl ZddlZej������������������j ������������������hZej������������������j$������������������ej������������������j&������������������ej������������������j(������������������hZd��Zej.�������������������G�d��dej0���������������������������������Z�G�d��d�������Zej6������������������j6�������������������G�d ��d e���������������Zy)z)DNS nodes. A node is a set of rdatasets.�����N)�Any�Dict�Optionalc������������������T�����||�v�xs#�|t���������j������������������j������������������k(��xr�||�v�S��N)�dns� rdatatype�RRSIG)�rdtypes�rdtype�coverss��� �7/opt/hc_python/lib/python3.12/site-packages/dns/node.py�_matches_type_or_its_signaturer���,���s+�������W��U��3�=�=�+>�+>�!>�!T�6�W�CT�U�����c��������������������������e�Zd�ZdZdZdZdZedej������������������j������������������dej������������������j������������������dd�fd���������Zed ej������������������j������������������dd�fd ���������Zy)�NodeKindzRdatasets in nodesr�����������r���r ����returnc�����������������������t��������t��������||�������rt��������j������������������S�t��������t��������||�������rt��������j ������������������S�t��������j������������������S�r���)r����_cname_typesr����CNAME�_neutral_types�NEUTRAL�REGULAR)�clsr���r ���s��� r����classifyzNodeKind.classify8���s>�������*�,���G��>�>�!� +�N�F�F� K��#�#�#��#�#�#r����rdatasetc������������������N�����|�j������������������|j������������������|j�������������������������S�r���)r���r���r ���)r���r���s��� r����classify_rdatasetzNodeKind.classify_rdatasetC���s�������|�|�H�O�O�X�_�_�=�=r���N)�__name__� __module__�__qualname__�__doc__r���r���r����classmethodr���r ���� RdataTyper���r����Rdatasetr �����r���r���r���r���0���s~��������G��G� �E��$��]�]�,�,�$�69�m�m�6M�6M�$� �$���$���>����)>�)>��>�:��>���>r���r���c��������������������l����e�Zd�ZdZdgZd��Zdej������������������j������������������de e ef���de fd�Zd��Z d ��Zd ��Zd��Zd��Zd ��Zej&������������������j(������������������dfdej*������������������j,������������������dej&������������������j.������������������dej&������������������j.������������������dedej2������������������j4������������������f d�Zej&������������������j(������������������dfdej*������������������j,������������������dej&������������������j.������������������dej&������������������j.������������������dedeej2������������������j4���������������������f d�Zej&������������������j(������������������fdej*������������������j,������������������dej&������������������j.������������������dej&������������������j.������������������ddfd�Zdej2������������������j4������������������ddfd�Zde fd�Z!defd�Z"y)�Nodea���A Node is a set of rdatasets. A node is either a CNAME node or an "other data" node. A CNAME node contains only CNAME, KEY, NSEC, and NSEC3 rdatasets along with their covering RRSIG rdatasets. An "other data" node contains any rdataset other than a CNAME or RRSIG(CNAME) rdataset. When changes are made to a node, the CNAME or "other data" state is always consistent with the update, i.e. the most recent change wins. For example, if you have a node which contains a CNAME rdataset, and then add an MX rdataset to it, then the CNAME rdataset will be deleted. Likewise if you have a node containing an MX rdataset and add a CNAME rdataset, the MX rdataset will be deleted. � rdatasetsc�����������������������g�|�_���������y�r����r+�����selfs��� r����__init__z Node.__init__Z���s ��������r����name�kwr���c�����������������������t��������j��������������������������}|�j������������������D�]D��}t��������|�������dkD��s�|j �������������������|j ������������������|fi�|����������|j ������������������d���������F�|j ��������������������������dd�S�)a"��Convert a node to text format. Each rdataset at the node is printed. Any keyword arguments to this method are passed on to the rdataset's to_text() method. *name*, a ``dns.name.Name``, the owner name of the rdatasets. Returns a ``str``. r���� N���)�io�StringIOr+����len�write�to_text�getvalue)r/���r1���r2����s�rdss��� r���r:���zNode.to_text^���sd������� �K�K�M���>�>�C��3�x�!�|��������D�/�B�/�0����� ��"���z�z�|�C�R� � r���c������������������6�����dt��������t��������|���������������z���dz���S�)Nz <DNS node �>)�str�idr.���s��� r����__repr__z Node.__repr__r���s�������c�"�T�(�m�+�c�1�1r���c�����������������������|�j�������������������D�]��}||j�������������������vs��y�|j�������������������D�]��}||�j�������������������vs��y�y)NFTr-���)r/����other�rds��� r����__eq__zNode.__eq__u���sE��������.�.�B�����(���!���/�/�B�����'���"��r���c������������������&�����|�j������������������|��������S�r���)rF���)r/���rD���s��� r����__ne__zNode.__ne__����s�������;�;�u�%�%�%r���c������������������,�����t��������|�j�������������������������S�r���)r8���r+���r.���s��� r����__len__zNode.__len__����s�������4�>�>�"�"r���c������������������,�����t��������|�j�������������������������S�r���)�iterr+���r.���s��� r����__iter__z Node.__iter__����s�������D�N�N�#�#r���c������������������ ����t��������|�j�������������������������dkD��r�t��������j������������������|�������}|t��������j������������������k(��rF|�j������������������D��cg�c]*��}t��������j������������������|�������t��������j ������������������k7��r|��,�c}|�_��������nX|t��������j ������������������k(��rE|�j������������������D��cg�c]*��}t��������j������������������|�������t��������j������������������k7��r|��,�c}|�_��������|�j������������������j ������������������|��������yc�c}w�c�c}w�)a���Append rdataset to the node with special handling for CNAME and other data conditions. Specifically, if the rdataset being appended has ``NodeKind.CNAME``, then all rdatasets other than KEY, NSEC, NSEC3, and their covering RRSIGs are deleted. If the rdataset being appended has ``NodeKind.REGULAR`` then CNAME and RRSIG(CNAME) are deleted. r���N)r8���r+���r���r ���r���r����append)r/���r����kindr=���s��� r����_append_rdatasetzNode._append_rdataset����s���������t�~�~���"��-�-�h�7�D��x�~�~�%�� $�~�~�"�-���1�1�#�6�(�:J�:J�J���-�"��� ���)�)�)�� $�~�~�"�-���1�1�#�6�(�.�.�H���-�"���� �����h�'��"��"s����/C;�(/D�F�rdclassr���r ����createc������������������������|�j�������������������D�]��}|j������������������|||�������s�|c�S��|st���������t��������j������������������j������������������|||�������}|�j ������������������|��������|S�)a*��Find an rdataset matching the specified properties in the current node. *rdclass*, a ``dns.rdataclass.RdataClass``, the class of the rdataset. *rdtype*, a ``dns.rdatatype.RdataType``, the type of the rdataset. *covers*, a ``dns.rdatatype.RdataType``, the covered type. Usually this value is ``dns.rdatatype.NONE``, but if the rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, then the covers value will be the rdata type the SIG/RRSIG covers. The library treats the SIG and RRSIG types as if they were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This makes RRSIGs much easier to work with than if RRSIGs covering different rdata types were aggregated into a single RRSIG rdataset. *create*, a ``bool``. If True, create the rdataset if it is not found. Raises ``KeyError`` if an rdataset of the desired type and class does not exist and *create* is not ``True``. Returns a ``dns.rdataset.Rdataset``. )r+����match�KeyErrorr���r���r'���rQ����r/���rR���r���r ���rS���r=���s��� r���� find_rdatasetzNode.find_rdataset����s]������@��>�>�C��y�y��&�&�1�� ��"����N��l�l�#�#�G�V�V�<�����c�"�� r���c������������������T����� �|�j������������������||||�������}|S�#�t��������$�r�d}Y�|S�w�xY�w)a���Get an rdataset matching the specified properties in the current node. None is returned if an rdataset of the specified type and class does not exist and *create* is not ``True``. *rdclass*, an ``int``, the class of the rdataset. *rdtype*, an ``int``, the type of the rdataset. *covers*, an ``int``, the covered type. Usually this value is dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or dns.rdatatype.RRSIG, then the covers value will be the rdata type the SIG/RRSIG covers. The library treats the SIG and RRSIG types as if they were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This makes RRSIGs much easier to work with than if RRSIGs covering different rdata types were aggregated into a single RRSIG rdataset. *create*, a ``bool``. If True, create the rdataset if it is not found. Returns a ``dns.rdataset.Rdataset`` or ``None``. N)rX���rV���rW���s��� r����get_rdatasetzNode.get_rdataset����s?������> ��$�$�W�f�f�f�E�C��� ����� ��C�� � �s������'�'Nc������������������f�����|�j������������������|||�������}|�|�j������������������j������������������|��������yy)aD��Delete the rdataset matching the specified properties in the current node. If a matching rdataset does not exist, it is not an error. *rdclass*, an ``int``, the class of the rdataset. *rdtype*, an ``int``, the type of the rdataset. *covers*, an ``int``, the covered type. N)rZ���r+����remove)r/���rR���r���r ���r=���s��� r����delete_rdatasetzNode.delete_rdataset����s4������$�������8���?��N�N�!�!�#�&��r����replacementc������������������N����t��������|t��������j������������������j�������������������������st ��������d��������t��������|t��������j ������������������j�������������������������r|j��������������������������}|�j������������������|j������������������|j������������������|j��������������������������|�j������������������|��������y)a���Replace an rdataset. It is not an error if there is no rdataset matching *replacement*. Ownership of the *replacement* object is transferred to the node; in other words, this method does not store a copy of *replacement* at the node, it stores *replacement* itself. *replacement*, a ``dns.rdataset.Rdataset``. Raises ``ValueError`` if *replacement* is not a ``dns.rdataset.Rdataset``. zreplacement is not an rdatasetN) � isinstancer���r���r'���� ValueError�rrset�RRset�to_rdatasetr]���rR���r���r ���rQ����r/���r^���s��� r����replace_rdatasetzNode.replace_rdataset ��s}��������+�s�|�|�'<�'<�=��=�>�>��k�3�9�9�?�?�3��&�1�1�3�K��������!3�!3�[�5G�5G� �� ���k�*r���c������������������������|�j�������������������D�]C��}t��������j������������������|j������������������|j�������������������������}|t��������j ������������������k7��s�A|c�S��t��������j ������������������S�)aT��Classify a node. A node which contains a CNAME or RRSIG(CNAME) is a ``NodeKind.CNAME`` node. A node which contains only "neutral" types, i.e. types allowed to co-exist with a CNAME, is a ``NodeKind.NEUTRAL`` node. The neutral types are NSEC, NSEC3, KEY, and their associated RRSIGS. An empty node is also considered neutral. A node which contains some rdataset which is not a CNAME, RRSIG(CNAME), or a neutral type is a a ``NodeKind.REGULAR`` node. Regular nodes are also commonly referred to as "other data". )r+���r���r���r���r ���r���)r/���r���rP���s��� r���r���z Node.classify$��sM����������H��$�$�X�_�_�h�o�o�F�D��x�'�'�'����'�����r���c������������������������y)NFr(���r.���s��� r����is_immutablezNode.is_immutable9��s������r���)#r!���r"���r#���r$���� __slots__r0���r���r1����Namer���r@���r���r:���rB���rF���rH���rJ���rM���rQ���r ����NONE� rdataclass� RdataClassr&����boolr���r'���rX���r���rZ���r]���rf���r���r���ri���r(���r���r���r*���r*���H���s������ ��� �I��!�C�H�H�M�M��!��c�3�h���!�C��!�(2� �&�#�$�(�@�+.�-�-�*<�*<��'����*�*�'��� � �'�'�'��� � �'�'� '� ��'�� ��� � � '�Z�+.�-�-�*<�*<��#����*�*�#��� � �'�'�#��� � �'�'� #� ��#�� �#�,�,�'�'� (� #�R�+.�-�-�*<�*<� '����*�*�'��� � �'�'�'��� � �'�'� '� � �'�,+�C�L�L�,A�,A��+�d��+�4 �(�� �*�d��r���r*���c���������������������������e�Zd�Z��fd�Zej ������������������j������������������dfdej������������������j������������������dej ������������������j������������������dej ������������������j������������������de dej������������������j������������������f ��fd� Z ej ������������������j������������������dfdej������������������j������������������dej ������������������j������������������dej ������������������j������������������de deej������������������j���������������������f ��fd � Zej ������������������j������������������fdej������������������j������������������dej ������������������j������������������dej ������������������j������������������dd fd�Zdej������������������j������������������dd fd �Zde fd�Z��xZS�)� ImmutableNodec������������������������t����������|�������������t��������|j������������������D��cg�c]!��}t��������j ������������������j ������������������|���������#�c}�������|�_��������y�c�c}w�r���)�superr0����tupler+���r���r����ImmutableRdataset)r/����noder=���� __class__s��� �r���r0���zImmutableNode.__init__?��sB������� �����<@�N�N�K�N�S�S�\�\� +� +�C� 0�N�K� ����Ks����&AFrR���r���r ���rS���r���c������������������B������|rt��������d��������t���������|�� ��|||d�������S��N� immutableF)� TypeErrorrs���rX����r/���rR���r���r ���rS���rw���s��� �r���rX���zImmutableNode.find_rdatasetE��s)����������K�(�(��w�$�W�f�f�e�D�Dr���c������������������B������|rt��������d��������t���������|�� ��|||d�������S�ry���)r{���rs���rZ���r|���s��� �r���rZ���zImmutableNode.get_rdatasetP��s)����������K�(�(��w�#�G�V�V�U�C�Cr���Nc�����������������������t��������d���������Nrz����r{���)r/���rR���r���r ���s��� r���r]���zImmutableNode.delete_rdataset[��s���������$�$r���r^���c�����������������������t��������d��������r���r����re���s��� r���rf���zImmutableNode.replace_rdatasetc��s ��������$�$r���c������������������������y)NTr(���r.���s��� r���ri���zImmutableNode.is_immutablef��s������r���)r!���r"���r#���r0���r���r ���rl���rm���rn���r&���ro���r���r'���rX���r���rZ���r]���rf���ri���� __classcell__)rw���s���@r���rq���rq���=��sx������ ��+.�-�-�*<�*<�� E����*�*� E��� � �'�'� E��� � �'�'� E� �� E�� ��� � � E��+.�-�-�*<�*<�� D����*�*� D��� � �'�'� D��� � �'�'� D� �� D�� �#�,�,�'�'� (� D��+.�-�-�*<�*<� %����*�*�%��� � �'�'�%��� � �'�'� %� � �%�%�C�L�L�,A�,A��%�d��%��d��r���rq���)r$����enumr6����typingr���r���r���� dns.immutabler����dns.name�dns.rdataclass�dns.rdataset� dns.rdatatype�dns.renderer� dns.rrsetr ���r���r����NSEC�NSEC3�KEYr���r����unique�Enumr���r*���rz���rq���r(���r���r����<module>r�������s������$�0���� ��&��&�����������������M�M�������M�M����M�M����M�M�����V�����>�t�y�y��>�� �>�.r��r�j������)�D��)���)r���