internetnl_scan package

Submodules

internetnl_scan.internetnl_classes module

internetnl_scan.main module

internetnl_scan.utils module

Utilities for the internetnl tool

class internetnl_scan.utils.Credentials(service_name='Internet.nl')[source]

Bases: object

stores the user credentials in a key ring

get_credentials()[source]

Get the user credentials, either via cli, or via keyring

reset_credentials()[source]

in case of login failure: reset the stored credentials

internetnl_scan.utils.clean_list_of_urls(urls_to_scan: list)[source]

cleans up the urls in a list

internetnl_scan.utils.get_clean_url(url, cache_dir=None)[source]

Turns an url into a clean url and adds it

Parameters:
  • url (str) – url to clean

  • cache_dir (str) – directory name in case the tld cached data needs to be read

Returns:

cleaned url, the suffix

Return type:

str, str

internetnl_scan.utils.get_urls_from_domain_file(domain_file: str | Path, url_column_key: str | None = None, sep: str = ',', column_number: int = 0) list[source]

Get urls from a file name

Parameters:
  • domain_file (str) – the file name to be read

  • url_column_key (str, optional) – The name of the column containing the url values. Defaults to None, meaning

  • header (that the file does not have a)

  • sep (str, optional) – The separator of the file

  • column_number (int, optional) – The column number to read in case no header is given

Returns:

list of cleaned url’s

Return type:

list

internetnl_scan.utils.make_cache_file_name(directory, scan_id, scan_type)[source]

build the cache file name

internetnl_scan.utils.query_yes_no(question, default_answer='no')[source]

Ask a yes/no question via raw_input() and return their answer.

Parameters:
  • question (str) – A question to ask the user

  • default_answer (str, optional) – A default answer that is given when only return is hit. Default to ‘no’

Returns:

“yes” or “no”, depending on the input of the user

Return type:

str

internetnl_scan.utils.remove_sub_domain(url: str) str[source]

remove www or any other subdomain from the url

internetnl_scan.utils.remove_sub_domains(urls_to_scan: list) list[source]

remove www or any other subdomain from the url

internetnl_scan.utils.response_to_dataframe(response)[source]

Convert the Internet.nl response to pandas dataframe

Parameters:

response – the returned response ot the Internet.nl API

Returns:

Pandas dataframe

internetnl_scan.utils.scan_result_to_dataframes(domains)[source]

Convert a dict internet.nl scans to a flat dictionary with on entry per result type

Parameters:

domains – dict keys are the urls, values are the nested json results

Returns:

dict with four tables

internetnl_scan.utils.validate_url(url_to_check: str) bool[source]

Test if a string is a valid url :param url_to_check: Url to check if it is a valid url :type url_to_check: str

Returns:

True if url is valid

Return type:

bool

Module contents