Generate

Problematic

How can we generate the files which reflects our results?

Documentation

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

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

This submodule will create the generation interface/logic.

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 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.
class PyFunceble.generate.Generate(subject, subject_type, status, source=None, expiration_date=None, http_status_code='***', whois_server='Unknown', filename=None, ip_validation=False)[source]

Generate different sort of files.

Parameters:
  • subject (str) – The subject we are working with.
  • subject_type (str) – The type of the subject.
  • status (str) – The catched status.
  • source (str) – The source of the given status.
  • expiration_date (str) – The expiration date of the domain (if catched).
  • http_status_code (str|int) – The HTTP status code.
  • whois_server (str) – The whois server.
  • filename (str) – The name of the file we are testing.
  • ip_validation (bool) – The IP validation check of the currently written subject.
_Generate___get_info_files_destinations(output_hosts, output_domains, output_json)

Given the output directory, this method return several paths.

Note

The given output directories have to be partially completed.

Indeed, we only do output % final_location.

Returns:The following paths:
(
    hosts_destination,
    plain_destination,
    json_destination,
    splited_destination
)
Return type:tuple
_Generate___info_files_authorization()

Provide the authorization for the generation of info files.

Basicaly here is what we check:

  • We are not testing as an imported module.

and

  • The hosts file generation is activated.

or

  • The plain list generation is activated.

or

  • The “api_file_generation” was set into the CONFIGURATION.
_analytic_host_file_directory()[source]

Return the analytic directory to write depending of the matched status.

classmethod _do_not_produce_file()[source]

Check if we are allowed to produce a file based from the given information.

Returns:The state of the production. True: We do not produce file. False: We do produce file.
Return type:bool
_prints_status_file()[source]

Logic behind the printing (in file) when generating status file.

_prints_status_screen()[source]

Logic behind the printing (on screen) when generating status file.

analytic_file(new_status, old_status=None)[source]

Generate Analytic/* files based on the given old and new statuses.

Parameters:
  • new_status (str) – The new status of the domain.
  • old_status (str) – The old status of the domain.
complements_file()[source]

Generate complements files base on the current status.

info_files()[source]

Generate the hosts file, the plain list, the JSON file and the splitted files.

status_file()[source]

Generate a file according to the domain status.

unified_file()[source]

Generate unified file. Understand by that that we use an unified table instead of a separate table for each status which could result into a misunderstanding.