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:
- https://pyfunceble.github.io/#/special-thanks
- Contributors:
- https://pyfunceble.github.io/#/contributors
- Project link:
- https://github.com/funilrys/PyFunceble
- Project documentation:
- https://pyfunceble.readthedocs.io/en/latest/
- Project homepage:
- https://pyfunceble.github.io/
License:
Copyright 2017, 2018, 2019, 2020, 2022, 2023 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
http://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: Optional[List[str]] = None, protocol: str = 'TCP')[source]¶ Bases:
object
Provides an interface to get the right nameserver to communicate with.
-
DEFAULT_NAMESERVERS
= ['9.9.9.10', '149.112.112.10', '2620:fe::10', '2620:fe::fe:10']¶
-
domain_syntax_checker
= <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
() → PyFunceble.query.dns.nameserver.Nameservers[source]¶ Try to guess all settings.
-
guess_and_set_nameservers
() → PyFunceble.query.dns.nameserver.Nameservers[source]¶ Try to guess and set the nameserver to use.
-
nameserver_ports
= None¶
-
nameservers
= None¶
-
protocol
= None¶
-
set_nameservers
(value: List[str]) → PyFunceble.query.dns.nameserver.Nameservers[source]¶ Sets the nameserver to use.
- Side Effect:
- Also updates the
nameserver_ports
variable.
Raises: - TypeError – When the given
value
is not alist
. - 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
= <PyFunceble.converter.url2netloc.Url2Netloc object>¶
-
url_syntax_checker
= <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:
- https://pyfunceble.github.io/#/special-thanks
- Contributors:
- https://pyfunceble.github.io/#/contributors
- Project link:
- https://github.com/funilrys/PyFunceble
- Project documentation:
- https://pyfunceble.readthedocs.io/en/latest/
- Project homepage:
- https://pyfunceble.github.io/
License:
Copyright 2017, 2018, 2019, 2020, 2022, 2023 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
http://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: Optional[List[str]] = None, follow_nameserver_order: Optional[bool] = None, preferred_protocol: Optional[str] = None, trust_server: Optional[bool] = None, delay: Optional[bool] = None)[source]¶ Bases:
object
Provides our query tool.
-
STD_DELAY
= 0.0¶
-
STD_FOLLOW_NAMESERVER_ORDER
= True¶
-
STD_PROTOCOL
= 'UDP'¶
-
STD_TIMEOUT
= 5.0¶
-
STD_TRUST_SERVER
= False¶
-
SUPPORTED_PROTOCOL
= ['TCP', 'UDP', 'HTTPS', 'TLS']¶
-
delay
¶ Provides the current state of the
_delay
attribute.
-
dns_name
= None¶
-
ensure_subject_is_given
()[source]¶ Ensures that the subject to work with is given before running the decorated method.
Raises: TypeError – If self.subject
is not astr
.
-
follow_nameserver_order
¶ 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
() → Optional[PyFunceble.query.record.dns.DNSQueryToolRecord][source]¶ Provides the current query record.
-
guess_all_settings
() → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Try to guess all settings.
-
guess_and_set_delay
() → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Try to guess and set the delay to apply.
-
guess_and_set_follow_nameserver_order
() → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Try to guess and authorize the mix of the nameserver before each query.
-
guess_and_set_preferred_protocol
() → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Try to guess and set the preferred procol.
-
guess_and_set_timeout
() → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Try to guess and set the timeout.
-
guess_and_set_trust_server
() → PyFunceble.query.dns.query_tool.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
= None¶
-
nameservers
= <PyFunceble.query.dns.nameserver.Nameservers object>¶
-
preferred_protocol
¶ Provides the current state of the
_preferred_protocol
attribute.
-
query_message
= None¶
-
query_record_type
¶ Provides the current state of the
_query_record_type
attribute.
-
query_timeout
¶ Provides the current state of the
_query_timeout
attribute.
-
rdata_type2value
= {'A': 1, 'A6': 38, 'AAAA': 28, 'AFSDB': 18, 'AMTRELAY': 259, '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, 'IPSECKEY': 45, 'ISDN': 20, 'IXFR': 251, 'KEY': 25, 'KX': 36, 'LOC': 29, 'MAILA': 254, 'MAILB': 253, 'MB': 7, 'MD': 3, 'MF': 4, 'MG': 8, 'MINFO': 14, 'MR': 9, 'MX': 15, 'NAPTR': 35, '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, 'SOA': 6, 'SPF': 99, 'SRV': 33, 'SSHFP': 44, 'TA': 32768, 'TKEY': 249, 'TLSA': 52, 'TSIG': 250, 'TXT': 16, 'TYPE0': 0, 'UNSPEC': 103, 'URI': 256, 'WKS': 11, 'X25': 19}¶
-
set_delay
(value: Union[int, float]) → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Sets the delay to apply.
Parameters: value – The delay to apply.
-
set_follow_nameserver_order
(value: bool) → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Updates the
follow_nameserver_order
variable.Parameters: value – The value to set.
-
set_nameservers
(value: List[str]) → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Sets the nameservers to work with.
Raises: - TypeError – When the given
value
is not a list ofstr
. - ValueError – When the given
value
is empty.
- TypeError – When the given
-
set_preferred_protocol
(value: str) → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Sets the preferred protocol.
Parameters: value – The protocol to use.
-
set_query_record_type
(value: Union[str, int]) → PyFunceble.query.dns.query_tool.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) → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Sets the subject to work with.
Parameters: value – The subject to set.
-
set_timeout
(value: Union[int, float]) → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Sets the timeout to apply.
Parameters: value – The timeout to apply.
-
set_trust_server
(value: bool) → PyFunceble.query.dns.query_tool.DNSQueryTool[source]¶ Sets the value to apply.
Parameters: value – The value to apply.
-
subject
¶ Provides the current state of the
_subject
attribute.
-
trust_server
¶ Provides the current state of the
trust_server
attribute.
-
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
= {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', 55: 'HIP', 56: 'NINFO', 59: 'CDS', 60: 'CDNSKEY', 61: 'OPENPGPKEY', 62: 'CSYNC', 99: 'SPF', 103: 'UNSPEC', 108: 'EUI48', 109: 'EUI64', 249: 'TKEY', 250: 'TSIG', 251: 'IXFR', 252: 'AXFR', 253: 'MAILB', 254: 'MAILA', 255: 'ANY', 256: 'URI', 257: 'CAA', 258: 'AVC', 259: 'AMTRELAY', 32768: 'TA', 32769: 'DLV'}¶
-
PyFunceble.query.dns.resolver module¶
The tool to check the availability or syntax of domain, IP or URL.
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ ██████╔╝██║ █████╗
██╔═══╝ ╚██╔╝ ██╔══╝ ██║ ██║██║╚██╗██║██║ ██╔══╝ ██╔══██╗██║ ██╔══╝
██║ ██║ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝
Provides a way to provides the nameserver to use.
- Author:
- Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
- Special thanks:
- https://pyfunceble.github.io/#/special-thanks
- Contributors:
- https://pyfunceble.github.io/#/contributors
- Project link:
- https://github.com/funilrys/PyFunceble
- Project documentation:
- https://pyfunceble.readthedocs.io/en/latest/
- Project homepage:
- https://pyfunceble.github.io/
License:
Copyright 2017, 2018, 2019, 2020, 2022, 2023 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
http://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.resolver.
Resolver
(nameservers: Optional[List[str]] = None, timeout: Optional[float] = None)[source]¶ Bases:
object
Provides the right resolver.
Parameters: nameservers – The list of nameservers to communicate with. -
STD_TIMEOUT
= 5.0¶
-
get_nameserver_ports
() → Optional[dict][source]¶ Provides the currently set list of nameserver ports.
-
guess_and_set_timeout
() → PyFunceble.query.dns.resolver.Resolver[source]¶ Tries to guess the the timeout from the configuration.
-
internal_resolver
= None¶
-
nameservers
= <PyFunceble.query.dns.nameserver.Nameservers object>¶
-
set_nameservers
(value: List[str]) → PyFunceble.query.dns.resolver.Resolver[source]¶ Sets the given nameserver.
-
set_timeout
(value: Union[float, int]) → PyFunceble.query.dns.resolver.Resolver[source]¶ Sets the timeout of a query.
-
timeout
= 3.0¶
-
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:
- https://pyfunceble.github.io/#/special-thanks
- Contributors:
- https://pyfunceble.github.io/#/contributors
- Project link:
- https://github.com/funilrys/PyFunceble
- Project documentation:
- https://pyfunceble.readthedocs.io/en/latest/
- Project homepage:
- https://pyfunceble.github.io/
License:
Copyright 2017, 2018, 2019, 2020, 2022, 2023 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
http://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.