Core

Problematic

How can we get started?

Documentation

The tool to check the availability or syntax of domains, IPv4, IPv6 or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the core interfaces.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/special-thanks.html
Contributors:
https://pyfunceble.github.io/contributors.html
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/master/
Project homepage:
https://pyfunceble.github.io/

License:

MIT License

Copyright (c) 2017, 2018, 2019, 2020 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

APICore()

class PyFunceble.core.api.APICore(subject, complete=False, configuration=None, db_file_name='api_call', is_parent=True)[source]

Provides the logic and interface for the tests from the API.

Parameters:
  • subject (str) – The element we are testing.
  • complete (bool) – Activate the return of a dictionnary with significant - if not all - data about the test.
  • configuration (dict) –

    The custom configuration to load.

    Note

    This will let you overwrite any of the previously given configuration index.

_APICore__inactive_database_management(subject, status)

Given the subject and status, we add or remove the subject from the inactive database.

availability(subject_type)[source]

Make an availability check.

Parameters:subject_type (str) –

Should be one of the following.

  • domain
  • url
domain_and_ip()[source]

Run a domain/IP availability check over the given subject.

domain_syntax()[source]

Run a domain syntax check over the given subject.

ip_range_syntax()[source]

Run an IP range syntax check over the given subject.

ip_syntax()[source]

Run an IP syntax check over the given subject.

ipv4_range_syntax()[source]

Run an IPv4 range syntax check over the given subject.

ipv4_syntax()[source]

Run an IPv4 syntax check over the given subject.

ipv6_range_syntax()[source]

Run an IPv6 range syntax check over the given subject.

ipv6_syntax()[source]

Run an IPv6 syntax check over the given subject.

reputation(subject_type)[source]

Make a reputation check.

Parameters:subject_type (str) –

Should be one of the following.

  • domain
  • url
subdomain_syntax()[source]

Run a subdomain syntax check over the given subject.

syntax(subject_type)[source]

Make a syntax check.

Parameters:subject_type (str) –

Should be one of the following.

  • domain
  • url
url()[source]

Run an URL availability check over the given subject.

url_syntax()[source]

Run an IPv4 syntax check over the given subject.

CLICore()

class PyFunceble.core.cli.CLICore[source]

Provides some methods which are dedicated for the CLI.

classmethod _CLICore__check_deprecated(upstream_version)

Checks if the local version is deprecated.

classmethod _CLICore__check_force_update(upstream_version)

Checks if we need to force the update.

If it’s the case, we will stop the tool.

classmethod _CLICore__print_messages(upstream_version)

Looks at the messages and prints the one that needs to be printed.

Print the colored logo based on global results.

Parameters:home (bool) – Tell us if we have to print the initial coloration.
classmethod compare_version_and_print_messages()[source]

Compares the local with the upstream version.

classmethod get_simple_coloration(status)[source]

Given a status we give the coloration for the simple mode.

Parameters:status (str) – An official status output.
classmethod get_upstream_version_file()[source]

Provides the upstream version file.

classmethod logs_sharing()[source]

Prints an information message when the logs sharing is activated.

classmethod print_header()[source]

Prints the header if needed.

classmethod print_nothing_to_test()[source]

Prints the nothing to test message.

classmethod save_into_database(output, filename, mysql_db)[source]

Saves the current status inside the database.

classmethod sort_generated_files()[source]

Sort the content of all files we generated.

classmethod stay_safe()[source]

Prints a friendly message.

FileCore()

class PyFunceble.core.file.FileCore(file, file_content_type='domain')[source]

Brain of PyFunceble for file testing.

Parameters:
  • file (str) – The file we are testing.
  • file_type (str) –

    The file type. Should be one of the following.

    • domain
    • url
_FileCore__run_single_test(subject, ignore_inactive_db_check=False)

Run a test for a single subject.

_FileCore__test_line(line, ignore_inactive_db_check=False)

Tests a given line.

cleanup(auto_continue_db, auto_save, test_completed=False)[source]

Runs the logic to run at the end of all test.

Downloads the file if it is an URL and return the name of the new file to test.

generate_complement_status_file(subject, status)[source]

Generate the complements status files.

generate_files(include_entries_without_changes=False)[source]

Generates all needed files.

generate_files_of_status(status, include_entries_without_changes=False)[source]

Generates the status file of all subjects of the given status.

Parameters:
  • status (str) – A status to filter.
  • include_entries_without_changes (bool) – Descriptive enough.
classmethod get_complements(auto_continue_db)[source]

Generate a list of complements to test.

post_test_treatment(test_output, file_content_type, complements_test_started=False, auto_continue_db=None, inactive_db=None, mining=None, whois_db=None)[source]

Do the post test treatment.

run_test()[source]

Run the test of the content of the given file.

classmethod should_be_ignored(subject, auto_continue_db, inactive_db, ignore_inactive_db_check=False)[source]

Given a subject which is supposed to be tested, we check if we should ignore it.

test(subject)[source]

Tests the given subject and return it’s results.

OurProcessWrapper()

class PyFunceble.core.multiprocess.OurProcessWrapper(*args, **kwargs)[source]

Wrapper of Process. The object of this class is just to overwrite Process.run() in order to catch exceptions.

Note

This class takes the same arguments as Process.

exception

Provides a way to check if an exception was send.

run()[source]

Overwrites Process.run().

MultiprocessCore()

class PyFunceble.core.multiprocess.MultiprocessCore(file, file_content_type='domain')[source]

Brain of PyFunceble for file testing with multiple processes.s.

Parameters:
  • file (str) – The file we are testing.
  • file_type (str) –

    The file type. Should be one of the following.

    • domain
    • url
_MultiprocessCore__check_exception(processes, manager_data)

Checks if an exception is present into the given pool of processes.

:param list processes. A list of running processes.

_MultiprocessCore__merge_processes_data(manager_data)

Reads all results and put them at the right location.

_MultiprocessCore__run_multiprocess_test(stream, manager, ignore_inactive_db_check=False)

Tests the content of the given file.

_MultiprocessCore__start_process(subject, manager_data, ignore_inactive_db_check=False)

Starts a new process.

run_test()[source]

Runs the test of the content of the given file.

test(subject, file_content_type, configuration, manager_data, intern)[source]

Tests the given subject and return the result.

SimpleCore()

class PyFunceble.core.simple.SimpleCore(subject)[source]

Brain of PyFunceble for simple test.

Parameters:subject (str) – The subject we are testing.
_SimpleCore__save_in_database(dataset)

Saves the given dataset (result) into the database.

Parameters:dataset (dict, list) – The dataset to save.
domain()[source]

Handles the simple domain testing.

test(subject, subject_type)[source]

Processes a test of the given subject and return the result.

url()[source]

Handles the simple URL testing.