internetnl_scan package

Submodules

internetnl_scan.internetnl_classes module

class internetnl_scan.internetnl_classes.InternetNlScanner(urls_to_scan: list, tracking_information: str | None = None, scan_id: str | None = None, n_id_chars: int | None = None, scan_name: str | None = None, scan_type: str = 'web', api_url: str = 'https://batch.internet.nl/api/batch/v2/', interval: int = 30, cache_directory: str = 'cache', ignore_cache: bool = True, output_filename: str | None = None, wait_until_done: bool = False, get_results: bool = False, cancel_scan: bool = False, list_all_scans: bool = False, clear_all_scans: bool = False, export_results: bool = False, force_cancel: bool = False, force_overwrite: bool = False, dry_run: bool = False)[source]

Bases: object

Python interfaces for Internet.nl API

cancel_all_scans()[source]

Cancel all available scans

cancel_scan(scan_id=None)[source]

Cancel the scan with the id ‘scan_id’

check_status()[source]

Check the status of the connection

export_results()[source]

Export the scanned result to a sqlite database

get_all_scans()[source]

Get a list of all scans

get_results()[source]

Download the results of the scan

list_all_scans()[source]

Give a list of all scans

read_from_cache()[source]
start_url_scan()[source]

post a request to internet.nl to scan a list of urls

wait_until_done()[source]

Keep contacting internet NL until scan is done

internetnl_scan.main module

internetnl_scan.main.main(argv)[source]
internetnl_scan.main.parse_args(args)[source]

Parse command line parameters

Parameters:

args ([str]) – command line parameters as a list of strings

Returns:

argparse.Namespace: command line parameters namespace

Return type:

obj

internetnl_scan.main.run()[source]

internetnl_scan.utils module

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.convert_url_list(urls_to_scan: list, scan_type='web')[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, 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