PyFunceble.query.dns package
Submodules
PyFunceble.query.dns.nameserver module
The tool to check the availability or syntax of domain, IP or URL.
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ ██████╔╝██║ █████╗
██╔═══╝ ╚██╔╝ ██╔══╝ ██║ ██║██║╚██╗██║██║ ██╔══╝ ██╔══██╗██║ ██╔══╝
██║ ██║ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝
Provides a way to get or guess the nameserver to use.
- Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
- Special thanks:
- Contributors:
- Project link:
- Project documentation:
- Project homepage:
License:
Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- class PyFunceble.query.dns.nameserver.Nameservers(nameserver: List[str] | None = None, protocol: str = 'TCP')[source]
Bases:
object
Provides an interface to get the right nameserver to communicate with.
- domain_syntax_checker: DomainSyntaxChecker = <PyFunceble.checker.syntax.domain.DomainSyntaxChecker object>
- classmethod get_ip_from_nameserver(nameserver: str) List[str] [source]
Given a nameserver, this method resolve it in order to get the IP to contact.
- Parameters:
nameserver – The name to resolve.
- guess_all_settings() Nameservers [source]
Try to guess all settings.
- guess_and_set_nameservers() Nameservers [source]
Try to guess and set the nameserver to use.
- set_nameservers(value: List[str]) Nameservers [source]
Sets the nameserver to use.
- Side Effect:
Also updates the
nameserver_ports
variable.
- Raises:
ValueError – When the given
value
is emtpy.
- static split_nameserver_from_port(nameserver: str, *, default_port: int = 53) Tuple[str, int] [source]
Splits the nameserver from its port.re
- Parameters:
nameserver – The nameserver to work with.
default_port – The default port to apply, if none is found.
- url2netloc: Url2Netloc = <PyFunceble.converter.url2netloc.Url2Netloc object>
- url_syntax_checker: URLSyntaxChecker = <PyFunceble.checker.syntax.url.URLSyntaxChecker object>
PyFunceble.query.dns.query_tool module
The tool to check the availability or syntax of domain, IP or URL.
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ ██████╔╝██║ █████╗
██╔═══╝ ╚██╔╝ ██╔══╝ ██║ ██║██║╚██╗██║██║ ██╔══╝ ██╔══██╗██║ ██╔══╝
██║ ██║ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝
Provides an interface for the query.
- Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
- Special thanks:
- Contributors:
- Project link:
- Project documentation:
- Project homepage:
License:
Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- class PyFunceble.query.dns.query_tool.DNSQueryTool(*, nameservers: List[str] | None = None, follow_nameserver_order: bool | None = None, preferred_protocol: str | None = None, trust_server: bool | None = None, delay: bool | None = None)[source]
Bases:
object
Provides our query tool.
- ensure_subject_is_given()[source]
Ensures that the subject to work with is given before running the decorated method.
- property follow_nameserver_order: bool
Provides the current state of the
_follow_nameserver_order
attribute.
- get_dns_name_from_subject_and_query_type()[source]
Provides the dns name based on the current subject and query type.
- get_lookup_record() DNSQueryToolRecord | None [source]
Provides the current query record.
- guess_all_settings() DNSQueryTool [source]
Try to guess all settings.
- guess_and_set_delay() DNSQueryTool [source]
Try to guess and set the delay to apply.
- guess_and_set_follow_nameserver_order() DNSQueryTool [source]
Try to guess and authorize the mix of the nameserver before each query.
- guess_and_set_preferred_protocol() DNSQueryTool [source]
Try to guess and set the preferred procol.
- guess_and_set_timeout() DNSQueryTool [source]
Try to guess and set the timeout.
- guess_and_set_trust_server() DNSQueryTool [source]
Try to guess and set the trust flag.
- ignore_if_query_message_is_missing()[source]
Ignores the call to the decorated method if the query message is missing. Otherwise, return an empty list.
- lookup_record: DNSQueryToolRecord | None = None
- nameservers: Nameservers = <PyFunceble.query.dns.nameserver.Nameservers object>
- property preferred_protocol: str | None
Provides the current state of the
_preferred_protocol
attribute.
- rdata_type2value: Dict[str, int] = {'A': 1, 'A6': 38, 'AAAA': 28, 'AFSDB': 18, 'AMTRELAY': 260, 'ANY': 255, 'APL': 42, 'AVC': 258, 'AXFR': 252, 'CAA': 257, 'CDNSKEY': 60, 'CDS': 59, 'CERT': 37, 'CNAME': 5, 'CSYNC': 62, 'DHCID': 49, 'DLV': 32769, 'DNAME': 39, 'DNSKEY': 48, 'DS': 43, 'EUI48': 108, 'EUI64': 109, 'GPOS': 27, 'HINFO': 13, 'HIP': 55, 'HTTPS': 65, 'IPSECKEY': 45, 'ISDN': 20, 'IXFR': 251, 'KEY': 25, 'KX': 36, 'L32': 105, 'L64': 106, 'LOC': 29, 'LP': 107, 'MAILA': 254, 'MAILB': 253, 'MB': 7, 'MD': 3, 'MF': 4, 'MG': 8, 'MINFO': 14, 'MR': 9, 'MX': 15, 'NAPTR': 35, 'NID': 104, 'NINFO': 56, 'NS': 2, 'NSAP': 22, 'NSAP_PTR': 23, 'NSEC': 47, 'NSEC3': 50, 'NSEC3PARAM': 51, 'NULL': 10, 'NXT': 30, 'OPENPGPKEY': 61, 'OPT': 41, 'PTR': 12, 'PX': 26, 'RP': 17, 'RRSIG': 46, 'RT': 21, 'SIG': 24, 'SMIMEA': 53, 'SOA': 6, 'SPF': 99, 'SRV': 33, 'SSHFP': 44, 'SVCB': 64, 'TA': 32768, 'TKEY': 249, 'TLSA': 52, 'TSIG': 250, 'TXT': 16, 'TYPE0': 0, 'UNSPEC': 103, 'URI': 256, 'WKS': 11, 'X25': 19, 'ZONEMD': 63}
- set_delay(value: int | float) DNSQueryTool [source]
Sets the delay to apply.
- Parameters:
value – The delay to apply.
- set_follow_nameserver_order(value: bool) DNSQueryTool [source]
Updates the
follow_nameserver_order
variable.- Parameters:
value – The value to set.
- set_nameservers(value: List[str]) DNSQueryTool [source]
Sets the nameservers to work with.
- Raises:
ValueError – When the given
value
is empty.
- set_preferred_protocol(value: str) DNSQueryTool [source]
Sets the preferred protocol.
- Parameters:
value – The protocol to use.
- set_query_record_type(value: str | int) DNSQueryTool [source]
Sets the DNS record type to query.
- Parameters:
value – The value to set. It can be the human version (e.g AAAA) or an integer as registered in the
value2rdata_type
attribute.
- set_subject(value: str) DNSQueryTool [source]
Sets the subject to work with.
- Parameters:
value – The subject to set.
- set_timeout(value: int | float) DNSQueryTool [source]
Sets the timeout to apply.
- Parameters:
value – The timeout to apply.
- set_trust_server(value: bool) DNSQueryTool [source]
Sets the value to apply.
- Parameters:
value – The value to apply.
- update_lookup_record()[source]
Ensures that a clean record is generated after the execution of the decorated method.
- update_lookup_record_response()[source]
Ensures that the response of the decorated method is set as response in our record.
- value2rdata_type: Dict[int, str] = {0: 'TYPE0', 1: 'A', 2: 'NS', 3: 'MD', 4: 'MF', 5: 'CNAME', 6: 'SOA', 7: 'MB', 8: 'MG', 9: 'MR', 10: 'NULL', 11: 'WKS', 12: 'PTR', 13: 'HINFO', 14: 'MINFO', 15: 'MX', 16: 'TXT', 17: 'RP', 18: 'AFSDB', 19: 'X25', 20: 'ISDN', 21: 'RT', 22: 'NSAP', 23: 'NSAP_PTR', 24: 'SIG', 25: 'KEY', 26: 'PX', 27: 'GPOS', 28: 'AAAA', 29: 'LOC', 30: 'NXT', 33: 'SRV', 35: 'NAPTR', 36: 'KX', 37: 'CERT', 38: 'A6', 39: 'DNAME', 41: 'OPT', 42: 'APL', 43: 'DS', 44: 'SSHFP', 45: 'IPSECKEY', 46: 'RRSIG', 47: 'NSEC', 48: 'DNSKEY', 49: 'DHCID', 50: 'NSEC3', 51: 'NSEC3PARAM', 52: 'TLSA', 53: 'SMIMEA', 55: 'HIP', 56: 'NINFO', 59: 'CDS', 60: 'CDNSKEY', 61: 'OPENPGPKEY', 62: 'CSYNC', 63: 'ZONEMD', 64: 'SVCB', 65: 'HTTPS', 99: 'SPF', 103: 'UNSPEC', 104: 'NID', 105: 'L32', 106: 'L64', 107: 'LP', 108: 'EUI48', 109: 'EUI64', 249: 'TKEY', 250: 'TSIG', 251: 'IXFR', 252: 'AXFR', 253: 'MAILB', 254: 'MAILA', 255: 'ANY', 256: 'URI', 257: 'CAA', 258: 'AVC', 260: 'AMTRELAY', 32768: 'TA', 32769: 'DLV'}
PyFunceble.query.dns.resolver module
Module contents
The tool to check the availability or syntax of domain, IP or URL.
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ ██████╔╝██║ █████╗
██╔═══╝ ╚██╔╝ ██╔══╝ ██║ ██║██║╚██╗██║██║ ██╔══╝ ██╔══██╗██║ ██╔══╝
██║ ██║ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝
Provides everything related to our very own dns resolver.
- Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
- Special thanks:
- Contributors:
- Project link:
- Project documentation:
- Project homepage:
License:
Copyright 2017, 2018, 2019, 2020, 2022, 2023, 2024 Nissar Chababy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.