├── .coveragerc ├── .github └── workflows │ └── jira-description-action.yml ├── .gitignore ├── .pydocstyle ├── .python-version ├── .readthedocs.yml ├── LICENSE ├── MANIFEST.in ├── Makefile ├── Makefile.help ├── Pipfile ├── README.md ├── axonius_api_client ├── __init__.py ├── api │ ├── __init__.py │ ├── adapters │ │ ├── __init__.py │ │ ├── adapters.py │ │ └── cnx.py │ ├── api_endpoint.py │ ├── api_endpoints.py │ ├── asset_callbacks │ │ ├── __init__.py │ │ ├── base.py │ │ ├── base_csv.py │ │ ├── base_json.py │ │ ├── base_json_to_csv.py │ │ ├── base_table.py │ │ ├── base_xlsx.py │ │ ├── base_xml.py │ │ └── tools.py │ ├── assets │ │ ├── __init__.py │ │ ├── asset_mixin.py │ │ ├── devices.py │ │ ├── fields.py │ │ ├── labels.py │ │ ├── runner.py │ │ ├── saved_query.py │ │ ├── users.py │ │ └── vulnerabilities.py │ ├── enforcements │ │ ├── __init__.py │ │ ├── enforcements.py │ │ └── tasks.py │ ├── folders │ │ ├── __init__.py │ │ └── folders.py │ ├── json_api │ │ ├── __init__.py │ │ ├── account │ │ │ ├── __init__.py │ │ │ ├── current_user.py │ │ │ ├── login_request.py │ │ │ └── login_response.py │ │ ├── adapters │ │ │ ├── __init__.py │ │ │ ├── adapter_node.py │ │ │ ├── adapter_settings_response.py │ │ │ ├── adapter_settings_update_request.py │ │ │ ├── adapters_list_response.py │ │ │ ├── adapters_request.py │ │ │ ├── adapters_response.py │ │ │ ├── clients_count.py │ │ │ ├── cnx_create_request.py │ │ │ ├── cnx_create_response.py │ │ │ ├── cnx_delete_request.py │ │ │ ├── cnx_delete_response.py │ │ │ ├── cnx_labels_response.py │ │ │ ├── cnx_test_request.py │ │ │ ├── cnx_update_request.py │ │ │ ├── cnx_update_response.py │ │ │ ├── cnxs_response.py │ │ │ ├── fetch_history_filters_response.py │ │ │ ├── fetch_history_request.py │ │ │ └── fetch_history_response.py │ │ ├── assets │ │ │ ├── __init__.py │ │ │ ├── asset_id_request.py │ │ │ ├── asset_id_response.py │ │ │ ├── asset_request.py │ │ │ ├── asset_response.py │ │ │ ├── count_request.py │ │ │ ├── count_response.py │ │ │ ├── destroy_request.py │ │ │ ├── destroy_response.py │ │ │ ├── fields_response.py │ │ │ ├── history_dates_human.py │ │ │ ├── history_dates_response.py │ │ │ ├── modify_tags_request.py │ │ │ ├── modify_tags_response.py │ │ │ └── run_enforcement_request.py │ │ ├── audit_logs │ │ │ ├── __init__.py │ │ │ ├── audit_log_request.py │ │ │ └── audit_log_response.py │ │ ├── base.py │ │ ├── base2.py │ │ ├── central_core.py │ │ ├── count_operator.py │ │ ├── custom_fields.py │ │ ├── dashboard_spaces.py │ │ ├── data_scopes.py │ │ ├── duration_operator.py │ │ ├── enforcements.py │ │ ├── folders │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── enforcements.py │ │ │ └── queries.py │ │ ├── generic.py │ │ ├── instances.py │ │ ├── lifecycle.py │ │ ├── nested_access.py │ │ ├── paging_state.py │ │ ├── password_reset.py │ │ ├── remote_support.py │ │ ├── resources.py │ │ ├── saved_queries.py │ │ ├── selection.py │ │ ├── signup │ │ │ ├── __init__.py │ │ │ ├── signup_request.py │ │ │ ├── signup_response.py │ │ │ └── system_status.py │ │ ├── spaces_export.py │ │ ├── system_meta.py │ │ ├── system_roles.py │ │ ├── system_settings.py │ │ ├── system_users.py │ │ ├── tasks │ │ │ ├── __init__.py │ │ │ ├── get_tasks.py │ │ │ ├── result.py │ │ │ ├── task.py │ │ │ ├── task_basic.py │ │ │ ├── task_filters.py │ │ │ └── task_full.py │ │ └── time_range.py │ ├── mixins.py │ ├── openapi │ │ ├── __init__.py │ │ └── openapi_spec.py │ ├── system │ │ ├── __init__.py │ │ ├── activity_logs.py │ │ ├── dashboard.py │ │ ├── dashboard_spaces.py │ │ ├── data_scopes.py │ │ ├── instances.py │ │ ├── meta.py │ │ ├── remote_support.py │ │ ├── settings.py │ │ ├── signup.py │ │ ├── system_roles.py │ │ └── system_users.py │ └── wizards │ │ ├── __init__.py │ │ ├── wizard.py │ │ ├── wizard_csv.py │ │ └── wizard_text.py ├── auth │ ├── __init__.py │ ├── api_key.py │ ├── credentials.py │ ├── model.py │ └── null.py ├── cli │ ├── __init__.py │ ├── context.py │ ├── grp_account │ │ ├── __init__.py │ │ └── cmd_get_api_keys.py │ ├── grp_adapters │ │ ├── __init__.py │ │ ├── cmd_config_get.py │ │ ├── cmd_config_update.py │ │ ├── cmd_config_update_from_json.py │ │ ├── cmd_file_upload.py │ │ ├── cmd_get.py │ │ ├── cmd_get_fetch_history.py │ │ ├── cmd_get_fetch_history_filters.py │ │ ├── grp_cnx │ │ │ ├── __init__.py │ │ │ ├── cmd_add.py │ │ │ ├── cmd_add_from_json.py │ │ │ ├── cmd_add_multiple_from_json.py │ │ │ ├── cmd_delete_by_id.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_get_by_id.py │ │ │ ├── cmd_set_active.py │ │ │ ├── cmd_set_label.py │ │ │ ├── cmd_test.py │ │ │ ├── cmd_test_by_id.py │ │ │ ├── cmd_update_by_id.py │ │ │ ├── cmd_update_by_id_from_json.py │ │ │ ├── grp_common.py │ │ │ └── parsing.py │ │ └── grp_common.py │ ├── grp_assets │ │ ├── __init__.py │ │ ├── cmd_count.py │ │ ├── cmd_count_by_saved_query.py │ │ ├── cmd_destroy.py │ │ ├── cmd_get.py │ │ ├── cmd_get_by_id.py │ │ ├── cmd_get_by_saved_query.py │ │ ├── cmd_get_fields.py │ │ ├── cmd_get_fields_default.py │ │ ├── cmd_get_tags.py │ │ ├── cmds_run_enforcement.py │ │ ├── grp_common.py │ │ └── grp_saved_query │ │ │ ├── __init__.py │ │ │ ├── cmd_add.py │ │ │ ├── cmd_add_from_json.py │ │ │ ├── cmd_add_from_wiz_csv.py │ │ │ ├── cmd_copy.py │ │ │ ├── cmd_delete_by_name.py │ │ │ ├── cmd_delete_by_tags.py │ │ │ ├── cmd_export.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_get_by_name.py │ │ │ ├── cmd_get_by_tags.py │ │ │ ├── cmd_get_query_history.py │ │ │ ├── cmd_get_tags.py │ │ │ ├── cmd_import.py │ │ │ ├── cmd_update_always_cached.py │ │ │ ├── cmd_update_description.py │ │ │ ├── cmd_update_fields.py │ │ │ ├── cmd_update_folder.py │ │ │ ├── cmd_update_name.py │ │ │ ├── cmd_update_page_size.py │ │ │ ├── cmd_update_private.py │ │ │ ├── cmd_update_query.py │ │ │ ├── cmd_update_tags.py │ │ │ └── grp_common.py │ ├── grp_certs │ │ ├── __init__.py │ │ ├── cmd_ca_add.py │ │ ├── cmd_ca_enable.py │ │ ├── cmd_ca_remove.py │ │ ├── cmd_ca_show.py │ │ ├── cmd_csr_cancel.py │ │ ├── cmd_csr_create.py │ │ ├── cmd_csr_get.py │ │ ├── cmd_from_path.py │ │ ├── cmd_from_url.py │ │ ├── cmd_gui_get.py │ │ ├── cmd_gui_info.py │ │ ├── cmd_gui_reset.py │ │ ├── cmd_gui_update.py │ │ └── grp_common.py │ ├── grp_enforcements │ │ ├── __init__.py │ │ ├── cmd_copy.py │ │ ├── cmd_create.py │ │ ├── cmd_delete.py │ │ ├── cmd_get.py │ │ ├── cmd_get_action_types.py │ │ ├── cmd_run.py │ │ ├── cmd_update_action_add.py │ │ ├── cmd_update_action_main.py │ │ ├── cmd_update_action_remove.py │ │ ├── cmd_update_description.py │ │ ├── cmd_update_folder.py │ │ ├── cmd_update_name.py │ │ ├── cmd_update_on_count_above.py │ │ ├── cmd_update_on_count_below.py │ │ ├── cmd_update_on_count_decreased.py │ │ ├── cmd_update_on_count_increased.py │ │ ├── cmd_update_only_new_assets.py │ │ ├── cmd_update_query.py │ │ ├── cmd_update_query_remove.py │ │ ├── cmd_update_schedule_daily.py │ │ ├── cmd_update_schedule_discovery.py │ │ ├── cmd_update_schedule_hourly.py │ │ ├── cmd_update_schedule_monthly.py │ │ ├── cmd_update_schedule_never.py │ │ ├── cmd_update_schedule_weekly.py │ │ ├── grp_common.py │ │ └── grp_tasks │ │ │ ├── __init__.py │ │ │ ├── cmd_count.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_get_filters.py │ │ │ ├── export_get.py │ │ │ ├── export_get_filters.py │ │ │ ├── options_get.py │ │ │ └── options_get_filters.py │ ├── grp_folders │ │ ├── __init__.py │ │ ├── cmd_create.py │ │ ├── cmd_delete.py │ │ ├── cmd_find.py │ │ ├── cmd_get_tree.py │ │ ├── cmd_move.py │ │ ├── cmd_rename.py │ │ ├── cmd_search_objects.py │ │ ├── cmd_search_objects_copy.py │ │ ├── cmd_search_objects_delete.py │ │ ├── cmd_search_objects_move.py │ │ ├── grp_common.py │ │ └── grp_options.py │ ├── grp_openapi │ │ ├── __init__.py │ │ └── cmd_get_spec.py │ ├── grp_spaces │ │ ├── __init__.py │ │ ├── cmd_export.py │ │ ├── cmd_export_charts_to_csv.py │ │ ├── cmd_import.py │ │ └── grp_common.py │ ├── grp_system │ │ ├── __init__.py │ │ ├── grp_activity_logs │ │ │ ├── __init__.py │ │ │ └── cmd_get.py │ │ ├── grp_central_core │ │ │ ├── __init__.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_restore_from_aws_s3.py │ │ │ └── cmd_update.py │ │ ├── grp_data_scopes │ │ │ ├── __init__.py │ │ │ ├── cmd_create.py │ │ │ ├── cmd_delete.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_update_description.py │ │ │ ├── cmd_update_device_scopes.py │ │ │ ├── cmd_update_name.py │ │ │ ├── cmd_update_user_scopes.py │ │ │ └── grp_common.py │ │ ├── grp_discover │ │ │ ├── __init__.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_is_data_stable.py │ │ │ ├── cmd_is_running.py │ │ │ ├── cmd_start.py │ │ │ ├── cmd_stop.py │ │ │ ├── cmd_wait_data_stable.py │ │ │ └── grp_common.py │ │ ├── grp_meta │ │ │ ├── __init__.py │ │ │ ├── cmd_about.py │ │ │ └── cmd_sizes.py │ │ ├── grp_nodes │ │ │ ├── __init__.py │ │ │ ├── cmd_admin_script_upload.py │ │ │ ├── cmd_factory_reset.py │ │ │ └── cmd_get.py │ │ ├── grp_remote_support │ │ │ ├── __init__.py │ │ │ ├── cmd_configure.py │ │ │ ├── cmd_configure_analytics.py │ │ │ ├── cmd_configure_remote_access.py │ │ │ ├── cmd_get.py │ │ │ └── grp_common.py │ │ ├── grp_roles │ │ │ ├── __init__.py │ │ │ ├── cmd_add.py │ │ │ ├── cmd_delete.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_get_by_name.py │ │ │ ├── cmd_get_perms.py │ │ │ ├── cmd_update_data_scope.py │ │ │ ├── cmd_update_name.py │ │ │ ├── cmd_update_perms.py │ │ │ └── grp_common.py │ │ ├── grp_settings │ │ │ ├── __init__.py │ │ │ ├── cmd_configure_destroy.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_get_section.py │ │ │ ├── cmd_get_subsection.py │ │ │ ├── cmd_update_section.py │ │ │ ├── cmd_update_section_from_json.py │ │ │ ├── cmd_update_subsection.py │ │ │ ├── cmd_update_subsection_from_json.py │ │ │ └── grp_common.py │ │ └── grp_users │ │ │ ├── __init__.py │ │ │ ├── cmd_add.py │ │ │ ├── cmd_add_from_csv.py │ │ │ ├── cmd_delete.py │ │ │ ├── cmd_email_password_reset_link.py │ │ │ ├── cmd_get.py │ │ │ ├── cmd_get_by_name.py │ │ │ ├── cmd_get_password_reset_link.py │ │ │ ├── cmd_update.py │ │ │ └── grp_common.py │ ├── grp_tools │ │ ├── __init__.py │ │ ├── cmd_help_features.py │ │ ├── cmd_shell.py │ │ ├── cmd_signup.py │ │ ├── cmd_sysinfo.py │ │ ├── cmd_system_status.py │ │ ├── cmd_use_token_reset_token.py │ │ ├── cmd_write_config.py │ │ ├── grp_common.py │ │ └── grp_options.py │ ├── helps.py │ └── options.py ├── connect.py ├── constants │ ├── __init__.py │ ├── adapters.py │ ├── api.py │ ├── asset_helpers.py │ ├── ctypes.py │ ├── enforcements.py │ ├── fields.py │ ├── general.py │ ├── logs.py │ ├── tables.py │ └── wizards.py ├── data.py ├── examples │ ├── __init__.py │ ├── adapter_fetch_history_addin.py │ ├── add_adapter_cnxs_from_csv.py │ ├── example_api_query_wizard.py │ ├── example_cvss_filtering.py │ ├── example_details.py │ ├── example_get_by_sq.py │ ├── example_os_count_magic.py │ ├── example_sw_missing.py │ ├── example_user_device_associated_agent_versions.py │ ├── example_wmi_last_used_users.py │ ├── sa_user_pairing.py │ ├── script_base.py │ ├── update_action_config.py │ ├── user_to_device_correlation_example.py │ └── wip_roles.py ├── exceptions.py ├── features.py ├── http.py ├── logs.py ├── parsers │ ├── __init__.py │ ├── config.py │ ├── fields.py │ ├── grabber.py │ ├── matcher.py │ ├── searchers.py │ ├── tables.py │ └── wizards.py ├── projects │ ├── __init__.py │ ├── cert_human │ │ ├── __init__.py │ │ ├── all_logs_list.json │ │ ├── all_logs_list.py │ │ ├── constants.py │ │ ├── convert.py │ │ ├── ct_logs.py │ │ ├── enums.py │ │ ├── exceptions.py │ │ ├── paths.py │ │ ├── ssl_capture.py │ │ ├── ssl_context.py │ │ ├── ssl_extensions.py │ │ ├── stores │ │ │ ├── __init__.py │ │ │ ├── cert.py │ │ │ ├── cert_request.py │ │ │ └── store.py │ │ └── utils.py │ ├── cf_token │ │ ├── __init__.py │ │ ├── cli.py │ │ ├── constants.py │ │ ├── flows.py │ │ └── tools.py │ ├── cli_cf_token.py │ └── url_parser.py ├── setup_env.py ├── tests │ ├── __init__.py │ ├── conftest.py │ ├── datafiles │ │ ├── certs │ │ │ ├── ca_ec.crt.pem │ │ │ ├── ca_ec.key │ │ │ ├── ca_rsa.crt.pem │ │ │ ├── ca_rsa.key │ │ │ ├── server_ec.crt.p7b │ │ │ ├── server_ec.crt.pem │ │ │ ├── server_ec.csr.pem │ │ │ ├── server_ec.key │ │ │ ├── server_rsa.crt.p7b │ │ │ ├── server_rsa.crt.pem │ │ │ ├── server_rsa.csr.pem │ │ │ └── server_rsa.key │ │ ├── common.sh │ │ └── create_certs.sh │ ├── meta.py │ ├── tests_api │ │ ├── __init__.py │ │ ├── test_api_endpoints.py │ │ ├── test_signup.py │ │ ├── tests_adapters │ │ │ ├── __init__.py │ │ │ ├── test_adapters.py │ │ │ └── test_cnx.py │ │ ├── tests_asset_callbacks │ │ │ ├── __init__.py │ │ │ ├── test_callbacks.py │ │ │ ├── test_callbacks_base.py │ │ │ ├── test_callbacks_csv.py │ │ │ ├── test_callbacks_json.py │ │ │ ├── test_callbacks_json_to_csv.py │ │ │ ├── test_callbacks_table.py │ │ │ ├── test_callbacks_xlsx.py │ │ │ └── test_callbacks_xml.py │ │ ├── tests_assets │ │ │ ├── __init__.py │ │ │ ├── test_assets.py │ │ │ ├── test_fields.py │ │ │ ├── test_labels.py │ │ │ ├── test_runner.py │ │ │ └── test_saved_query.py │ │ ├── tests_enforcements │ │ │ ├── __init__.py │ │ │ ├── test_enforcements.py │ │ │ └── test_tasks.py │ │ ├── tests_folders │ │ │ ├── __init__.py │ │ │ └── test_folders.py │ │ ├── tests_json_api │ │ │ ├── __init__.py │ │ │ ├── test_custom_fields.py │ │ │ └── test_json_api.py │ │ ├── tests_openapi │ │ │ ├── __init__.py │ │ │ └── test_openapi.py │ │ ├── tests_parsers │ │ │ ├── __init__.py │ │ │ ├── test_config.py │ │ │ ├── test_constants.py │ │ │ ├── test_fields.py │ │ │ ├── test_grabber.py │ │ │ └── test_tables.py │ │ ├── tests_system │ │ │ ├── __init__.py │ │ │ ├── test_activity_logs.py │ │ │ ├── test_dashboard.py │ │ │ ├── test_data_scopes.py │ │ │ ├── test_instances.py │ │ │ ├── test_meta.py │ │ │ ├── test_remote_support.py │ │ │ ├── test_settings.py │ │ │ ├── test_system_roles.py │ │ │ └── test_system_users.py │ │ └── tests_wizard │ │ │ ├── __init__.py │ │ │ ├── test_constants.py │ │ │ ├── test_wizard.py │ │ │ ├── test_wizard_csv.py │ │ │ ├── test_wizard_parser.py │ │ │ └── test_wizard_text.py │ ├── tests_auth │ │ ├── __init__.py │ │ └── test_auth.py │ ├── tests_cert_human │ │ ├── test_cert_store.py │ │ ├── test_convert.py │ │ ├── test_ct_logs.py │ │ ├── test_enums.py │ │ ├── test_paths.py │ │ ├── test_ssl_context.py │ │ └── test_utils.py │ ├── tests_cf_token │ │ ├── __init__.py │ │ ├── meta.py │ │ ├── test_flows.py │ │ └── test_tools.py │ ├── tests_cli │ │ ├── __init__.py │ │ ├── tests_folders_grp │ │ │ ├── __init__.py │ │ │ └── test_folders_grp.py │ │ ├── tests_grp_activity_logs │ │ │ ├── __init__.py │ │ │ └── test_cmd_get.py │ │ ├── tests_grp_adapters │ │ │ ├── __init__.py │ │ │ ├── test_cmd_config_get.py │ │ │ ├── test_cmd_config_update.py │ │ │ ├── test_cmd_file_upload.py │ │ │ ├── test_cmd_get.py │ │ │ ├── test_cmd_get_fetch_history.py │ │ │ └── test_cmd_get_fetch_history_filters.py │ │ ├── tests_grp_assets │ │ │ ├── __init__.py │ │ │ └── test_assets.py │ │ ├── tests_grp_central_core │ │ │ ├── __init__.py │ │ │ ├── test_cmd_get.py │ │ │ ├── test_cmd_restore_from_aws_s3.py │ │ │ └── test_cmd_update.py │ │ ├── tests_grp_cnx │ │ │ ├── __init__.py │ │ │ ├── test_cmd_add.py │ │ │ ├── test_cmd_add_from_json.py │ │ │ ├── test_cmd_add_multiple_from_json.py │ │ │ ├── test_cmd_get.py │ │ │ ├── test_cmd_get_by_id.py │ │ │ ├── test_cmd_set_active.py │ │ │ ├── test_cmd_set_label.py │ │ │ ├── test_cmd_test.py │ │ │ ├── test_cmd_test_by_id.py │ │ │ ├── test_cmd_update_by_id.py │ │ │ ├── test_cmd_update_by_id_from_json.py │ │ │ ├── test_cnx_base.py │ │ │ └── test_cnx_parsing.py │ │ ├── tests_grp_data_scopes │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── test_cmd_create.py │ │ │ └── test_cmd_get.py │ │ ├── tests_grp_discover │ │ │ ├── __init__.py │ │ │ ├── test_cmd_get.py │ │ │ ├── test_cmd_multi.py │ │ │ └── test_cmd_wait_data_stable.py │ │ ├── tests_grp_enforcements │ │ │ ├── __init__.py │ │ │ ├── test_cmd_copy.py │ │ │ ├── test_cmd_create.py │ │ │ ├── test_cmd_get.py │ │ │ ├── test_cmd_get_action_types.py │ │ │ ├── test_cmd_run.py │ │ │ ├── test_cmd_update_description.py │ │ │ ├── test_cmd_update_on_count_above.py │ │ │ ├── test_cmd_update_on_count_below.py │ │ │ ├── test_cmd_update_on_count_decreased.py │ │ │ ├── test_cmd_update_on_count_increased.py │ │ │ ├── test_cmd_update_only_new_assets.py │ │ │ ├── test_cmd_update_query.py │ │ │ ├── test_cmd_update_query_remove.py │ │ │ ├── test_cmd_update_schedule_daily.py │ │ │ ├── test_cmd_update_schedule_discovery.py │ │ │ ├── test_cmd_update_schedule_hourly.py │ │ │ ├── test_cmd_update_schedule_monthly.py │ │ │ ├── test_cmd_update_schedule_never.py │ │ │ └── test_cmd_update_schedule_weekly.py │ │ ├── tests_grp_meta │ │ │ ├── __init__.py │ │ │ ├── test_cmd_about.py │ │ │ └── test_cmd_history_sizes.py │ │ ├── tests_grp_openapi │ │ │ ├── __init__.py │ │ │ └── test_cmd_get-spec.py │ │ ├── tests_grp_saved_query │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── test_cmd_add.py │ │ │ ├── test_cmd_add_from_json.py │ │ │ ├── test_cmd_add_from_wiz_csv.py │ │ │ ├── test_cmd_copy.py │ │ │ ├── test_cmd_delete_by_name.py │ │ │ ├── test_cmd_delete_by_tags.py │ │ │ ├── test_cmd_get.py │ │ │ ├── test_cmd_get_by_name.py │ │ │ ├── test_cmd_get_by_tags.py │ │ │ ├── test_cmd_get_query_history.py │ │ │ ├── test_cmd_get_tags.py │ │ │ └── test_cmd_updates.py │ │ ├── tests_grp_system_roles │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── test_cmd_add.py │ │ │ ├── test_cmd_delete.py │ │ │ ├── test_cmd_get.py │ │ │ ├── test_cmd_get_by_name.py │ │ │ ├── test_cmd_get_perms.py │ │ │ ├── test_cmd_update_data_scope.py │ │ │ ├── test_cmd_update_name.py │ │ │ └── test_cmd_update_perms.py │ │ ├── tests_grp_tasks │ │ │ ├── __init__.py │ │ │ ├── test_cmd_count.py │ │ │ ├── test_cmd_get.py │ │ │ └── test_cmd_get_filters.py │ │ └── tests_grp_tools │ │ │ ├── __init__.py │ │ │ ├── test_cmd_shell.py │ │ │ ├── test_cmd_sysinfo.py │ │ │ └── test_cmd_write_config.py │ ├── tests_pkg │ │ ├── __init__.py │ │ ├── test_connect.py │ │ ├── test_data.py │ │ ├── test_http.py │ │ ├── test_logs.py │ │ ├── test_setup_env.py │ │ ├── test_tools.py │ │ └── test_url_parser.py │ └── utils.py ├── tools.py └── version.py ├── docs ├── Makefile ├── _static │ ├── apikeysecret.png │ ├── axlogo512.png │ ├── axlogofull.png │ └── custom.css ├── _templates │ ├── module.rst_t │ ├── package.rst_t │ └── toc.rst_t ├── _themes │ └── .gitignore ├── conf.py ├── index.rst ├── main │ ├── .special.rst │ ├── axtokens.rst │ ├── contributing.rst │ ├── deprecation_banner.rst │ ├── install.rst │ ├── usage_api │ │ ├── api │ │ │ ├── adapters │ │ │ │ ├── adapters.rst │ │ │ │ ├── cnx.rst │ │ │ │ └── index.rst │ │ │ ├── assets │ │ │ │ ├── callbacks │ │ │ │ │ ├── base.rst │ │ │ │ │ ├── csv.rst │ │ │ │ │ ├── index.rst │ │ │ │ │ ├── json.rst │ │ │ │ │ ├── json_to_csv.rst │ │ │ │ │ ├── table.rst │ │ │ │ │ └── xlsx.rst │ │ │ │ ├── devices.rst │ │ │ │ ├── fields.rst │ │ │ │ ├── index.rst │ │ │ │ ├── labels.rst │ │ │ │ ├── saved_query.rst │ │ │ │ ├── users.rst │ │ │ │ └── wizards │ │ │ │ │ ├── index.rst │ │ │ │ │ ├── wizard.rst │ │ │ │ │ ├── wizard_csv.rst │ │ │ │ │ └── wizard_text.rst │ │ │ ├── enforcements │ │ │ │ ├── actions.rst │ │ │ │ ├── enforcements.rst │ │ │ │ └── index.rst │ │ │ └── system │ │ │ │ ├── dashboard.rst │ │ │ │ ├── index.rst │ │ │ │ ├── instances.rst │ │ │ │ ├── meta.rst │ │ │ │ ├── settings_global.rst │ │ │ │ ├── settings_gui.rst │ │ │ │ ├── settings_lifecycle.rst │ │ │ │ ├── signup.rst │ │ │ │ ├── system_roles.rst │ │ │ │ └── system_users.rst │ │ ├── connect.rst │ │ ├── library │ │ │ ├── api │ │ │ │ ├── api_mixins.rst │ │ │ │ ├── asset_mixins.rst │ │ │ │ ├── index.rst │ │ │ │ ├── routers.rst │ │ │ │ └── settings_mixins.rst │ │ │ ├── auth │ │ │ │ ├── api_key.rst │ │ │ │ ├── index.rst │ │ │ │ └── models.rst │ │ │ ├── constants │ │ │ │ ├── adapters.rst │ │ │ │ ├── api.rst │ │ │ │ ├── fields.rst │ │ │ │ ├── general.rst │ │ │ │ ├── index.rst │ │ │ │ ├── logs.rst │ │ │ │ ├── system.rst │ │ │ │ └── wizards.rst │ │ │ ├── index.rst │ │ │ ├── parsers │ │ │ │ ├── adapters.rst │ │ │ │ ├── config.rst │ │ │ │ ├── fields.rst │ │ │ │ ├── index.rst │ │ │ │ ├── system.rst │ │ │ │ ├── tables.rst │ │ │ │ ├── url_parser.rst │ │ │ │ └── wizards.rst │ │ │ ├── tools │ │ │ │ ├── data.rst │ │ │ │ ├── exceptions.rst │ │ │ │ ├── http.rst │ │ │ │ ├── index.rst │ │ │ │ ├── logs.rst │ │ │ │ ├── setup_env.rst │ │ │ │ └── tools.rst │ │ │ └── version.rst │ │ ├── quickstart.rst │ │ └── usage_api.rst │ └── usage_cli │ │ ├── common_examples │ │ ├── get_by.rst │ │ ├── get_by_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ ├── ex4.rst │ │ │ ├── ex5.rst │ │ │ ├── ex7.rst │ │ │ ├── ex8.rst │ │ │ ├── ex9.rst │ │ │ └── notes.rst │ │ ├── select_field_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ ├── ex4.rst │ │ │ ├── ex5.rst │ │ │ ├── ex6.rst │ │ │ ├── ex7.rst │ │ │ ├── ex8.rst │ │ │ └── notes.rst │ │ ├── select_fields.rst │ │ ├── settings.rst │ │ └── settings_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ └── notes.rst │ │ ├── common_options │ │ ├── connection.rst │ │ ├── export.rst │ │ └── rows.rst │ │ ├── features │ │ ├── aliases.rst │ │ ├── autocomplete.rst │ │ └── quoting.rst │ │ ├── grp_adapters.rst │ │ ├── grp_adapters_cmds │ │ ├── cmd_get.rst │ │ └── cmd_get_examples │ │ │ ├── ex1.rst │ │ │ └── ex_structure.rst │ │ ├── grp_assets_cmds │ │ ├── cmd_count.rst │ │ ├── cmd_count_by_saved_query.rst │ │ ├── cmd_count_by_saved_query_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ └── notes.rst │ │ ├── cmd_count_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ └── notes.rst │ │ ├── cmd_get.rst │ │ ├── cmd_get_by_id.rst │ │ ├── cmd_get_by_id_examples │ │ │ ├── ex1.rst │ │ │ └── notes.rst │ │ ├── cmd_get_by_saved_query.rst │ │ ├── cmd_get_by_saved_query_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ └── notes.rst │ │ ├── cmd_get_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ ├── ex4.rst │ │ │ └── notes.rst │ │ ├── cmd_get_fields.rst │ │ ├── cmd_get_fields_default.rst │ │ ├── cmd_get_fields_default_examples │ │ │ ├── ex1.rst │ │ │ └── notes.rst │ │ ├── cmd_get_fields_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ ├── ex4.rst │ │ │ └── notes.rst │ │ ├── cmd_get_tags.rst │ │ └── cmd_get_tags_examples │ │ │ ├── ex1.rst │ │ │ └── notes.rst │ │ ├── grp_assets_saved_query_cmds │ │ ├── cmd_add.rst │ │ ├── cmd_add_examples │ │ │ ├── ex1.rst │ │ │ └── notes.rst │ │ ├── cmd_delete_by_name.rst │ │ ├── cmd_delete_by_tags.rst │ │ ├── cmd_delete_by_tags_examples │ │ │ └── ex1.rst │ │ ├── cmd_delete_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ └── notes.rst │ │ ├── cmd_get.rst │ │ ├── cmd_get_by_name.rst │ │ ├── cmd_get_by_name_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ ├── ex4.rst │ │ │ └── notes.rst │ │ ├── cmd_get_examples │ │ │ ├── ex1.rst │ │ │ └── notes.rst │ │ └── cmd_remove_examples │ │ ├── grp_cnx.rst │ │ ├── grp_cnx_cmds │ │ ├── cmd_add.rst │ │ ├── cmd_add_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ └── ex4.rst │ │ ├── cmd_add_from_json.rst │ │ ├── cmd_add_from_json_examples │ │ │ ├── ex1.rst │ │ │ └── ex2.rst │ │ ├── cmd_delete_by_id.rst │ │ ├── cmd_delete_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ └── ex3.rst │ │ ├── cmd_get.rst │ │ ├── cmd_get_by_id.rst │ │ ├── cmd_get_by_id_examples │ │ │ └── ex1.rst │ │ ├── cmd_get_examples │ │ │ ├── ex1.rst │ │ │ ├── ex2.rst │ │ │ ├── ex3.rst │ │ │ ├── ex4.rst │ │ │ ├── ex5.rst │ │ │ └── ex_structure.rst │ │ ├── cmd_test.rst │ │ ├── cmd_test_by_id.rst │ │ ├── cmd_test_by_id_examples │ │ │ └── ex1.rst │ │ └── cmd_test_examples │ │ │ ├── ex1.rst │ │ │ └── ex3.rst │ │ ├── grp_devices.rst │ │ ├── grp_devices_cmds │ │ ├── cmd_get_by_hostname.rst │ │ ├── cmd_get_by_ip.rst │ │ ├── cmd_get_by_mac.rst │ │ └── cmd_get_by_subnet.rst │ │ ├── grp_devices_saved_query.rst │ │ ├── grp_tools.rst │ │ ├── grp_tools_cmds │ │ ├── cmd_shell.rst │ │ ├── cmd_shell_examples │ │ │ └── ex1.rst │ │ ├── cmd_write_config.rst │ │ └── cmd_write_config_examples │ │ │ └── ex1.rst │ │ ├── grp_users.rst │ │ ├── grp_users_cmds │ │ ├── cmd_get_by_mail.rst │ │ └── cmd_get_by_username.rst │ │ ├── grp_users_saved_query.rst │ │ ├── quickstart.rst │ │ ├── root.rst │ │ └── usage_cli.rst ├── make.bat └── requirements.txt ├── get_version.py ├── make.bat ├── offline_axonius_api_client_creator.sh ├── pyproject.toml ├── requirements-build.txt ├── requirements-dev.txt ├── requirements-lint.txt ├── requirements-pkg.txt ├── requirements.txt ├── setup.cfg ├── setup.py └── shell.py /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | # TBD: later branch True 3 | data_file = artifacts/.coverage 4 | omit = 5 | axonius_api_client/tests/* 6 | axonius_api_client/examples/* 7 | 8 | [report] 9 | skip_covered = True 10 | skip_empty = True 11 | sort = -miss 12 | exclude_lines = 13 | pragma: no cover 14 | def __repr__ 15 | raise AssertionError 16 | raise NotImplementedError 17 | if __name__ == .__main__.: 18 | @(abc\.)?abstractmethod 19 | def get_schema_cls 20 | def get_model_cls 21 | def _str_properties 22 | 23 | [html] 24 | directory = artifacts/cov_html 25 | skip_covered = False 26 | 27 | [xml] 28 | output = artifacts/cov.xml 29 | 30 | [json] 31 | output = artifacts/cov.json 32 | pretty_print = True 33 | -------------------------------------------------------------------------------- /.github/workflows/jira-description-action.yml: -------------------------------------------------------------------------------- 1 | name: jira-description-action 2 | on: 3 | pull_request: 4 | types: [opened, reopened, edited, synchronize] 5 | # Set the minimum required permissions for the GITHUB_TOKEN 6 | # This action only needs read access to pull requests for 7 | # reading PR titles and checking PR context. These permissions 8 | # are set to adhere to the principle of least privilege, ensuring 9 | # the token cannot perform unintended actions. 10 | permissions: 11 | pull-requests: read 12 | jobs: 13 | add-jira-description: 14 | runs-on: ubuntu-latest 15 | environment: 16 | name: jira-description-action 17 | steps: 18 | - uses: Axonius/jira-description-action@v0.4.0 19 | name: jira-description-action 20 | with: 21 | github-token: ${{ secrets.GITHUB_TOKEN }} 22 | jira-token: ${{ secrets.JIRA_TOKEN }} 23 | jira-base-url: https://axonius.atlassian.net 24 | fail-when-jira-issue-not-found: true 25 | -------------------------------------------------------------------------------- /.pydocstyle: -------------------------------------------------------------------------------- 1 | [pydocstyle] 2 | # D100: Missing docstring in public module 3 | # D104: Missing docstring in public package 4 | # D105: Missing docstring in magic method 5 | # D203: 1 blank line required before class docstring 6 | # D212: Multi-line docstring summary should start at the first line 7 | # D401: First line should be in imperative mood 8 | # WIP FOR CONFIG, unsure how to exclude examples/tests 9 | ignore = D203,D401 10 | 11 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.11.1 2 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: ubuntu-22.04 5 | tools: 6 | python: "3.7" 7 | 8 | sphinx: 9 | builder: html 10 | configuration: docs/conf.py 11 | fail_on_warning: false 12 | 13 | python: 14 | install: 15 | - requirements: docs/requirements.txt 16 | - requirements: requirements.txt 17 | - method: pip 18 | path: . 19 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include MANIFEST.in 2 | include requirements*.txt 3 | include axonius_api_client/projects/cert_human/all_logs_list.json 4 | graft axonius_api_client/tests/datafiles/ 5 | global-exclude __pycache__ 6 | global-exclude *.py[co] 7 | global-exclude .DS_Store 8 | -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple/" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | e1839a8 = {path = ".",editable = true} 8 | 9 | [dev-packages] 10 | ipython = "*" 11 | pytest = "*" 12 | flaky = "*" 13 | coverage = "*" 14 | pytest-cov = "*" 15 | -------------------------------------------------------------------------------- /axonius_api_client/api/adapters/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """APIs for working with adapters and connections.""" 3 | from .adapters import Adapters 4 | from .cnx import Cnx 5 | 6 | __all__ = ("Adapters", "Cnx") 7 | -------------------------------------------------------------------------------- /axonius_api_client/api/asset_callbacks/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Callbacks for formatting asset data and exporting to various formats.""" 3 | from .base import Base, ExportMixins 4 | from .base_csv import Csv 5 | from .base_json import Json 6 | from .base_json_to_csv import JsonToCsv 7 | from .base_table import Table 8 | from .base_xlsx import Xlsx 9 | from .base_xml import Xml 10 | from .tools import CB_MAP, get_callbacks_cls 11 | 12 | __all__ = ( 13 | "Base", 14 | "ExportMixins", 15 | "Csv", 16 | "Json", 17 | "Table", 18 | "Xlsx", 19 | "Xml", 20 | "JsonToCsv", 21 | "get_callbacks_cls", 22 | "CB_MAP", 23 | ) 24 | -------------------------------------------------------------------------------- /axonius_api_client/api/asset_callbacks/tools.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Tools for loading callbacks.""" 3 | import typing as t 4 | 5 | from ...exceptions import ApiError 6 | from ...tools import get_subcls 7 | from .base import Base 8 | 9 | CB_MAP: t.Dict[str, t.Type[Base]] = { 10 | Base.CB_NAME: Base, 11 | **{x.CB_NAME: x for x in get_subcls(cls=Base)}, 12 | } 13 | """Map of export name to callbacks class.""" 14 | 15 | CB_DEF: str = Base.CB_NAME 16 | 17 | 18 | def get_callbacks_cls(export: str = CB_DEF) -> t.Type[Base]: 19 | """Get a callback class. 20 | 21 | Args: 22 | export: export format from asset object get method to map to a callback object 23 | must be one of :data:`CB_MAP` 24 | """ 25 | export = export or CB_DEF 26 | if export in CB_MAP: 27 | return CB_MAP[export] 28 | raise ApiError(f"Invalid export {export!r}, valids: {list(CB_MAP)}") 29 | -------------------------------------------------------------------------------- /axonius_api_client/api/assets/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """APIs for working with assets, saved queries, fields, and tags.""" 3 | from .asset_mixin import AssetMixin 4 | from .devices import Devices 5 | from .fields import Fields 6 | from .labels import Labels 7 | from .runner import Runner 8 | from .saved_query import SavedQuery 9 | from .users import Users 10 | from .vulnerabilities import Vulnerabilities 11 | 12 | __all__ = ( 13 | "Users", 14 | "Devices", 15 | "AssetMixin", 16 | "SavedQuery", 17 | "Fields", 18 | "Labels", 19 | "Vulnerabilities", 20 | "Runner", 21 | ) 22 | -------------------------------------------------------------------------------- /axonius_api_client/api/enforcements/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """APIs for working with enforcements and actions.""" 3 | from .enforcements import Enforcements 4 | from .tasks import Tasks 5 | 6 | __all__ = ("Enforcements", "Tasks") 7 | -------------------------------------------------------------------------------- /axonius_api_client/api/folders/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """APIs for working with enforcements and actions.""" 3 | from .folders import Folders, FoldersEnforcements, FoldersQueries 4 | 5 | __all__ = ("Folders", "FoldersEnforcements", "FoldersQueries") 6 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/account/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | from .current_user import CurrentUser, CurrentUserSchema 4 | from .login_request import LoginRequest, LoginRequestSchema 5 | from .login_response import LoginResponse, LoginResponseSchema 6 | 7 | __all__ = ( 8 | "LoginRequest", 9 | "LoginRequestSchema", 10 | "LoginResponse", 11 | "LoginResponseSchema", 12 | "CurrentUser", 13 | "CurrentUserSchema", 14 | ) 15 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/adapters/cnx_update_response.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | import dataclasses 4 | import typing as t 5 | 6 | from ..base import BaseSchemaJson 7 | from .cnx_create_response import CnxCreate, CnxCreateSchema 8 | 9 | 10 | class CnxUpdateSchema(CnxCreateSchema): 11 | """Schema for response from updating a connection.""" 12 | 13 | @staticmethod 14 | def get_model_cls() -> t.Any: 15 | """Get the model for this schema.""" 16 | return CnxUpdate 17 | 18 | class Meta: 19 | """JSONAPI config.""" 20 | 21 | type_ = "connections_details_schema" 22 | 23 | 24 | SCHEMA = CnxUpdateSchema() 25 | 26 | 27 | @dataclasses.dataclass 28 | class CnxUpdate(CnxCreate): 29 | """Model for response from updating a connection.""" 30 | 31 | SCHEMA: t.ClassVar[BaseSchemaJson] = SCHEMA 32 | 33 | @staticmethod 34 | def get_schema_cls() -> t.Any: 35 | """Get the schema for this model.""" 36 | return CnxUpdateSchema 37 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/assets/destroy_response.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | import dataclasses 4 | import typing as t 5 | 6 | from ..generic import Metadata, MetadataSchema 7 | 8 | 9 | class DestroySchema(MetadataSchema): 10 | """Schema for response from destroying assets.""" 11 | 12 | class Meta: 13 | """JSONAPI type.""" 14 | 15 | type_ = "metadata_schema" 16 | 17 | @staticmethod 18 | def get_model_cls() -> t.Any: 19 | """Get the model for this schema.""" 20 | return Destroy 21 | 22 | 23 | SCHEMA = DestroySchema() 24 | 25 | 26 | @dataclasses.dataclass 27 | class Destroy(Metadata): 28 | """Model for response from destroying assets.""" 29 | 30 | SCHEMA: t.ClassVar[t.Any] = SCHEMA 31 | 32 | @staticmethod 33 | def get_schema_cls() -> t.Any: 34 | """Get the schema for this model.""" 35 | return DestroySchema 36 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/assets/fields_response.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | import dataclasses 4 | import typing as t 5 | 6 | from ..generic import Metadata, MetadataSchema 7 | 8 | 9 | class FieldsSchema(MetadataSchema): 10 | """Schema for response from getting field schemas for an asset type.""" 11 | 12 | class Meta: 13 | """JSONAPI type.""" 14 | 15 | type_ = "metadata_schema" 16 | 17 | @staticmethod 18 | def get_model_cls() -> t.Any: 19 | """Get the model for this schema.""" 20 | return Fields 21 | 22 | 23 | SCHEMA = FieldsSchema() 24 | 25 | 26 | @dataclasses.dataclass 27 | class Fields(Metadata): 28 | """Model for response from getting field schemas for an asset type.""" 29 | 30 | SCHEMA: t.ClassVar[t.Any] = SCHEMA 31 | 32 | @staticmethod 33 | def get_schema_cls() -> t.Any: 34 | """Get the schema for this model.""" 35 | return FieldsSchema 36 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/assets/modify_tags_response.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | import dataclasses 4 | import typing as t 5 | 6 | from ..generic import IntValue, IntValueSchema 7 | 8 | 9 | class ModifyTagsSchema(IntValueSchema): 10 | """Schema for response from modifying tags.""" 11 | 12 | @staticmethod 13 | def get_model_cls() -> t.Any: 14 | """Get the model for this schema.""" 15 | return ModifyTags 16 | 17 | class Meta: 18 | """JSONAPI config.""" 19 | 20 | type_ = "int_value_schema" 21 | 22 | 23 | @dataclasses.dataclass 24 | class ModifyTags(IntValue): 25 | """Model for response from modifying tags.""" 26 | 27 | @staticmethod 28 | def get_schema_cls() -> t.Any: 29 | """Get the schema for this model.""" 30 | return ModifyTagsSchema 31 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/audit_logs/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | from .audit_log_request import AuditLogRequest, AuditLogRequestSchema 4 | from .audit_log_response import AuditLog, AuditLogSchema 5 | 6 | __all__ = [ 7 | "AuditLogRequest", 8 | "AuditLogRequestSchema", 9 | "AuditLog", 10 | "AuditLogSchema", 11 | ] 12 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/folders/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | 4 | from . import base, enforcements, queries 5 | from .base import Folder 6 | 7 | __all__ = ("base", "queries", "enforcements", "Folder") 8 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/signup/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | from .signup_request import SignupRequest, SignupRequestSchema 4 | from .signup_response import SignupResponse, SignupResponseSchema 5 | from .system_status import SystemStatus, SystemStatusSchema 6 | 7 | __all__ = ( 8 | "SignupRequestSchema", 9 | "SignupRequest", 10 | "SignupResponseSchema", 11 | "SignupResponse", 12 | "SystemStatusSchema", 13 | "SystemStatus", 14 | ) 15 | -------------------------------------------------------------------------------- /axonius_api_client/api/json_api/tasks/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Models for API requests & responses.""" 3 | import typing as t 4 | 5 | from .get_tasks import GetTasks, GetTasksSchema 6 | from .result import Result 7 | from .task import Task 8 | from .task_basic import TaskBasic, TaskBasicSchema 9 | from .task_filters import TaskFilters, TaskFiltersSchema 10 | from .task_full import TaskFull, TaskFullSchema 11 | 12 | TASK_TYPES: tuple = (TaskBasic, TaskFull, Task) 13 | # noinspection PyTypeHints 14 | TaskTypes = t.TypeVar("TaskTypes", *TASK_TYPES) 15 | 16 | __all__ = ( 17 | "Result", 18 | "TASK_TYPES", 19 | "TaskTypes", 20 | "Task", 21 | "TaskBasic", 22 | "TaskBasicSchema", 23 | "TaskFull", 24 | "TaskFullSchema", 25 | "GetTasksSchema", 26 | "GetTasks", 27 | "TaskFiltersSchema", 28 | "TaskFilters", 29 | ) 30 | -------------------------------------------------------------------------------- /axonius_api_client/api/openapi/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """APIs for working with Open API endpoints.""" 3 | 4 | from .openapi_spec import OpenAPISpec 5 | 6 | __all__ = [ 7 | "OpenAPISpec", 8 | ] 9 | -------------------------------------------------------------------------------- /axonius_api_client/api/openapi/openapi_spec.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """API for working with the OpenAPI specification file.""" 3 | 4 | from ..api_endpoints import ApiEndpoints 5 | from ..mixins import ModelMixins 6 | 7 | 8 | class OpenAPISpec(ModelMixins): 9 | """API for working with the OpenAPI YAML specification file.""" 10 | 11 | def get_spec(self) -> str: 12 | """Get the OpenAPI specification file.""" 13 | return self._get_spec() 14 | 15 | def _get_spec(self) -> str: 16 | """Direct API method to get the OpenAPI YAML specification file.""" 17 | api_endpoint = ApiEndpoints.openapi.get_spec 18 | return api_endpoint.perform_request(self.auth.http) 19 | -------------------------------------------------------------------------------- /axonius_api_client/api/system/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """APIs for working with system components.""" 3 | from .activity_logs import ActivityLogs 4 | from .dashboard import Dashboard 5 | from .dashboard_spaces import DashboardSpaces 6 | from .data_scopes import DataScopes 7 | from .instances import Instances 8 | from .meta import Meta 9 | from .remote_support import RemoteSupport 10 | from .settings import SettingsGlobal, SettingsGui, SettingsIdentityProviders, SettingsLifecycle 11 | from .signup import Signup 12 | from .system_roles import SystemRoles 13 | from .system_users import SystemUsers 14 | 15 | __all__ = ( 16 | "Dashboard", 17 | "Instances", 18 | "Meta", 19 | "SettingsGlobal", 20 | "SettingsGui", 21 | "SettingsLifecycle", 22 | "Signup", 23 | "SystemRoles", 24 | "SystemUsers", 25 | "RemoteSupport", 26 | "ActivityLogs", 27 | "SettingsIdentityProviders", 28 | "DataScopes", 29 | "DashboardSpaces", 30 | ) 31 | -------------------------------------------------------------------------------- /axonius_api_client/api/wizards/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Parsers for AQL queries and GUI expressions.""" 3 | from .wizard import Wizard 4 | from .wizard_csv import WizardCsv 5 | from .wizard_text import WizardText 6 | 7 | __all__ = ( 8 | "Wizard", 9 | "WizardText", 10 | "WizardCsv", 11 | ) 12 | -------------------------------------------------------------------------------- /axonius_api_client/auth/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Authenticating with Axonius.""" 3 | from .api_key import AuthApiKey 4 | from .credentials import AuthCredentials 5 | from .model import AuthModel 6 | from .null import AuthNull 7 | 8 | # backwards compatibility 9 | ApiKey = AuthApiKey 10 | Credentials = AuthCredentials 11 | 12 | 13 | __all__ = ( 14 | "AuthModel", 15 | "AuthApiKey", 16 | "AuthCredentials", 17 | "AuthNull", 18 | "ApiKey", 19 | "Credentials", 20 | ) 21 | -------------------------------------------------------------------------------- /axonius_api_client/auth/null.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Null authentication method.""" 3 | from ..http import Http 4 | from .model import AuthModel 5 | 6 | 7 | class AuthNull(AuthModel): 8 | """Null authentication method.""" 9 | 10 | def __init__(self, http: Http, **kwargs): 11 | """Authenticate using no credentials. 12 | 13 | Args: 14 | http: HTTP client to use to send requests 15 | """ 16 | kwargs["creds"] = None 17 | super().__init__(http=http, **kwargs) 18 | 19 | def login(self) -> bool: 20 | """Login to API.""" 21 | if not self.is_logged_in: 22 | self.is_logged_in = True 23 | return True 24 | return False 25 | 26 | def logout(self) -> bool: 27 | """Logout from API.""" 28 | if self.is_logged_in: 29 | self.is_logged_in = False 30 | return True 31 | return False 32 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_account/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import typing as t 4 | 5 | import click 6 | 7 | from ..context import AliasedGroup, load_cmds 8 | from ..grp_tools import cmd_signup, cmd_use_token_reset_token, cmd_write_config 9 | 10 | 11 | @click.group(cls=AliasedGroup) 12 | def account(): 13 | """Group: Account commands.""" 14 | 15 | 16 | load_cmds(path=__file__, package=__package__, group=account) 17 | 18 | COMMANDS: t.List[t.Any] = [ 19 | cmd_write_config.cmd, 20 | cmd_signup.cmd, 21 | cmd_use_token_reset_token.cmd, 22 | ] 23 | 24 | for cmd in COMMANDS: 25 | account.add_command(cmd) 26 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_account/cmd_get_api_keys.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..grp_tools.grp_common import EXPORT_FORMATS 6 | from ..grp_tools.grp_options import OPT_ENV, OPT_EXPORT 7 | from ..options import AUTH, add_options 8 | 9 | OPTIONS = [*AUTH, OPT_EXPORT, OPT_ENV] 10 | 11 | 12 | @click.command(name="get-api-keys", context_settings=CONTEXT_SETTINGS) 13 | @add_options(OPTIONS) 14 | @click.pass_context 15 | def cmd(ctx, url, key, secret, export_format, env): 16 | """Get the API keys for the current user.""" 17 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 18 | 19 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 20 | data = client.api_keys 21 | 22 | click.secho(EXPORT_FORMATS[export_format](data=data, env=env, url=client.AUTH.http.url)) 23 | ctx.exit(0) 24 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_adapters/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import typing as t 4 | 5 | import click 6 | 7 | from ..context import AliasedGroup, load_cmds 8 | from . import grp_cnx 9 | 10 | 11 | @click.group(cls=AliasedGroup) 12 | def adapters(): 13 | """Group: Work with adapters and adapter connections.""" 14 | 15 | 16 | load_cmds(path=__file__, package=__package__, group=adapters) 17 | 18 | GROUPS: t.List[t.Any] = [grp_cnx.cnx] 19 | # Type hint doesn't recognize click.Group because of decorator? 20 | 21 | for grp in GROUPS: 22 | adapters.add_command(grp) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_adapters/cmd_config_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, NODE, add_options 5 | from .grp_common import CONFIG_EXPORT, CONFIG_EXPORT_FORMATS, CONFIG_TYPE 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | CONFIG_EXPORT, 10 | CONFIG_TYPE, 11 | *NODE, 12 | ] 13 | 14 | 15 | @click.command(name="config-get", context_settings=CONTEXT_SETTINGS) 16 | @add_options(OPTIONS) 17 | @click.pass_context 18 | def cmd(ctx, url, key, secret, export_format, **kwargs): 19 | """Get adapter advanced settings.""" 20 | """Pass.""" 21 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 22 | 23 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 24 | data = client.adapters.config_get(**kwargs) 25 | 26 | click.secho(CONFIG_EXPORT_FORMATS[export_format](data=data)) 27 | ctx.exit(0) 28 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_adapters/grp_cnx/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def cnx(): 10 | """Group: Work with adapter connections.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=cnx) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_adapters/grp_cnx/cmd_update_by_id_from_json.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import INPUT_FILE, add_options 5 | from .cmd_update_by_id import OPTIONS_SHARED, handle_update 6 | 7 | OPTIONS = [ 8 | *OPTIONS_SHARED, 9 | INPUT_FILE, 10 | ] 11 | 12 | 13 | @click.command(name="update-by-id-from-json", context_settings=CONTEXT_SETTINGS) 14 | @add_options(OPTIONS) 15 | @click.pass_context 16 | def cmd(ctx, url, key, secret, input_file, **kwargs): 17 | """Update a connection from a JSON file.""" 18 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 19 | config = ctx.obj.read_stream_json(stream=input_file, expect=dict) 20 | handle_update(ctx=ctx, client=client, config=config, **kwargs) 21 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_assets/cmd_get_fields_default.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | 6 | OPTIONS = [*AUTH] 7 | 8 | 9 | @click.command(name="get-fields-default", context_settings=CONTEXT_SETTINGS) 10 | @add_options(OPTIONS) 11 | @click.pass_context 12 | def cmd(ctx, url, key, secret, **kwargs): 13 | """Get the default fields (columns) for assets.""" 14 | p_grp = ctx.parent.command.name 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | apiobj = getattr(client, p_grp) 17 | content = "\n".join(apiobj.fields_default) 18 | click.secho(content) 19 | ctx.exit(0) 20 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_assets/cmd_get_tags.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | 6 | OPTIONS = [*AUTH] 7 | 8 | 9 | @click.command(name="get-tags", context_settings=CONTEXT_SETTINGS) 10 | @add_options(OPTIONS) 11 | @click.pass_context 12 | def cmd(ctx, url, key, secret, **kwargs): 13 | """Get all known tags.""" 14 | p_grp = ctx.parent.command.name 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | apiobj = getattr(client, p_grp) 17 | apimethod = apiobj.labels.get 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = apimethod() 20 | ctx.obj.echo_ok(f"Fetched {len(data)} tags") 21 | content = "\n".join(data) 22 | click.secho(content) 23 | ctx.exit(0) 24 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_assets/grp_saved_query/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | import click 5 | 6 | from ...context import AliasedGroup, load_cmds 7 | 8 | 9 | @click.group(cls=AliasedGroup) 10 | def saved_query(): 11 | """Group: Work with saved queries.""" 12 | 13 | 14 | load_cmds(path=__file__, package=__package__, group=saved_query) 15 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_assets/grp_saved_query/cmd_get_tags.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ....tools import listify 4 | from ...context import CONTEXT_SETTINGS, click 5 | from ...options import AUTH, add_options 6 | 7 | OPTIONS = [*AUTH] 8 | 9 | 10 | @click.command(name="get-tags", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, **kwargs): 14 | """Get all known tags for saved queries.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | p_grp = ctx.parent.parent.command.name 18 | apiobj = getattr(client, p_grp) 19 | 20 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 21 | data = listify(apiobj.saved_query.get_tags(**kwargs)) 22 | 23 | ctx.obj.echo_ok(f"Successfully fetched {len(data)} saved query tags") 24 | click.secho("\n".join(data)) 25 | ctx.exit(0) 26 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_certs/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ..context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def certs(): 10 | """Group: Work with SSL Certificates for the instance.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=certs) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_certs/cmd_ca_show.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | 6 | OPTIONS = [ 7 | *AUTH, 8 | ] 9 | 10 | 11 | @click.command(name="ca-show", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret): 15 | """Show the current CA Certificates.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | apiobj = client.settings_global 18 | 19 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 20 | data = apiobj.ca_get() 21 | click.secho("\n".join(apiobj.cas_to_str(config=data))) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_certs/cmd_csr_cancel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | from .grp_common import OPTS_CSR_EXPORT, handle_export 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | *OPTS_CSR_EXPORT, 10 | ] 11 | 12 | 13 | @click.command(name="csr-cancel", context_settings=CONTEXT_SETTINGS) 14 | @add_options(OPTIONS) 15 | @click.pass_context 16 | def cmd(ctx, url, key, secret, **kwargs): 17 | """Cancel a pending Certificate Signing Request.""" 18 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 19 | apiobj = client.settings_global 20 | 21 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 22 | data = apiobj.csr_cancel() 23 | ctx.obj.echo_ok(f"Canceled pending CSR: {data}") 24 | handle_export(data=data, **kwargs) 25 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_certs/cmd_csr_create.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | from .grp_common import OPTS_CSR, OPTS_CSR_EXPORT, handle_export 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | *OPTS_CSR_EXPORT, 10 | *OPTS_CSR, 11 | ] 12 | 13 | 14 | @click.command(name="csr-create", context_settings=CONTEXT_SETTINGS) 15 | @add_options(OPTIONS) 16 | @click.pass_context 17 | def cmd(ctx, url, key, secret, **kwargs): 18 | """Create a Certificate Signing Request.""" 19 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 20 | apiobj = client.settings_global 21 | 22 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 23 | data = apiobj.csr_create(**kwargs) 24 | ctx.obj.echo_ok(f"Created CSR: {data}") 25 | handle_export(data=data, **kwargs) 26 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_certs/cmd_csr_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | from .grp_common import OPTS_CSR_EXPORT, handle_export 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | *OPTS_CSR_EXPORT, 10 | ] 11 | 12 | 13 | @click.command(name="csr-get", context_settings=CONTEXT_SETTINGS) 14 | @add_options(OPTIONS) 15 | @click.pass_context 16 | def cmd(ctx, url, key, secret, **kwargs): 17 | """Get the pending Certificate Signing Request.""" 18 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 19 | apiobj = client.settings_global 20 | 21 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 22 | data = apiobj.csr_get() 23 | ctx.obj.echo_ok(f"Fetched pending CSR: {data}") 24 | handle_export(data=data, **kwargs) 25 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_certs/cmd_from_url.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ..context import CONTEXT_SETTINGS 6 | from ..options import add_options 7 | from .grp_common import OPTS_EXPORT, from_url, handle_export 8 | 9 | OPTIONS = [ 10 | click.option( 11 | "--url", 12 | "-u", 13 | "url", 14 | help="URL of host to get certificate from", 15 | show_envvar=True, 16 | show_default=True, 17 | required=True, 18 | ), 19 | *OPTS_EXPORT, 20 | ] 21 | 22 | 23 | @click.command(name="from-url", context_settings=CONTEXT_SETTINGS) 24 | @add_options(OPTIONS) 25 | @click.pass_context 26 | def cmd(ctx, url, **kwargs): 27 | """Display/save certificates from a URL.""" 28 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 29 | chain = from_url(url=url, split=False) 30 | handle_export(data=chain, **kwargs) 31 | ctx.exit(0) 32 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_certs/cmd_gui_info.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | 6 | OPTIONS = [*AUTH] 7 | 8 | 9 | @click.command(name="gui-info", context_settings=CONTEXT_SETTINGS) 10 | @add_options(OPTIONS) 11 | @click.pass_context 12 | def cmd(ctx, url, key, secret): 13 | """Get GUI certificate basic info from the REST API.""" 14 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 15 | apiobj = client.settings_global 16 | 17 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 18 | data = apiobj.gui_cert_info() 19 | 20 | click.secho(f"{data}") 21 | ctx.exit(0) 22 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | import typing as t 5 | 6 | from ..context import AliasedGroup, load_cmds 7 | from . import grp_tasks 8 | 9 | 10 | @click.group(cls=AliasedGroup) 11 | def enforcements(): 12 | """Group: Work with the Enforcement Center.""" 13 | 14 | 15 | load_cmds(path=__file__, package=__package__, group=enforcements) 16 | GROUPS: t.List[t.Any] = [grp_tasks.tasks] 17 | for grp in GROUPS: 18 | enforcements.add_command(grp) 19 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_delete.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="delete", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Delete an Enforcement Set.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.delete(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_OPT 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_SET_VALUE_OPT] 9 | 10 | 11 | @click.command(name="get", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, value): 15 | """Get Enforcement Sets.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | if value: 20 | data = client.enforcements.get_set(value=value) 21 | else: 22 | data = client.enforcements.get_sets() 23 | 24 | click.secho(EXPORT_FORMATS[export_format](data=data)) 25 | ctx.exit(0) 26 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_get_action_types.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_ACTION_VALUE_OPT, OPT_EXPORT_FORMAT 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_ACTION_VALUE_OPT] 9 | 10 | 11 | @click.command(name="get-action-types", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, value): 15 | """Get Action Types.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | if value: 20 | data = client.enforcements.get_action_type(value=value) 21 | else: 22 | data = client.enforcements.get_action_types() 23 | 24 | click.secho(EXPORT_FORMATS[export_format](data=data)) 25 | ctx.exit(0) 26 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_run.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import ( 7 | EXPORT_FORMATS, 8 | OPT_ERROR, 9 | OPT_EXPORT_FORMAT, 10 | OPT_SET_VALUES_REQ, 11 | OPT_USE_CONDITIONS, 12 | ) 13 | 14 | OPTIONS = [ 15 | *AUTH, 16 | OPT_EXPORT_FORMAT, 17 | OPT_SET_VALUES_REQ, 18 | OPT_USE_CONDITIONS, 19 | OPT_ERROR, 20 | ] 21 | 22 | 23 | @click.command(name="run", context_settings=CONTEXT_SETTINGS) 24 | @add_options(OPTIONS) 25 | @click.pass_context 26 | def cmd(ctx, url, key, secret, export_format, **kwargs): 27 | """Run Enforcement Sets.""" 28 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 29 | 30 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 31 | data = client.enforcements.run(**kwargs) 32 | 33 | click.secho(EXPORT_FORMATS[export_format](data=data)) 34 | ctx.exit(0) 35 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_folder.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..grp_folders.grp_options import OPTS_UPDATE_FOLDER 6 | from ..options import AUTH, add_options 7 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ 8 | 9 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ, *OPTS_UPDATE_FOLDER] 10 | 11 | 12 | @click.command(name="update-folder", context_settings=CONTEXT_SETTINGS) 13 | @add_options(OPTIONS) 14 | @click.pass_context 15 | def cmd(ctx, url, key, secret, export_format, **kwargs): 16 | """Update the folder of a set.""" 17 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 18 | 19 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 20 | data = client.enforcements.update_folder(**kwargs) 21 | 22 | click.secho(EXPORT_FORMATS[export_format](data=data)) 23 | ctx.exit(0) 24 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_name.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_NEW_NAME, OPT_SET_VALUE_REQ 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_NEW_NAME, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-name", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update the name of a set.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_name(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_on_count_above.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ, OPT_UPDATE_INT 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_UPDATE_INT, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-on-count-above", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update only run when asset count is above N.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_on_count_above(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_on_count_below.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ, OPT_UPDATE_INT 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_UPDATE_INT, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-on-count-below", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update only run when asset count is below N.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_on_count_below(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_on_count_decreased.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ, OPT_UPDATE_BOOL 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_UPDATE_BOOL, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-on-count-decreased", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update only run when asset count decreases.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_on_count_decreased(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_on_count_increased.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ, OPT_UPDATE_BOOL 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_UPDATE_BOOL, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-on-count-increased", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update only run when asset count increases.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_on_count_increased(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_only_new_assets.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ, OPT_UPDATE_BOOL 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_UPDATE_BOOL, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-only-new-assets", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update only run against new assets.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_only_new_assets(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_query.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ, OPTS_UPDATE_QUERY 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, *OPTS_UPDATE_QUERY, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-query", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update the query of a set.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_query(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_query_remove.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-query-remove", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Remove the query from a set.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_query_remove(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_schedule_discovery.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-schedule-discovery", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update a set to run on discovery.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_schedule_discovery(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_schedule_hourly.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_RECURRENCE_HOURLY, OPT_SET_VALUE_REQ 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_RECURRENCE_HOURLY, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-schedule-hourly", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update a set to run hourly.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_schedule_hourly(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/cmd_update_schedule_never.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | 4 | from ..context import CONTEXT_SETTINGS, click 5 | from ..options import AUTH, add_options 6 | from .grp_common import EXPORT_FORMATS, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ 7 | 8 | OPTIONS = [*AUTH, OPT_EXPORT_FORMAT, OPT_SET_VALUE_REQ] 9 | 10 | 11 | @click.command(name="update-schedule-never", context_settings=CONTEXT_SETTINGS) 12 | @add_options(OPTIONS) 13 | @click.pass_context 14 | def cmd(ctx, url, key, secret, export_format, **kwargs): 15 | """Update a set to never run.""" 16 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 17 | 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.enforcements.update_schedule_never(**kwargs) 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/grp_tasks/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def tasks(): 10 | """Group: Work with tasks ran by the Enforcement Center.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=tasks) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/grp_tasks/cmd_count.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import add_options 5 | from .options_get import AUTH, OPTS_FILTERS 6 | 7 | OPTIONS = [*AUTH, *OPTS_FILTERS] 8 | 9 | 10 | @click.command(name="count", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, **kwargs): 14 | """Get Count of Enforcement Center Tasks matching filters.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 18 | data = client.enforcements.tasks.count(**kwargs) 19 | ctx.obj.echo_ok("Count of tasks matching supplied filters:") 20 | click.echo(f"{data}") 21 | ctx.exit(0) 22 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_enforcements/grp_tasks/options_get_filters.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ....api.json_api.tasks.task_filters import build_include_options 4 | from ...context import click 5 | from ...options import AUTH, OPT_EXPORT_FILE, OPT_EXPORT_OVERWRITE 6 | from .export_get_filters import EXPORT_FORMATS, DEFAULT_EXPORT_FORMAT 7 | 8 | OPT_EXPORT_FORMAT = click.option( 9 | "--export-format", 10 | "-xt", 11 | "export_format", 12 | type=click.Choice(list(EXPORT_FORMATS)), 13 | help="Format to write data as to STDOUT or --export-file.", 14 | default=DEFAULT_EXPORT_FORMAT, 15 | show_envvar=True, 16 | show_default=True, 17 | ) 18 | 19 | OPTS_FILTERS = build_include_options() 20 | OPTS_EXPORT = [OPT_EXPORT_FORMAT, OPT_EXPORT_FILE, OPT_EXPORT_OVERWRITE] 21 | 22 | OPTIONS = [*AUTH, *OPTS_FILTERS, *OPTS_EXPORT] 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_folders/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ..context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def folders(): 10 | """Group: Work with folders.""" 11 | 12 | 13 | @click.group(cls=AliasedGroup) 14 | def enforcements(): 15 | """Group: Work with folders for Enforcements.""" 16 | 17 | 18 | @click.group(cls=AliasedGroup) 19 | def queries(): 20 | """Group: Work with folders for Queries.""" 21 | 22 | 23 | GROUPS = [enforcements, queries] 24 | 25 | for group in GROUPS: 26 | folders.add_command(group) 27 | load_cmds(path=__file__, package=__package__, group=group) 28 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_folders/cmd_create.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | from .grp_options import OPTS_CREATE 6 | 7 | OPTIONS = [*AUTH, *OPTS_CREATE] 8 | 9 | 10 | @click.command(name="create", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, **kwargs): 14 | """Create a folder.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | # get the name of the parent click group 18 | parent_group_name: str = ctx.parent.command.name 19 | 20 | # get the folders api object for this object type 21 | apiobj = getattr(client.folders, parent_group_name) 22 | 23 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 24 | folder = apiobj.create(**kwargs) 25 | click.secho(f"{folder}") 26 | click.secho(f"Created Path: {folder.path}") 27 | ctx.exit(0) 28 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_folders/cmd_delete.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | from .grp_options import OPTS_DELETE 6 | 7 | OPTIONS = [*AUTH, *OPTS_DELETE] 8 | 9 | 10 | @click.command(name="delete", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, **kwargs): 14 | """Delete a folder.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | # get the name of the parent click group 18 | parent_group_name: str = ctx.parent.command.name 19 | 20 | # get the folders api object for this object type 21 | apiobj = getattr(client.folders, parent_group_name) 22 | 23 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 24 | folder, response = apiobj.delete(**kwargs) 25 | click.secho(f"{folder}") 26 | click.secho(f"Deleted Path: {folder.path}") 27 | ctx.exit(0) 28 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_folders/cmd_move.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | from .grp_options import OPTS_MOVE 6 | 7 | OPTIONS = [*AUTH, *OPTS_MOVE] 8 | 9 | 10 | @click.command(name="move", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, **kwargs): 14 | """Move a folder.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | # get the name of the parent click group 18 | parent_group_name: str = ctx.parent.command.name 19 | 20 | # get the folders api object for this object type 21 | apiobj = getattr(client.folders, parent_group_name) 22 | 23 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 24 | folder = apiobj.move(**kwargs) 25 | click.secho(f"{folder}") 26 | click.secho(f"Moved Path: {folder.path}") 27 | ctx.exit(0) 28 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_folders/cmd_rename.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ..context import CONTEXT_SETTINGS, click 4 | from ..options import AUTH, add_options 5 | from .grp_options import OPTS_RENAME 6 | 7 | OPTIONS = [*AUTH, *OPTS_RENAME] 8 | 9 | 10 | @click.command(name="rename", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, **kwargs): 14 | """Rename a folder.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | # get the name of the parent click group 18 | parent_group_name: str = ctx.parent.command.name 19 | 20 | # get the folders api object for this object type 21 | apiobj = getattr(client.folders, parent_group_name) 22 | 23 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 24 | folder = apiobj.rename(**kwargs) 25 | click.secho(f"{folder}") 26 | click.secho(f"Renamed Path: {folder.path}") 27 | ctx.exit(0) 28 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_openapi/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ..context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def openapi(): 10 | """Group: Work with the OpenAPI YAML specification file.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=openapi) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_spaces/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ..context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def spaces(): 10 | """Group: Work with Dashboard Spaces.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=spaces) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_activity_logs/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def activity_logs(): 10 | """Group: Work with Activity Logs.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=activity_logs) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_central_core/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def central_core(): 10 | """Group: Manage Central Core feature.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=central_core) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_central_core/cmd_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ....tools import json_dump 4 | from ...context import CONTEXT_SETTINGS, click 5 | from ...options import AUTH, add_options 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | ] 10 | 11 | 12 | @click.command(name="get", context_settings=CONTEXT_SETTINGS) 13 | @add_options(OPTIONS) 14 | @click.pass_context 15 | def cmd(ctx, url, key, secret, **kwargs): 16 | """Get the current central core configuration.""" 17 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 18 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 19 | data = client.instances.get_central_core_config() 20 | click.secho(json_dump(data)) 21 | ctx.exit(0) 22 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_data_scopes/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def data_scopes(): 10 | """Group: Manage Data Scopes.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=data_scopes) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_data_scopes/cmd_delete.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT_FORMATS, OPT_VALUE, OPTS_EXPORT 6 | 7 | OPTIONS = [*AUTH, *OPTS_EXPORT, OPT_VALUE] 8 | 9 | 10 | @click.command(name="delete", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, export_format, table_format, value): 14 | """Delete a data scope.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 18 | data = client.data_scopes.delete(value=value) 19 | 20 | ctx.obj.echo_ok(f"Successfully deleted data scope: {data.name}") 21 | click.secho(EXPORT_FORMATS[export_format](data=data, table_format=table_format)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_discover/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def discover(): 10 | """Group: Discover and Lifecycle management.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=discover) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_discover/cmd_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT_FORMATS, OPTS_EXPORT 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | *OPTS_EXPORT, 10 | ] 11 | 12 | 13 | @click.command(name="get", context_settings=CONTEXT_SETTINGS) 14 | @add_options(OPTIONS) 15 | @click.pass_context 16 | def cmd(ctx, url, key, secret, export_format, phases, progress): 17 | """Get the discover cycle information.""" 18 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 19 | 20 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 21 | data = client.dashboard.get() 22 | 23 | click.secho(EXPORT_FORMATS[export_format](data=data, phases=phases, progress=progress)) 24 | ctx.exit(0) 25 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_discover/cmd_is_running.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT_FORMATS, OPTS_EXPORT 6 | 7 | OPTIONS = [*AUTH, *OPTS_EXPORT] 8 | 9 | 10 | @click.command(name="is-running", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, export_format, phases, progress): 14 | """Return exit code 0 if discovery is running, 1 if it is not.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 18 | data = client.dashboard.get() 19 | 20 | click.secho(EXPORT_FORMATS[export_format](data=data, phases=phases, progress=progress)) 21 | ctx.obj.echo_ok(f"Is running: {data.is_running}") 22 | ctx.exit(int(not data.is_running)) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_discover/cmd_stop.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT_FORMATS, OPTS_EXPORT 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | *OPTS_EXPORT, 10 | ] 11 | 12 | 13 | @click.command(name="stop", context_settings=CONTEXT_SETTINGS) 14 | @add_options(OPTIONS) 15 | @click.pass_context 16 | def cmd(ctx, url, key, secret, export_format, phases, progress): 17 | """Stop the discover cycle.""" 18 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 19 | 20 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 21 | data = client.dashboard.stop() 22 | ctx.obj.echo_ok("Discover cycle stopped!") 23 | 24 | click.secho(EXPORT_FORMATS[export_format](data=data, phases=phases, progress=progress)) 25 | ctx.exit(0) 26 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_meta/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def meta(): 10 | """Group: System metadata.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=meta) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_nodes/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def instances(): 10 | """Group: Manage Instances.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=instances) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_remote_support/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def remote_support(): 10 | """Group: Manage Remote Support configuration.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=remote_support) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_remote_support/cmd_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT, handle_export 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | *EXPORT, 10 | ] 11 | 12 | 13 | @click.command(name="get", context_settings=CONTEXT_SETTINGS) 14 | @add_options(OPTIONS) 15 | @click.pass_context 16 | def cmd(ctx, url, key, secret, **kwargs): 17 | """Get the remote support configuration.""" 18 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 19 | 20 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 21 | data = client.remote_support.get() 22 | 23 | handle_export(ctx=ctx, data=data, **kwargs) 24 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_roles/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def roles(): 10 | """Group: Manage Roles.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=roles) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_roles/cmd_delete.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT_FORMATS, OPT_ROLE_NAME, OPTS_EXPORT 6 | 7 | OPTIONS = [*AUTH, *OPTS_EXPORT, OPT_ROLE_NAME] 8 | 9 | 10 | @click.command(name="delete", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, name, export_format, table_format, **kwargs): 14 | """Delete a role.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 18 | data = client.system_roles.delete_by_name(name=name) 19 | ctx.obj.echo_ok(f"Deleted role {name!r}") 20 | 21 | click.secho(EXPORT_FORMATS[export_format](data=data, table_format=table_format)) 22 | ctx.exit(0) 23 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_roles/cmd_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT_FORMATS, OPTS_EXPORT 6 | 7 | OPTIONS = [*AUTH, *OPTS_EXPORT] 8 | 9 | 10 | @click.command(name="get", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, export_format, table_format, **kwargs): 14 | """Get all roles.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 18 | data = client.system_roles.get() 19 | 20 | click.secho(EXPORT_FORMATS[export_format](data=data, table_format=table_format)) 21 | ctx.exit(0) 22 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_roles/cmd_get_by_name.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT_FORMATS, OPT_ROLE_NAME, OPTS_EXPORT 6 | 7 | OPTIONS = [*AUTH, *OPTS_EXPORT, OPT_ROLE_NAME] 8 | 9 | 10 | @click.command(name="get-by-name", context_settings=CONTEXT_SETTINGS) 11 | @add_options(OPTIONS) 12 | @click.pass_context 13 | def cmd(ctx, url, key, secret, name, export_format, table_format, **kwargs): 14 | """Get a single role.""" 15 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 16 | 17 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 18 | data = client.system_roles.get_by_name(name=name) 19 | 20 | click.secho(EXPORT_FORMATS[export_format](data=data, table_format=table_format)) 21 | ctx.exit(0) 22 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_users/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ...context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def users(): 10 | """Group: Manage Users.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=users) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_users/cmd_delete.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | 6 | USER_NAME = click.option( 7 | "--name", 8 | "-n", 9 | "name", 10 | help="Name of user", 11 | required=True, 12 | show_envvar=True, 13 | show_default=True, 14 | ) 15 | 16 | 17 | OPTIONS = [*AUTH, USER_NAME] 18 | 19 | 20 | @click.command(name="delete", context_settings=CONTEXT_SETTINGS) 21 | @add_options(OPTIONS) 22 | @click.pass_context 23 | def cmd(ctx, url, key, secret, name, **kwargs): 24 | """Delete a user.""" 25 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 26 | 27 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 28 | client.system_users.delete(name=name) 29 | ctx.obj.echo_ok(f"Deleted user {name!r}") 30 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_users/cmd_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | from .grp_common import EXPORT, handle_export 6 | 7 | OPTIONS = [ 8 | *AUTH, 9 | EXPORT, 10 | ] 11 | 12 | 13 | @click.command(name="get", context_settings=CONTEXT_SETTINGS) 14 | @add_options(OPTIONS) 15 | @click.pass_context 16 | def cmd(ctx, url, key, secret, **kwargs): 17 | """Get all users.""" 18 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 19 | 20 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 21 | data = client.system_users.get() 22 | 23 | handle_export(ctx=ctx, data=data, **kwargs) 24 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_system/grp_users/cmd_get_password_reset_link.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | from ...context import CONTEXT_SETTINGS, click 4 | from ...options import AUTH, add_options 5 | 6 | USER_NAME = click.option( 7 | "--name", 8 | "-n", 9 | "name", 10 | help="Name of user", 11 | required=True, 12 | show_envvar=True, 13 | show_default=True, 14 | ) 15 | 16 | OPTIONS = [*AUTH, USER_NAME] 17 | 18 | 19 | @click.command(name="get-password-reset-link", context_settings=CONTEXT_SETTINGS) 20 | @add_options(OPTIONS) 21 | @click.pass_context 22 | def cmd(ctx, url, key, secret, name, **kwargs): 23 | """Get a password reset link for a user.""" 24 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 25 | 26 | with ctx.obj.exc_wrap(wraperror=ctx.obj.wraperror): 27 | data = client.system_users.get_password_reset_link(name=name) 28 | ctx.obj.echo_ok(f"Password reset link for user {name!r}:") 29 | click.echo(data) 30 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_tools/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ..context import AliasedGroup, load_cmds 6 | 7 | 8 | @click.group(cls=AliasedGroup) 9 | def tools(): 10 | """Group: CLI tools.""" 11 | 12 | 13 | load_cmds(path=__file__, package=__package__, group=tools) 14 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_tools/cmd_write_config.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from ..context import CONTEXT_SETTINGS 6 | from ..options import AUTH, add_options 7 | from .grp_common import export_env 8 | from .grp_options import OPT_ENV 9 | 10 | OPTIONS = [*AUTH, OPT_ENV] 11 | 12 | 13 | @click.command(name="write-config", context_settings=CONTEXT_SETTINGS) 14 | @add_options(OPTIONS) 15 | @click.pass_context 16 | def cmd(ctx, url, key, secret, env): 17 | """Create/Update a '.env' file with url, key, and secret.""" 18 | client = ctx.obj.start_client(url=url, key=key, secret=secret) 19 | data = {"api_secret": secret, "api_key": key} 20 | export_env(data=data, env=env, url=client.AUTH.http.url) 21 | ctx.exit(0) 22 | -------------------------------------------------------------------------------- /axonius_api_client/cli/grp_tools/grp_options.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Command line interface for Axonius API Client.""" 3 | import click 4 | 5 | from .grp_common import AX_ENV, EXPORT_FORMATS 6 | 7 | OPT_EXPORT = click.option( 8 | "--export-format", 9 | "-xf", 10 | "export_format", 11 | type=click.Choice(list(EXPORT_FORMATS)), 12 | help="Format of to export data in", 13 | default="str", 14 | show_envvar=True, 15 | show_default=True, 16 | ) 17 | 18 | OPT_ENV = click.option( 19 | "--env", 20 | "-e", 21 | "env", 22 | default=AX_ENV, 23 | help="Path to .env file when --export-format==env", 24 | show_envvar=True, 25 | show_default=True, 26 | ) 27 | -------------------------------------------------------------------------------- /axonius_api_client/constants/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Constants.""" 3 | from ..setup_env import load_dotenv 4 | from . import adapters, api, asset_helpers, ctypes, fields, general, logs, tables, wizards 5 | 6 | __all__ = ( 7 | "adapters", 8 | "api", 9 | "fields", 10 | "general", 11 | "logs", 12 | "wizards", 13 | "load_dotenv", 14 | "tables", 15 | "ctypes", 16 | "asset_helpers", 17 | ) 18 | -------------------------------------------------------------------------------- /axonius_api_client/examples/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """API Library examples. 3 | 4 | Use ``script_base.py`` as a starting point for a new API script. 5 | """ 6 | -------------------------------------------------------------------------------- /axonius_api_client/parsers/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Parsers for API models.""" 3 | from . import config, fields, grabber, matcher, searchers, tables, wizards 4 | from ..projects import url_parser 5 | 6 | __all__ = ( 7 | "config", 8 | "fields", 9 | "grabber", 10 | "tables", 11 | "url_parser", 12 | "wizards", 13 | "matcher", 14 | "searchers", 15 | ) 16 | -------------------------------------------------------------------------------- /axonius_api_client/projects/__init__.py: -------------------------------------------------------------------------------- 1 | """Projects that are their own python modules.""" 2 | 3 | from . import cert_human, cf_token, url_parser 4 | 5 | __all__ = ("cert_human", "cf_token", "url_parser") 6 | -------------------------------------------------------------------------------- /axonius_api_client/projects/cert_human/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Tools for working with SSL certificate files.""" 3 | 4 | from . import ( 5 | constants, 6 | ct_logs, 7 | enums, 8 | exceptions, 9 | paths, 10 | ssl_capture, 11 | ssl_context, 12 | ssl_extensions, 13 | stores, 14 | convert, 15 | utils, 16 | ) 17 | from .stores import Cert, CertRequest, Store 18 | 19 | __all__ = ( 20 | "Store", 21 | "Cert", 22 | "convert", 23 | "CertRequest", 24 | "utils", 25 | "ssl_extensions", 26 | "stores", 27 | "ct_logs", 28 | "enums", 29 | "paths", 30 | "ssl_context", 31 | "exceptions", 32 | "constants", 33 | "ssl_capture", 34 | ) 35 | -------------------------------------------------------------------------------- /axonius_api_client/projects/cert_human/constants.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Fallback for all_logs_list.json.""" 3 | import pathlib 4 | from typing import Optional, Tuple 5 | 6 | 7 | class CT_LOGS: 8 | """Pass.""" 9 | 10 | refetch: bool = False 11 | modified_days_max: Optional[int] = 30 12 | timeout: Tuple[float, float] = (3.2, 6.2) 13 | 14 | url: str = "https://www.gstatic.com/ct/log_list/v3/all_logs_list.json" 15 | data_file: str = "all_logs_list.json" 16 | path: pathlib.Path = pathlib.Path(__file__).parent / data_file 17 | request_args: dict = {} 18 | 19 | @classmethod 20 | def get(cls, key: str, kwargs: dict): 21 | """Pass.""" 22 | return kwargs.get(key, getattr(cls, key)) 23 | -------------------------------------------------------------------------------- /axonius_api_client/projects/cert_human/exceptions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Tools for working with SSL certificate files.""" 3 | 4 | 5 | class CertHumanError(Exception): 6 | """Pass.""" 7 | 8 | 9 | class PathError(ValueError, CertHumanError): 10 | """Pass.""" 11 | 12 | 13 | class PathNotFoundError(PathError): 14 | """Pass.""" 15 | 16 | 17 | class InvalidCertError(CertHumanError): 18 | """Pass.""" 19 | 20 | def __init__(self, reason: str, store): 21 | """Pass.""" 22 | self.reason: str = reason 23 | self.store = store 24 | 25 | items = [f"Invalid Certificate: {store}", f"Invalid Certificate reason: {reason}"] 26 | msgs = [*items, "", store.to_str(), "", *items] 27 | super().__init__("\n".join(msgs)) 28 | -------------------------------------------------------------------------------- /axonius_api_client/projects/cert_human/stores/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Tools for working with SSL certificate files.""" 3 | 4 | from . import cert, cert_request, store 5 | from .cert import Cert 6 | from .cert_request import CertRequest 7 | from .store import Store 8 | 9 | __all__ = ( 10 | "Cert", 11 | "CertRequest", 12 | "store", 13 | "cert", 14 | "cert_request", 15 | "Store", 16 | ) 17 | -------------------------------------------------------------------------------- /axonius_api_client/projects/cf_token/__init__.py: -------------------------------------------------------------------------------- 1 | """Cloudflare utilities.""" 2 | from . import constants, tools, flows 3 | from .flows import flow_get_token, flow_get_token_cloudflared, GetTokenError 4 | 5 | __all__ = ( 6 | "constants", 7 | "flows", 8 | "tools", 9 | "flow_get_token", 10 | "flow_get_token_cloudflared", 11 | "GetTokenError", 12 | ) 13 | 14 | __version__ = "1.0.0" 15 | -------------------------------------------------------------------------------- /axonius_api_client/projects/cli_cf_token.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """CLI for Cloudflare utilities.""" 3 | 4 | if __name__ == "__main__": # pragma: no cover 5 | import sys 6 | import pathlib 7 | 8 | THIS_PATH = pathlib.Path(__file__).parent.absolute() 9 | 10 | sys.path.insert(0, str(THIS_PATH)) 11 | 12 | from cf_token import cli 13 | 14 | cli.get_token_cli() 15 | -------------------------------------------------------------------------------- /axonius_api_client/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/datafiles/certs/ca_ec.key: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PARAMETERS----- 2 | BggqhkjOPQMBBw== 3 | -----END EC PARAMETERS----- 4 | -----BEGIN EC PRIVATE KEY----- 5 | MHcCAQEEIFS2CCbraiv+HeJjvBEYb6G9avRg5uP0wFmHQe5vaeNWoAoGCCqGSM49 6 | AwEHoUQDQgAEA/b1GP/XTcw2bvSJ/4DSzV/n96J+ZhrHJs3Aq5DVwaNsZJcBlywq 7 | 1ENv6iSZq2pgAV1HIiQFdcOIGL65wO9AnA== 8 | -----END EC PRIVATE KEY----- 9 | -------------------------------------------------------------------------------- /axonius_api_client/tests/datafiles/certs/server_ec.csr.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIBrDCCAVICAQAwgaExCzAJBgNVBAYTAlVTMREwDwYDVQQIDAhOZXcgWW9yazEW 3 | MBQGA1UEBwwNTmV3IFlvcmsgQ2l0eTEVMBMGA1UECgwMQXhvbml1cywgSW5jMRow 4 | GAYDVQQLDBFheG9uaXVzX3NlcnZlcl9vdTEQMA4GA1UEAwwHYXhvbml1czEiMCAG 5 | CSqGSIb3DQEJARYTc3VwcG9ydEBheG9uaXVzLmNvbTBZMBMGByqGSM49AgEGCCqG 6 | SM49AwEHA0IABJs7GClz2RvXilK91uTPvvJpiyM+LdLNXZEJ8Tq8EwcRM3x8bUVK 7 | 7io/UoR4lgciFH+JswOt9nubYHztKrxYtZSgTjBMBgkqhkiG9w0BCQ4xPzA9MA8G 8 | A1UdEQQIMAaHBAoUA+kwCwYDVR0PBAQDAgOIMB0GA1UdJQQWMBQGCCsGAQUFBwMB 9 | BggrBgEFBQcDAjAKBggqhkjOPQQDAgNIADBFAiEAgDoE17X5xf5WA9inBD/4ElYO 10 | 4QtZymbaqpXiM9FG5uUCIG2CJY3Sr2lRe5Lw/7taUYdw6n90+a1NV+855BbJtWIC 11 | -----END CERTIFICATE REQUEST----- 12 | -------------------------------------------------------------------------------- /axonius_api_client/tests/datafiles/certs/server_ec.key: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PARAMETERS----- 2 | BggqhkjOPQMBBw== 3 | -----END EC PARAMETERS----- 4 | -----BEGIN EC PRIVATE KEY----- 5 | MHcCAQEEIKcdMCBLZRq4MWf/ivtuOKRFpX6ihoEgc6Xzh6rlZEt/oAoGCCqGSM49 6 | AwEHoUQDQgAEmzsYKXPZG9eKUr3W5M++8mmLIz4t0s1dkQnxOrwTBxEzfHxtRUru 7 | Kj9ShHiWByIUf4mzA632e5tgfO0qvFi1lA== 8 | -----END EC PRIVATE KEY----- 9 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_adapters/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_asset_callbacks/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_assets/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_enforcements/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_folders/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_json_api/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_openapi/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_openapi/test_openapi.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | 4 | import pytest 5 | 6 | 7 | def validate_openapi_spec(data): 8 | assert isinstance(data, str) and data 9 | 10 | split = data.splitlines() 11 | searches = ["openapi", "info", "components", "paths"] 12 | for search in searches: 13 | check = f"{search}:" 14 | found = any([x.startswith(f"{check}") for x in split]) 15 | assert found, f"{check!r} not found" 16 | 17 | 18 | class OpenAPIBase: 19 | @pytest.fixture(scope="class") 20 | def apiobj(self, api_openapi): 21 | return api_openapi 22 | 23 | 24 | class TestOpenAPIPrivate(OpenAPIBase): 25 | def test_get_spec(self, apiobj): 26 | data = apiobj._get_spec() 27 | validate_openapi_spec(data=data) 28 | 29 | 30 | class TestOpenAPIPublic(OpenAPIBase): 31 | def test_get_spec(self, apiobj): 32 | data = apiobj.get_spec() 33 | validate_openapi_spec(data=data) 34 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_parsers/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_system/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_api/tests_wizard/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_auth/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cert_human/test_enums.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | from axonius_api_client.projects.cert_human import enums 4 | 5 | 6 | class TestGetNameByValue: 7 | def test_mapped(self): 8 | exp = enums.SignatureAlgorithms.rsa.name 9 | data = enums.SignatureAlgorithms.get_name_by_value(enums.SignatureAlgorithms.rsa.value) 10 | assert data == exp 11 | 12 | def test_unmapped(self): 13 | exp = None 14 | data = enums.SignatureAlgorithms.get_name_by_value("badwolf") 15 | assert data == exp 16 | 17 | 18 | class TestGetValueByName: 19 | def test_mapped(self): 20 | exp = enums.SignatureAlgorithms.rsa.value 21 | data = enums.SignatureAlgorithms.get_value_by_name(enums.SignatureAlgorithms.rsa.name) 22 | assert data == exp 23 | 24 | def test_unmapped(self): 25 | exp = None 26 | data = enums.SignatureAlgorithms.get_value_by_name("badwolf") 27 | assert data == exp 28 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cf_token/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_folders_grp/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_activity_logs/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_adapters/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_assets/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_central_core/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_central_core/test_cmd_get.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite for axonius_api_client.tools.""" 3 | from axonius_api_client.cli import cli 4 | from axonius_api_client.tools import json_load 5 | 6 | from ...utils import load_clirunner 7 | 8 | 9 | class TestGrpCentralCoreCmdGet: 10 | def test_get(self, request, monkeypatch): 11 | runner = load_clirunner(request, monkeypatch) 12 | with runner.isolated_filesystem(): 13 | args = [ 14 | "system", 15 | "central-core", 16 | "get", 17 | ] 18 | result = runner.invoke(cli=cli, args=args) 19 | 20 | assert result.stdout 21 | assert result.stderr 22 | assert result.exit_code == 0 23 | 24 | data = json_load(result.stdout) 25 | assert isinstance(data, dict) and data 26 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_central_core/test_cmd_restore_from_aws_s3.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite for axonius_api_client.tools.""" 3 | from axonius_api_client.cli import cli 4 | 5 | from ...utils import load_clirunner 6 | 7 | 8 | class TestGrpCentralCoreCmdRestoreFromAwsS3: 9 | def test_fail(self, request, monkeypatch): 10 | # no way to easily automate this, so this will fail in our current suite 11 | 12 | runner = load_clirunner(request, monkeypatch) 13 | with runner.isolated_filesystem(): 14 | args = [ 15 | "system", 16 | "central-core", 17 | "restore-from-aws-s3", 18 | "--key-name", 19 | "badwolf", 20 | ] 21 | result = runner.invoke(cli=cli, args=args) 22 | 23 | assert not result.stdout 24 | assert result.stderr 25 | assert result.exit_code == 1 26 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_cnx/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_data_scopes/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_discover/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_enforcements/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_meta/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_meta/test_cmd_history_sizes.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_openapi/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_saved_query/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_system_roles/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_system_roles/test_cmd_get_perms.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite for axonius_api_client.tools.""" 3 | from ....cli import cli 4 | from ...utils import load_clirunner 5 | from .base import SystemRolesBase 6 | 7 | 8 | class TestGrpSystemRolesCmdGetPerms(SystemRolesBase): 9 | def test_str_types(self, apiobj, request, monkeypatch): 10 | runner = load_clirunner(request, monkeypatch) 11 | with runner.isolated_filesystem(): 12 | args = [ 13 | "system", 14 | "roles", 15 | "get-perms", 16 | ] 17 | result = runner.invoke(cli=cli, args=args) 18 | 19 | assert result.stdout 20 | assert result.stderr 21 | assert result.exit_code == 0 22 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_tasks/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_tasks/test_cmd_count.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Tests for axonshell enforcements tasks count.""" 3 | from axonius_api_client.cli import cli 4 | from ...utils import load_clirunner 5 | 6 | 7 | class TestGrpTasksCmdCount: 8 | def test_default(self, request, monkeypatch): 9 | runner = load_clirunner(request, monkeypatch) 10 | with runner.isolated_filesystem(): 11 | args = [ 12 | "enforcements", 13 | "tasks", 14 | "count", 15 | ] 16 | result = runner.invoke(cli=cli, args=args) 17 | 18 | assert result.stdout 19 | assert result.stderr 20 | assert result.exit_code == 0 21 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_cli/tests_grp_tools/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /axonius_api_client/tests/tests_pkg/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test suite.""" 3 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | -------------------------------------------------------------------------------- /docs/_static/apikeysecret.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Axonius/axonius_api_client/742399b6cef7e00d59781f6d71740ce106bcd9f9/docs/_static/apikeysecret.png -------------------------------------------------------------------------------- /docs/_static/axlogo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Axonius/axonius_api_client/742399b6cef7e00d59781f6d71740ce106bcd9f9/docs/_static/axlogo512.png -------------------------------------------------------------------------------- /docs/_static/axlogofull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Axonius/axonius_api_client/742399b6cef7e00d59781f6d71740ce106bcd9f9/docs/_static/axlogofull.png -------------------------------------------------------------------------------- /docs/_templates/module.rst_t: -------------------------------------------------------------------------------- 1 | {%- if basename.split(".")|length > 1 %} 2 | {%- set shortname = basename.split(".")[1:] | join(".") -%} 3 | {%- else %} 4 | {%- set shortname = basename -%} 5 | {% endif %} 6 | 7 | 8 | {%- if show_headings %} 9 | {{- [shortname, "module"] | join(' ') | e | heading }} 10 | 11 | {% endif -%} 12 | .. automodule:: {{ qualname }} 13 | :members: 14 | :special-members: 15 | :private-members: 16 | :member-order: bysource 17 | -------------------------------------------------------------------------------- /docs/_templates/toc.rst_t: -------------------------------------------------------------------------------- 1 | {{ header | heading }} 2 | 3 | .. toctree:: 4 | :maxdepth: {{ maxdepth }} 5 | {% for docname in docnames %} 6 | {{ docname }} 7 | {%- endfor %} 8 | 9 | -------------------------------------------------------------------------------- /docs/_themes/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.pyo 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /docs/main/.special.rst: -------------------------------------------------------------------------------- 1 | .. role:: black 2 | .. role:: gray 3 | .. role:: grey 4 | .. role:: silver 5 | .. role:: white 6 | .. role:: maroon 7 | .. role:: red 8 | .. role:: magenta 9 | .. role:: fuchsia 10 | .. role:: pink 11 | .. role:: orange 12 | .. role:: yellow 13 | .. role:: lime 14 | .. role:: green 15 | .. role:: olive 16 | .. role:: teal 17 | .. role:: cyan 18 | .. role:: aqua 19 | .. role:: blue 20 | .. role:: navy 21 | .. role:: purple 22 | 23 | .. role:: under 24 | .. role:: over 25 | .. role:: blink 26 | .. role:: line 27 | .. role:: strike 28 | 29 | .. role:: it 30 | .. role:: ob 31 | 32 | .. role:: small 33 | .. role:: large 34 | 35 | .. role:: center 36 | .. role:: left 37 | .. role:: right 38 | .. role:: axon 39 | -------------------------------------------------------------------------------- /docs/main/axtokens.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | .. _axtokens: 4 | 5 | API Key and Secret 6 | ######################### 7 | 8 | .. include:: /main/deprecation_banner.rst 9 | 10 | The API Key and Secret for an Axonius user is available from the :blue:`My Account` page. 11 | 12 | You can get to the :blue:`My Account` page by clicking the gear icon in the left hand 13 | toolbar or by going to :red:`https://axonius_instance/account`. On that page you will find 14 | the :green:`API Key` and :green:`API Secret` fields under the :blue:`API Key` tab: 15 | 16 | .. image:: /_static/apikeysecret.png 17 | :scale: 60 18 | 19 | -------------------------------------------------------------------------------- /docs/main/deprecation_banner.rst: -------------------------------------------------------------------------------- 1 | .. warning:: **This API is deprecated.** 2 | 3 | Axonius API v2 is now available, we recommend you move to API v2. 4 | 5 | New features will no longer be added to this API. Axonius will only provide bug fixes. 6 | 7 | `Read about API v2`_ 8 | 9 | .. _Read about API v2: https://docs.axonius.com/docs/axonius-rest-api -------------------------------------------------------------------------------- /docs/main/usage_api/api/adapters/adapters.rst: -------------------------------------------------------------------------------- 1 | 2 | Adapters 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.adapters.adapters 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/adapters/cnx.rst: -------------------------------------------------------------------------------- 1 | 2 | Connections 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.adapters.cnx 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/adapters/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Adapters and connections 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. toctree:: 8 | adapters 9 | cnx 10 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/callbacks/base.rst: -------------------------------------------------------------------------------- 1 | 2 | Base 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.asset_callbacks.base 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/callbacks/csv.rst: -------------------------------------------------------------------------------- 1 | 2 | CSV 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.asset_callbacks.base_csv 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/callbacks/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Export callbacks 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. toctree:: 8 | base 9 | csv 10 | json 11 | json_to_csv 12 | table 13 | xlsx 14 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/callbacks/json.rst: -------------------------------------------------------------------------------- 1 | 2 | JSON 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.asset_callbacks.base_json 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/callbacks/json_to_csv.rst: -------------------------------------------------------------------------------- 1 | 2 | JSON to CSV 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.asset_callbacks.base_json_to_csv 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/callbacks/table.rst: -------------------------------------------------------------------------------- 1 | 2 | Table 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.asset_callbacks.base_table 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/callbacks/xlsx.rst: -------------------------------------------------------------------------------- 1 | 2 | Excel 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.asset_callbacks.base_xlsx 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/devices.rst: -------------------------------------------------------------------------------- 1 | 2 | Device assets 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.assets.devices 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/fields.rst: -------------------------------------------------------------------------------- 1 | 2 | Fields 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.assets.fields 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Assets 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. toctree:: 8 | devices 9 | users 10 | fields 11 | labels 12 | saved_query 13 | callbacks/index 14 | wizards/index 15 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/labels.rst: -------------------------------------------------------------------------------- 1 | 2 | Tags 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.assets.labels 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/saved_query.rst: -------------------------------------------------------------------------------- 1 | 2 | Saved queries 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.assets.saved_query 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/users.rst: -------------------------------------------------------------------------------- 1 | 2 | User assets 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.assets.users 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/wizards/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Query Wizards 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. toctree:: 8 | wizard 9 | wizard_csv 10 | wizard_text 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/wizards/wizard.rst: -------------------------------------------------------------------------------- 1 | 2 | From python objects 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.wizards.wizard 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/wizards/wizard_csv.rst: -------------------------------------------------------------------------------- 1 | 2 | From CSV files 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.wizards.wizard_csv 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/assets/wizards/wizard_text.rst: -------------------------------------------------------------------------------- 1 | 2 | From text files 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.wizards.wizard_text 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/enforcements/actions.rst: -------------------------------------------------------------------------------- 1 | 2 | Actions 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.enforcements.actions 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/enforcements/enforcements.rst: -------------------------------------------------------------------------------- 1 | 2 | Enforcements 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.enforcements.enforcements 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/enforcements/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Enforcements and actions 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. toctree:: 8 | enforcements 9 | actions 10 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/dashboard.rst: -------------------------------------------------------------------------------- 1 | 2 | Dashboards and discovery cycles 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.dashboard 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/index.rst: -------------------------------------------------------------------------------- 1 | 2 | System 3 | ########################################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. toctree:: 8 | dashboard 9 | instances 10 | meta 11 | settings_global 12 | settings_gui 13 | settings_lifecycle 14 | signup 15 | system_roles 16 | system_users 17 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/instances.rst: -------------------------------------------------------------------------------- 1 | 2 | Instances 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.instances 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/meta.rst: -------------------------------------------------------------------------------- 1 | 2 | Product metadata 3 | ########################################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.meta 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/settings_global.rst: -------------------------------------------------------------------------------- 1 | 2 | System Settings -> Global Settings 3 | ########################################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.settings_global 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/settings_gui.rst: -------------------------------------------------------------------------------- 1 | 2 | System Settings -> GUI Settings 3 | ########################################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.settings_gui 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/settings_lifecycle.rst: -------------------------------------------------------------------------------- 1 | 2 | System Settings -> Lifecycle Settings 3 | ########################################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.settings_lifecycle 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/signup.rst: -------------------------------------------------------------------------------- 1 | 2 | Initial signup 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.signup 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/system_roles.rst: -------------------------------------------------------------------------------- 1 | 2 | System Roles 3 | ########################################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.system_roles 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/api/system/system_users.rst: -------------------------------------------------------------------------------- 1 | 2 | System Users 3 | ########################################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.api.system.system_users 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/connect.rst: -------------------------------------------------------------------------------- 1 | 2 | Connection Handler 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.connect 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/api/api_mixins.rst: -------------------------------------------------------------------------------- 1 | 2 | API models 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.api.mixins 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/api/asset_mixins.rst: -------------------------------------------------------------------------------- 1 | 2 | Asset API models 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.api.assets.asset_mixin 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/api/index.rst: -------------------------------------------------------------------------------- 1 | 2 | API library backend 3 | ############################################### 4 | 5 | .. toctree:: 6 | api_mixins 7 | asset_mixins 8 | routers 9 | settings_mixins 10 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/api/routers.rst: -------------------------------------------------------------------------------- 1 | 2 | Endpoint routers 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.api.routers 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/api/settings_mixins.rst: -------------------------------------------------------------------------------- 1 | 2 | Settings mixins 3 | ########################################################### 4 | 5 | .. automodule:: axonius_api_client.api.system.settings_mixins 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/auth/api_key.rst: -------------------------------------------------------------------------------- 1 | 2 | Authenticating 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.auth.api_key 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/auth/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Authenticating 3 | ############################################### 4 | 5 | .. toctree:: 6 | api_key 7 | models 8 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/auth/models.rst: -------------------------------------------------------------------------------- 1 | 2 | Models 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.auth.models 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/constants/adapters.rst: -------------------------------------------------------------------------------- 1 | 2 | Adapters 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.constants.adapters 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/constants/api.rst: -------------------------------------------------------------------------------- 1 | 2 | API models 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.constants.api 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/constants/fields.rst: -------------------------------------------------------------------------------- 1 | 2 | Fields 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.constants.fields 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/constants/general.rst: -------------------------------------------------------------------------------- 1 | 2 | General 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.constants.general 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/constants/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Constants 3 | ############################################### 4 | 5 | .. toctree:: 6 | adapters 7 | api 8 | fields 9 | general 10 | logs 11 | system 12 | wizards 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/constants/logs.rst: -------------------------------------------------------------------------------- 1 | 2 | Logs 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.constants.logs 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/constants/system.rst: -------------------------------------------------------------------------------- 1 | 2 | System 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.constants.system 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/constants/wizards.rst: -------------------------------------------------------------------------------- 1 | 2 | Wizards 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.constants.wizards 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Library backend 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. toctree:: 8 | api/index 9 | auth/index 10 | constants/index 11 | parsers/index 12 | tools/index 13 | version 14 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/parsers/adapters.rst: -------------------------------------------------------------------------------- 1 | 2 | Adapter schemas 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.parsers.adapters 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/parsers/config.rst: -------------------------------------------------------------------------------- 1 | 2 | Configuration schemas 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.parsers.config 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/parsers/fields.rst: -------------------------------------------------------------------------------- 1 | 2 | Field schemas 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.parsers.fields 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/parsers/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Parsers 3 | ############################################### 4 | 5 | .. toctree:: 6 | adapters 7 | config 8 | fields 9 | system 10 | tables 11 | url_parser 12 | wizards 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/parsers/system.rst: -------------------------------------------------------------------------------- 1 | 2 | System 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.parsers.system 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/parsers/tables.rst: -------------------------------------------------------------------------------- 1 | 2 | Tables 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.parsers.tables 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/parsers/url_parser.rst: -------------------------------------------------------------------------------- 1 | 2 | URLs 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.parsers.url_parser 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/parsers/wizards.rst: -------------------------------------------------------------------------------- 1 | 2 | Wizards 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.parsers.wizards 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/tools/data.rst: -------------------------------------------------------------------------------- 1 | 2 | Data classes 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.data 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/tools/exceptions.rst: -------------------------------------------------------------------------------- 1 | 2 | Exceptions and warnings 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.exceptions 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/tools/http.rst: -------------------------------------------------------------------------------- 1 | 2 | HTTP Client 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.http 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/tools/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Tools 3 | ############################################### 4 | 5 | .. toctree:: 6 | data 7 | exceptions 8 | http 9 | logs 10 | setup_env 11 | tools 12 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/tools/logs.rst: -------------------------------------------------------------------------------- 1 | 2 | Logging utilities 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.logs 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/tools/setup_env.rst: -------------------------------------------------------------------------------- 1 | 2 | Setup environment variables 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.setup_env 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/tools/tools.rst: -------------------------------------------------------------------------------- 1 | 2 | Utilities 3 | ############################################### 4 | 5 | .. automodule:: axonius_api_client.tools 6 | :members: 7 | :show-inheritance: 8 | :inherited-members: 9 | :undoc-members: 10 | :member-order: bysource 11 | -------------------------------------------------------------------------------- /docs/main/usage_api/library/version.rst: -------------------------------------------------------------------------------- 1 | 2 | Version metadata 3 | ############################################### 4 | 5 | .. include:: /main/deprecation_banner.rst 6 | 7 | .. automodule:: axonius_api_client.version 8 | :members: 9 | :show-inheritance: 10 | :inherited-members: 11 | :undoc-members: 12 | :member-order: bysource 13 | -------------------------------------------------------------------------------- /docs/main/usage_api/usage_api.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Using the API library 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | quickstart.rst 12 | connect 13 | api/adapters/index 14 | api/assets/index 15 | api/enforcements/index 16 | api/system/index 17 | library/index 18 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | .. _get_by_ex: 4 | 5 | Get By Examples 6 | ############################################### 7 | 8 | .. include:: /main/deprecation_banner.rst 9 | 10 | These examples show the various ways that get-by commands can be used. The examples 11 | only show individual options being used for the most part, but you can combine any 12 | number of these options to have the commands create powerful queries for you. 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | :glob: 17 | 18 | get_by_examples/ex* 19 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Find Single Item - No Match Found 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get a device by hostname that does not exist. 11 | * Throws an error because 0 matches were found. 12 | * This command builds a query for you, example: 13 | ``(specific_data.data.hostname == "nosuchname")`` 14 | 15 | .. code:: shell 16 | 17 | $ axonshell devices get-by-hostname \ 18 | --value nosuchname 19 | 20 | .. raw:: html 21 | 22 | 23 | 24 | .. include:: notes.rst 25 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Find Single Item - Match Found 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get a device by hostname that does exist. 11 | * This command builds a query for you, example: 12 | ``(specific_data.data.hostname == "WIN-76F9735PMOJ")`` 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices get-by-hostname \ 17 | --value WIN-76F9735PMOJ \ 18 | --export-file device.json 19 | 20 | .. raw:: html 21 | 22 | 23 | 24 | .. include:: notes.rst 25 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Find Using Regular Expressions - No Matches Found 4 | ################################################# 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get devices by hostname that match a regular expression. 11 | * This command builds a query for you, example: 12 | ``(specific_data.data.hostname == regex("nosuchname.*", "i"))`` 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices get-by-hostname \ 17 | --value "nosuchname.*" \ 18 | --value-regex \ 19 | --export-file device.json \ 20 | --export-overwrite 21 | 22 | .. raw:: html 23 | 24 | 25 | 26 | .. include:: notes.rst 27 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by_examples/ex4.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Find Using Regular Expressions - Matches Found 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get devices by hostname that match a regular expression. 11 | * This command builds a query for you, example: 12 | ``(specific_data.data.hostname == regex("win.*", "i"))`` 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices get-by-hostname \ 17 | --value "win.*" \ 18 | --value-regex \ 19 | --export-file device.json \ 20 | --export-overwrite 21 | 22 | .. raw:: html 23 | 24 | 25 | 26 | .. include:: notes.rst 27 | 28 | .. note:: 29 | 30 | The ``devices get-by-subnet`` command does not support using regular expressions, 31 | so it does not have a --value-regex option. 32 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by_examples/ex5.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Find Using NOT 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get devices by hostname that do NOT match a value. 11 | * This command builds a query for you, example: 12 | ``not (specific_data.data.hostname == "WIN-76F9735PMOJ"))`` 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices get-by-hostname \ 17 | --value "WIN-76F9735PMOJ" \ 18 | --value-not \ 19 | --export-file device.json \ 20 | --export-overwrite 21 | 22 | .. raw:: html 23 | 24 | 25 | 26 | .. include:: notes.rst 27 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by_examples/ex7.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Find Using Multiple Values 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get devices by hostname that match multiple values. 11 | * This command builds a query for you, example: 12 | ``(specific_data.data.hostname in ['WIN-76F9735PMOJ', 'EC2AMAZ-V8E9DHF'])`` 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices get-by-hostname \ 17 | --value "WIN-76F9735PMOJ" \ 18 | --value "EC2AMAZ-V8E9DHF" \ 19 | --export-file device.json \ 20 | --export-overwrite 21 | 22 | .. raw:: html 23 | 24 | 25 | 26 | .. include:: notes.rst 27 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by_examples/ex8.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Find Matches With A Query Prefix 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get devices by hostname and add ``INCLUDE OUTDATED:`` to the beginning of the 11 | query built by the command. 12 | * This command builds a query for you, example: 13 | ``INCLUDE OUTDATED: (specific_data.data.hostname == regex("WIN.*", "i"))`` 14 | 15 | .. code:: shell 16 | 17 | $ axonshell devices get-by-hostname \ 18 | --value "WIN.*" \ 19 | --value-regex \ 20 | --query-pre "INCLUDE OUTDATED:" \ 21 | --export-file device.json \ 22 | --export-overwrite 23 | 24 | .. raw:: html 25 | 26 | 27 | 28 | .. include:: notes.rst 29 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/get_by_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example uses the ``devices get-by-hostname`` command, but it will work for any 9 | ``get-by-..`` command for the devices and users command groups with the exception of 10 | ``get-by-saved-query`` (which uses the query built in to the saved query). 11 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/select_field_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Select Fields: Valid Generic Field 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get device assets and include the ``os.type`` generic field in the response data. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices get \ 15 | --field os.type \ 16 | --export-file device.json \ 17 | --export-overwrite 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | .. include:: notes.rst 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/select_field_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Select Fields: Invalid Generic Field 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Raises an error that shows all of the valid generic fields because no generic 11 | field named ``foo`` exists. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get \ 16 | --field foo \ 17 | --export-file device.json \ 18 | --export-overwrite 19 | 20 | .. raw:: html 21 | 22 | 23 | 24 | .. include:: notes.rst 25 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/select_field_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Select Fields: Invalid Adapter 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Raises an error that shows all of the valid adapters because no adapter 11 | named ``foo`` exists. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get \ 16 | --field foo:bar \ 17 | --export-file device.json \ 18 | --export-overwrite 19 | 20 | .. raw:: html 21 | 22 | 23 | 24 | .. include:: notes.rst 25 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/select_field_examples/ex4.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Select Fields: Multiple Fields 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get device assets and include the generic fields ``os.type`` and ``os.distribution``, 11 | and the aws adapter fields ``aws_device_type`` and ``aws_region`` in the response data. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get \ 16 | -f os.type \ 17 | -f os.distribution \ 18 | -f aws:aws_device_type \ 19 | -f aws:aws_region \ 20 | --export-file device.json \ 21 | --export-overwrite 22 | 23 | .. raw:: html 24 | 25 | 26 | 27 | .. include:: notes.rst 28 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/select_field_examples/ex5.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Select Fields: Multiple Fields Using Commas 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get device assets and include the generic fields ``os.type`` and ``os.distribution``, 11 | and the aws adapter fields ``aws_device_type`` and ``aws_region`` in the response data. 12 | * This uses commas to seperate the fields per adapter. 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices get \ 17 | -f os.type,os.distribution \ 18 | -f aws:aws_device_type,aws_region \ 19 | --export-file device.json \ 20 | --export-overwrite 21 | 22 | .. raw:: html 23 | 24 | 25 | 26 | .. include:: notes.rst 27 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/select_field_examples/ex6.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Select Fields: No default fields 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get device assets and include the generic field ``os.type``, but don't include the 11 | default fields defined for devices or users in the API client. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get \ 16 | -f os.type \ 17 | --no-fields-default \ 18 | --export-file device.json \ 19 | --export-overwrite 20 | 21 | .. raw:: html 22 | 23 | 24 | 25 | .. include:: notes.rst 26 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/select_field_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example uses the ``devices get`` command, but it will work for any 9 | ``get..`` command for the devices or users command groups. 10 | 11 | .. note:: 12 | 13 | Selecting fields from a particular adapter is done by supplying an adapter name 14 | followed by a field name seperated by a colon, example: 15 | ``--field aws:aws_device_type``. 16 | 17 | .. note:: 18 | 19 | If no ``adapter:`` is included in the field, it is assumed you mean ``generic:``. 20 | 21 | .. note:: 22 | 23 | Generic fields are the fields that are under the ``General`` section in the GUI. 24 | These are the fields that contain all of the aggregated data for an asset. 25 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/select_fields.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | .. _select_fields_ex: 4 | 5 | Selecting Fields Examples 6 | ############################################### 7 | 8 | .. include:: /main/deprecation_banner.rst 9 | 10 | These examples show how to select what fields (columns in the GUI) are included 11 | in responses for getting assets. 12 | 13 | .. toctree:: 14 | :maxdepth: 1 15 | :glob: 16 | 17 | select_field_examples/ex* 18 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/settings.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | .. _settings_ex: 4 | 5 | Settings Examples 6 | ############################################### 7 | 8 | .. include:: /main/deprecation_banner.rst 9 | 10 | These examples show the various ways that settings commands can be used. The examples 11 | only show individual options being used for the most part, but you can combine any 12 | number of these options to have the commands create powerful queries for you. 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | :glob: 17 | 18 | settings_examples/ex* 19 | -------------------------------------------------------------------------------- /docs/main/usage_cli/common_examples/settings_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | -------------------------------------------------------------------------------- /docs/main/usage_cli/features/aliases.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Command Group Aliases 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | All command groups can be referenced using the most unique short name. 9 | 10 | Single Matches 11 | =============================================== 12 | 13 | .. code:: 14 | 15 | $ # long names 16 | $ axonshell devices labels 17 | 18 | $ # short names 19 | $ axonshell d l 20 | 21 | Multiple Matches 22 | =============================================== 23 | 24 | .. code:: 25 | 26 | $ # long names 27 | $ axonshell adapters cnx discover 28 | $ axonshell adapters cnx delete 29 | 30 | $ # short names that fail due to too many matches that start with "d" 31 | $ axonshell a c d 32 | 33 | $ # short names that will work 34 | $ axonshell a c di 35 | $ axonshell a c de 36 | -------------------------------------------------------------------------------- /docs/main/usage_cli/features/autocomplete.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Autocompletion 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | Since axonshell is built using `click`_, there is automatic support for bash and zsh `autocompletion`_. 9 | 10 | Bash 11 | =============================================== 12 | 13 | .. code:: 14 | 15 | $ echo 'eval "$(_AXONSHELL_COMPLETE=source axonshell)"' >> ~/.bashrc 16 | 17 | Zsh 18 | =============================================== 19 | 20 | .. code:: 21 | 22 | $ echo 'eval "$(_AXONSHELL_COMPLETE=source_zsh axonshell)"' >> ~/.zshrc 23 | 24 | Example of setting up autocomplete in a single shell session: 25 | 26 | .. raw:: html 27 | 28 | 29 | 30 | .. _click: https://click.palletsprojects.com 31 | .. _autocompletion: https://click.palletsprojects.com/bashcomplete 32 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_adapters.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | adapters 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This is a command group under the main :doc:`root` that has commands for getting 9 | metadata for adapters. 10 | 11 | Sub Command Groups 12 | =============================================== 13 | 14 | This command group has the following sub command groups: 15 | 16 | * :doc:`grp_cnx` has commands to work with adapter connections. 17 | 18 | Commands 19 | =============================================== 20 | 21 | * :doc:`grp_adapters_cmds/cmd_get` to get metadata for adapters and filter based on 22 | a number of different attributes. 23 | 24 | Help Page 25 | =============================================== 26 | 27 | .. click:: axonius_api_client.cli.grp_adapters:adapters 28 | :prog: axonshell adapters 29 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_adapters_cmds/cmd_get.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | adapters get 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command allows you to get metadata of adapters and their connections. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | 16 | Examples 17 | =============================================== 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | cmd_get_examples/ex* 24 | 25 | Help Page 26 | =============================================== 27 | 28 | .. click:: axonius_api_client.cli.grp_adapters.cmd_get:cmd 29 | :prog: axonshell adapters get 30 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_adapters_cmds/cmd_get_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | No filters, json and json-full exports 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | .. code:: shell 9 | 10 | $ # export as STR (the default) to STDOUT 11 | $ axonshell adapters get 12 | 13 | $ # export as JSON to a file 14 | $ axonshell adapters get --export-format json > adapters.json 15 | 16 | $ # export as JSON-FULL to a file to show additional details 17 | $ axonshell adapters get --export-format json-full > adapters.json 18 | 19 | .. raw:: html 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_count.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users count 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will get the count of assets that a query would return for users or devices 9 | and could be used as part of a script to do something based on the number returned. 10 | 11 | Common Options 12 | =============================================== 13 | 14 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 15 | * There are no export options for this command since it only returns a number. 16 | 17 | Examples 18 | =============================================== 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | :glob: 23 | 24 | cmd_count_examples/ex* 25 | 26 | Help Page 27 | =============================================== 28 | 29 | .. click:: axonius_api_client.cli.grp_assets.cmd_count:cmd 30 | :prog: axonshell users/devices count 31 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_count_by_saved_query_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Invalid Name 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Since the saved query name is invalid, an error will be thrown listing all of the 11 | valid saved queries for device assets. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices count-by-saved-query --name invalid_name 16 | 17 | .. raw:: html 18 | 19 | 20 | 21 | .. include:: notes.rst 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_count_by_saved_query_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Valid Name 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Return the count of assets for the saved query ``SSH Open To Entire Internet``. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices count-by-saved-query --name "SSH Open To Entire Internet" 15 | 16 | .. raw:: html 17 | 18 | 19 | 20 | .. include:: notes.rst 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_count_by_saved_query_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices count-by-saved-query`` and the 9 | ``users count-by-saved-query`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_count_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | With No Query 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Since no query supplied, this will return the count of ALL device assets. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices count 15 | 16 | .. raw:: html 17 | 18 | 19 | 20 | .. include:: notes.rst 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_count_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | With Query 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Since a query is supplied, this will only return the count of device assets that match the query. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices count --query '(specific_data.data.last_seen >= date("NOW - 3d"))' 15 | 16 | .. raw:: html 17 | 18 | 19 | 20 | .. include:: notes.rst 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_count_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | With Query Using File 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Since a query is supplied, this will only return the count of device assets that match the query. 11 | * To avoid dealing with nested quoting and escapes in shells, we store the query in a 12 | file and supply that to --query-file. 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices count --query-file query.txt 17 | 18 | .. raw:: html 19 | 20 | 21 | 22 | .. include:: notes.rst 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_count_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices count`` and ``users count`` commands. 9 | 10 | .. note:: 11 | 12 | If --query-file is supplied, it will override --query if that is also supplied. 13 | 14 | .. seealso:: 15 | 16 | :ref:`shellhell` for how to deal with quoting the --query value in various shells. 17 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_by_id.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users get-by-id 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will get ALL data for a single asset. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | 15 | Examples 16 | =============================================== 17 | 18 | .. toctree:: 19 | :maxdepth: 1 20 | :glob: 21 | 22 | cmd_get_by_id_examples/ex* 23 | 24 | Help Page 25 | =============================================== 26 | 27 | .. click:: axonius_api_client.cli.grp_assets.cmd_get_by_id:cmd 28 | :prog: axonshell devices/users get-by-id 29 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_by_id_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Show Default Fields 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Return a list of default fields returned for device queries. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices get-fields-default 15 | 16 | .. raw:: html 17 | 18 | 19 | 20 | .. include:: notes.rst 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_by_id_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices get-by-id`` and ``users 9 | get-by-id`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_by_saved_query_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Invalid Name 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Since the saved query name is invalid, an error will be thrown listing all of the 11 | valid saved queries for device assets. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get-by-saved-query --name invalid_name 16 | 17 | .. raw:: html 18 | 19 | 20 | 21 | .. include:: notes.rst 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_by_saved_query_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Valid Name 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Return the assets of the query and the fields defined in the saved query 11 | ``SSH Open To entire Internet``. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get-by-saved-query \ 16 | --name "SSH Open To entire Internet" \ 17 | --max-rows 2 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | .. include:: notes.rst 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_by_saved_query_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices get-by-saved-query`` 9 | and ``users get-by-saved-query`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | With No Query 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Since no query supplied, this will return ALL device assets. 11 | * This will get device assets and limit to a maximum return of 4. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get --max-rows 4 16 | 17 | .. raw:: html 18 | 19 | 20 | 21 | .. include:: notes.rst 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | With Query 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Since a query is supplied, this will only return device assets that match the query. 11 | * Get device assets and include the generic field ``os.type``. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get \ 16 | --query '(specific_data.data.last_seen >= date("NOW - 3d")) and (specific_data.data.os.type == "Windows")' \ 17 | --field os.type --max-rows 4 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | .. include:: notes.rst 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | With Query Using File 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Since a query is supplied, this will only return device assets that match the query. 11 | * To avoid dealing with nested quoting and escapes in shells, we store the query in a 12 | file and supply that to --query-file. 13 | * Get device assets and include the generic field ``os.type``. 14 | 15 | .. code:: shell 16 | 17 | $ axonshell devices get --query-file query.txt --field os.type --max-rows 4 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | .. include:: notes.rst 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices get`` and ``users get`` commands. 9 | 10 | .. note:: 11 | 12 | When using CSV export, if a cells length goes beyond 32,000 characters it will 13 | be trimmed to 30,000 and the following text will be added at the end of the cell: 14 | ``...TRIMMED - 500 items over max cell length 30000`` 15 | 16 | .. note:: 17 | 18 | If --query-file is supplied, it will override --query if that is also supplied. 19 | 20 | .. seealso:: 21 | 22 | :ref:`shellhell` for how to deal with quoting the --query value in various shells. 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users get-fields 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will produce a report of all fields for users or devices. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | 16 | Examples 17 | =============================================== 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | cmd_get_fields_examples/ex* 24 | 25 | Help Page 26 | =============================================== 27 | 28 | .. click:: axonius_api_client.cli.grp_assets.cmd_get_fields:cmd 29 | :prog: axonshell devices/users get-fields 30 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields_default.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users get-fields-default 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will produce a report of the default fields (columns) for users or devices. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | 16 | Examples 17 | =============================================== 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | cmd_get_fields_default_examples/ex* 24 | 25 | Help Page 26 | =============================================== 27 | 28 | .. click:: axonius_api_client.cli.grp_assets.cmd_get_fields_default:cmd 29 | :prog: axonshell devices/users get-fields-default 30 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields_default_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Get ALL device data by ID 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Return all known data for a device 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices get-by-id 15 | 16 | .. raw:: html 17 | 18 | 19 | 20 | .. include:: notes.rst 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields_default_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices get-fields-default`` and ``users 9 | get-fields-default`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | All Adapters And All Fields 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Return a list where the keys are the adapter names and the values are 11 | valid fields for the adapter. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices get-fields 16 | 17 | .. raw:: html 18 | 19 | 20 | 21 | .. include:: notes.rst 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Adapter Regex Filter And All Fields 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Return a list where the keys are the adapter names and the values are 11 | valid fields for the adapter. 12 | * Only return adapters that match the regular expression ``aws``. 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices get-fields --adapter-re aws 17 | 18 | .. raw:: html 19 | 20 | 21 | 22 | .. include:: notes.rst 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Adapter Regex Filter And Fields Regex Filter 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Return a list where the keys are the adapter names and the values are 11 | valid fields for the adapter. 12 | * Only return adapters that match the regular expression ``aws`` and fields that match 13 | the regular expression ``ip``. 14 | 15 | .. code:: shell 16 | 17 | $ axonshell devices get-fields --adapter-re aws --field-re ip 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | .. include:: notes.rst 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields_examples/ex4.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | All Adapters And Fields Regex Filter 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Return a dictionary of where the keys are the adapter names and the values are a list 11 | of valid fields for the adapter. 12 | * Only return adapters fields that match the regular expression ``last`` for all adapters. 13 | 14 | .. code:: shell 15 | 16 | $ axonshell devices get-fields --field-re last 17 | 18 | .. raw:: html 19 | 20 | 21 | 22 | .. include:: notes.rst 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_fields_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices get-fields`` and ``users 9 | get-fields`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_tags.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users get-tags 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This allows you to get all of the current tags in the system for devices or users. 9 | 10 | .. seealso:: 11 | 12 | :ref:`tagging_example` for how to tag and untag based on saved queries. 13 | 14 | Common Options 15 | =============================================== 16 | 17 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 18 | * There are no export options for this command since it only a simple list of known labels. 19 | 20 | Examples 21 | =============================================== 22 | 23 | .. toctree:: 24 | :maxdepth: 1 25 | :glob: 26 | 27 | cmd_get_tags_examples/ex* 28 | 29 | Help Page 30 | =============================================== 31 | 32 | .. click:: axonius_api_client.cli.grp_assets.cmd_get_tags:cmd 33 | :prog: axonshell devices/users get-tags 34 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_tags_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Show Current Known Tags 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * This will return all current known tags in the system for devices or users 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices get-tags 15 | 16 | .. raw:: html 17 | 18 | 19 | 20 | .. include:: notes.rst 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_cmds/cmd_get_tags_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices get-tags`` and ``users 9 | get-tags`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_add_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices saved-query add`` and 9 | ``users saved-query add`` commands. 10 | 11 | .. note:: 12 | 13 | Creating a saved query this way does not build the expressions that are used 14 | by the Query Wizard in the GUI, so you will not be able to use the Query Wizard 15 | to modify saved queries created by this command. 16 | 17 | .. note:: 18 | 19 | The only required option is -n / --name, but all of the other options can control 20 | the creation of the saved query in multiple ways and you probably want to at least 21 | supply -q / --query. 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_delete_by_name.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users saved-query delete-by-name 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will delete a saved query by name for users or devices. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | 16 | Examples 17 | =============================================== 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | cmd_delete_examples/ex* 24 | 25 | Help Page 26 | =============================================== 27 | 28 | .. click:: axonius_api_client.cli.grp_assets.grp_saved_query.cmd_delete_by_name:cmd 29 | :prog: axonshell devices/users saved-query delete-by-name 30 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_delete_by_tags.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users saved-query delete-by-tags 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will delete a saved query by tags for users or devices. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | 16 | Examples 17 | =============================================== 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | cmd_delete_by_tags_examples/ex* 24 | 25 | Help Page 26 | =============================================== 27 | 28 | .. click:: axonius_api_client.cli.grp_assets.grp_saved_query.cmd_delete_by_tags:cmd 29 | :prog: axonshell devices/users saved-query delete-by-tags 30 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_delete_by_tags_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Invalid Names 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Throws an error listing all of the valid saved query names as the supplied names 11 | do not exist. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices saved-query delete \ 16 | --name nosuchname \ 17 | --name otherinvalidname 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_delete_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Invalid Names 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Throws an error listing all of the valid saved query names as the supplied names 11 | do not exist. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices saved-query delete \ 16 | --name nosuchname \ 17 | --name otherinvalidname 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | .. include:: notes.rst 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_delete_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Valid Names 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Deletes two saved queries after waiting 5 seconds (instead of the default of 30 seconds). 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices saved-query delete \ 15 | --name "last seen in 2 days" \ 16 | --name "bloop" \ 17 | --wait 5 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | .. include:: notes.rst 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_delete_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices saved-query delete`` and 9 | ``users saved-query delete`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users saved-query get 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will get all saved queries for users or devices. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | 16 | Examples 17 | =============================================== 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | cmd_get_examples/ex* 24 | 25 | Help Page 26 | =============================================== 27 | 28 | .. click:: axonius_api_client.cli.grp_assets.grp_saved_query.cmd_get:cmd 29 | :prog: axonshell devices/users saved-query get 30 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get_by_name.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices/users saved-query get-by-name 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will get a saved query by name for users or devices. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | 16 | Examples 17 | =============================================== 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | cmd_get_by_name_examples/ex* 24 | 25 | Help Page 26 | =============================================== 27 | 28 | .. click:: axonius_api_client.cli.grp_assets.grp_saved_query.cmd_get_by_name:cmd 29 | :prog: axonshell devices/users saved-query get-by-name 30 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get_by_name_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Invalid Name 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Throws an error listing all of the valid saved query names as the supplied names 11 | do not exist. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell devices saved-query get-by-name \ 16 | --value "nosuchname" \ 17 | --export-file saved_query.json \ 18 | --export-overwrite 19 | 20 | .. raw:: html 21 | 22 | 23 | 24 | .. include:: notes.rst 25 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get_by_name_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Valid Name 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Gets a single saved query by name. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices saved-query get-by-name \ 15 | --value "Unmanaged Devices" \ 16 | --export-file saved_query.json \ 17 | --export-overwrite 18 | 19 | .. raw:: html 20 | 21 | 22 | 23 | .. include:: notes.rst 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get_by_name_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Multiple using Regular Expressions 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Gets multiple saved queries that match a regular expression. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices saved-query get-by-name \ 15 | --value "[y-z]" \ 16 | --value-regex \ 17 | --export-file saved_query.json \ 18 | --export-overwrite 19 | 20 | .. raw:: html 21 | 22 | 23 | 24 | .. include:: notes.rst 25 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get_by_name_examples/ex4.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Multiple using NOT 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Gets multiple saved queries that do NOT match a set of regular expression. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices saved-query get-by-name \ 15 | --value "[y-z]" \ 16 | --value "[m-n]" \ 17 | --value-regex \ 18 | --value-not \ 19 | --export-file saved_query.json \ 20 | --export-overwrite 21 | 22 | .. raw:: html 23 | 24 | 25 | 26 | .. include:: notes.rst 27 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get_by_name_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices saved-query get-by-name`` and 9 | ``users saved-query get-by-name`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Get All 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Gets all saved queries for device assets. 11 | 12 | .. code:: shell 13 | 14 | $ axonshell devices saved-query get \ 15 | --export-file saved_query.json \ 16 | --export-overwrite 17 | 18 | .. raw:: html 19 | 20 | 21 | 22 | .. include:: notes.rst 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_get_examples/notes.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices saved-query get`` and 9 | ``users saved-query get`` commands. 10 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_assets_saved_query_cmds/cmd_remove_examples: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Notes 4 | ========================================== 5 | 6 | .. note:: 7 | 8 | This example works the same for both the ``devices get`` and ``users get`` commands. 9 | 10 | .. note:: 11 | 12 | When using CSV export, if a cells length goes beyond 32,000 characters it will 13 | be trimmed to 30,000 and the following text will be added at the end of the cell: 14 | ``...TRIMMED - 500 items over max cell length 30000`` 15 | 16 | .. note:: 17 | 18 | If --query-file is supplied, it will override --query if that is also supplied. 19 | 20 | .. seealso:: 21 | 22 | :ref:`shellhell` for how to deal with quoting the --query value in various shells. 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_add.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | adapters cnx add 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will add a new connection for an adapter on a node. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | 16 | Examples 17 | =============================================== 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | cmd_add_examples/ex* 24 | 25 | Help Page 26 | =============================================== 27 | 28 | .. click:: axonius_api_client.cli.grp_adapters.grp_cnx.cmd_add:cmd 29 | :prog: axonshell adapters cnx add 30 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_add_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Prompt for settings 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | If you don't supply any configuration items on the command line, this command 9 | will prompt for the value of each setting for connections of the supplied adapter. 10 | 11 | This example adds a new connection for the CSV adapter. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell adapters cnx add --adapter csv --export-file cnxadded.json 16 | 17 | .. raw:: html 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_add_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Show the settings needed for a connection in text format 4 | ######################################################## 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This can be used to show the connection settings needed so you can build a command line 9 | that contains all the necessary settings using ``--config setting_name=setting_value`` 10 | 11 | .. code:: shell 12 | 13 | $ axonshell adapters cnx add --adapter csv --show-config text 14 | 15 | .. raw:: html 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_add_examples/ex4.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Show the settings needed for a connection in json format 4 | ######################################################## 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This can be used to show the connection settings needed so you can build a command line 9 | that contains all the necessary settings using ``--config setting_name=setting_value`` 10 | 11 | .. code:: shell 12 | 13 | $ axonshell adapters cnx add --adapter csv --show-config json 14 | 15 | .. raw:: html 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_add_from_json.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | adapters cnx add-from-json 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will add a perform a connectivity test for a connection for an adapter on 9 | a node. 10 | 11 | Common Options 12 | =============================================== 13 | 14 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 15 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 16 | 17 | Examples 18 | =============================================== 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | :glob: 23 | 24 | cmd_add_from_json_examples/ex* 25 | 26 | Help Page 27 | =============================================== 28 | 29 | .. click:: axonius_api_client.cli.grp_adapters.grp_cnx.cmd_add_from_json:cmd 30 | :prog: axonshell adapters cnx add-from-json 31 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_add_from_json_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Check only working connections for an adapter 4 | ################################################## 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get the AWS adapter on the master node 11 | * Get only the working connections from the AWS adapter metadata 12 | * Check that the working connections can reach their endpoints. 13 | 14 | .. code:: shell 15 | 16 | $ axonshell adapters get --name aws | \ 17 | axonshell adapters cnx get --no-broken | \ 18 | axonshell adapters cnx check -xf check.json 19 | 20 | .. raw:: html 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_add_from_json_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Check all connections for an adapter 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get the AWS adapter on the master node 11 | * Check all of the connections listed in the AWS adapter metadata but do not 12 | stop when a connection test fails. 13 | 14 | .. code:: shell 15 | 16 | $ axonshell adapters get --name aws | \ 17 | axonshell adapters cnx check --no-error -xf check.json 18 | 19 | .. raw:: html 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_delete_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Delete with no options 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This will throw an error because we didn't supply --force. 9 | 10 | .. code:: shell 11 | 12 | $ # add a csv connection that we can delete 13 | $ axonshell a c a -a csv -c user_id=dvcs_from_axonshell -c csv=/demo/dvc.csv -npo 14 | 15 | $ axonshell adapters get --name csv | \ 16 | axonshell adapters cnx get --id dvcs_from_axonshell | \ 17 | axonshell adapters cnx delete 18 | 19 | .. raw:: html 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_delete_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Delete with --force 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This will delete a connection in --wait seconds (30 by default). 9 | 10 | .. code:: shell 11 | 12 | $ # add a csv connection that we can delete 13 | $ axonshell a c a -a csv -c user_id=dvcs_from_axonshell -c csv=/demo/dvc.csv -npo 14 | 15 | $ axonshell adapters get --name csv | \ 16 | axonshell adapters cnx get --id dvcs_from_axonshell | \ 17 | axonshell adapters cnx delete --force 18 | 19 | .. raw:: html 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_delete_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Delete with --force --wait 0 --delete-entities 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This will delete a connection and all of its associated entities in 0 seconds. 9 | 10 | .. code:: shell 11 | 12 | $ # add a csv connection that we can delete 13 | $ axonshell a c a -a csv -c user_id=dvcs_from_axonshell -c csv=/demo/dvc.csv -npo 14 | 15 | $ axonshell adapters get --name csv | \ 16 | axonshell adapters cnx get --id dvcs_from_axonshell | \ 17 | axonshell adapters cnx delete --force --wait 0 --delete-entities 18 | 19 | .. raw:: html 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_get.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | adapters cnx get 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command is used to extract the metadata for connections from the output of 9 | the `adapters get` command and optionally filter the connections based on status or id. 10 | 11 | Common Options 12 | =============================================== 13 | 14 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 15 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 16 | 17 | Examples 18 | =============================================== 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | :glob: 23 | 24 | cmd_get_examples/ex* 25 | 26 | Help Page 27 | =============================================== 28 | 29 | .. click:: axonius_api_client.cli.grp_adapters.grp_cnx.cmd_get:cmd 30 | :prog: axonshell adapters cnx get 31 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_get_by_id.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | adapters cnx get-by-id 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command is used to extract the metadata for connections from the output of 9 | the `adapters get` command and optionally filter the connections based on status or id. 10 | 11 | Common Options 12 | =============================================== 13 | 14 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 15 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 16 | 17 | Examples 18 | =============================================== 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | :glob: 23 | 24 | cmd_get_by_id_examples/ex* 25 | 26 | Help Page 27 | =============================================== 28 | 29 | .. click:: axonius_api_client.cli.grp_adapters.grp_cnx.cmd_get_by_id:cmd 30 | :prog: axonshell adapters cnx get-by-id 31 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_get_by_id_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | All adapters: all connections 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get all of the adapters. 11 | * Get all of the connections for all of the adapters. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell adapters get | \ 16 | axonshell adapters cnx get > cnxs.json 17 | 18 | $ # count the number of connections 19 | $ cat cnxs.json | jq '. | length' 20 | 21 | .. raw:: html 22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_get_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | All adapters: all connections 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get all of the adapters. 11 | * Get all of the connections for all of the adapters. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell adapters get | \ 16 | axonshell adapters cnx get > cnxs.json 17 | 18 | $ # count the number of connections 19 | $ cat cnxs.json | jq '. | length' 20 | 21 | .. raw:: html 22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_get_examples/ex2.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | All adapters: single connection by invalid ID 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get all of the adapters. 11 | * Try to find an connection with an invalid ID, which will throw 12 | an error showing all of the valid ID's for all of the connections across all of 13 | the adapters. 14 | 15 | .. code:: shell 16 | 17 | $ axonshell adapters get | \ 18 | axonshell adapters cnx get --id foxtrot_tango 19 | 20 | .. raw:: html 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_get_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | All adapters: all working connections 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get all of the adapters. 11 | * Filter out the list of connections to only include those that are working. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell adapters get | \ 16 | axonshell adapters cnx get --no-broken 17 | 18 | .. raw:: html 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_get_examples/ex4.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | All adapters: all broken connections 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get all of the adapters. 11 | * Filter out the list of connections to only include those that are broken. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell adapters get | \ 16 | axonshell adapters cnx get --no-working 17 | 18 | .. raw:: html 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_get_examples/ex5.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Single adapter: single connection by valid ID 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get the Active Directory adapter. 11 | * Get a single connection with a valid ID. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell adapters get --name active_directory | \ 16 | axonshell adapters cnx get --id TestDomain.test 17 | 18 | .. raw:: html 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_test.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | adapters cnx test 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will trigger a test (aka fetch) for a connection of an adapter on a node. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | * :ref:`rows_option` for examples of working with input feeds. 16 | 17 | Examples 18 | =============================================== 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | :glob: 23 | 24 | cmd_test_examples/ex* 25 | 26 | Help Page 27 | =============================================== 28 | 29 | .. click:: axonius_api_client.cli.grp_adapters.grp_cnx.cmd_test:cmd 30 | :prog: axonshell adapters cnx test 31 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_test_by_id.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | adapters cnx test-by-id 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command will trigger a test_by_id (aka fetch) for a connection of an adapter on a node. 9 | 10 | Common Options 11 | =============================================== 12 | 13 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 14 | * :ref:`export_options` for examples of exporting data in different formats and outputs. 15 | * :ref:`rows_option` for examples of working with input feeds. 16 | 17 | Examples 18 | =============================================== 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | :glob: 23 | 24 | cmd_test_by_id_examples/ex* 25 | 26 | Help Page 27 | =============================================== 28 | 29 | .. click:: axonius_api_client.cli.grp_adapters.grp_cnx.cmd_test_by_id:cmd 30 | :prog: axonshell adapters cnx test-by-id 31 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_test_by_id_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | All adapters: all connections 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Get all of the adapters. 11 | * Get all of the connections for all of the adapters. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell adapters get | \ 16 | axonshell adapters cnx get > cnxs.json 17 | 18 | $ # count the number of connections 19 | $ cat cnxs.json | jq '. | length' 20 | 21 | .. raw:: html 22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_test_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Discover all connections on an adapter 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | .. code:: shell 9 | 10 | $ axonshell adapters get --name aws | \ 11 | axonshell adapters cnx discover --no-error 12 | 13 | .. raw:: html 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_cnx_cmds/cmd_test_examples/ex3.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Discover a single connection on an adapter 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | .. code:: shell 9 | 10 | $ axonshell adapters get --name aws | \ 11 | axonshell adapters cnx get --id xxx-east-2 | \ 12 | axonshell adapters cnx discover --no-error 13 | 14 | .. raw:: html 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_devices_saved_query.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | devices saved_query 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This is a sub-command group under :doc:`grp_devices` that has commands 9 | to add, delete, or get saved queries for device assets. 10 | 11 | Commands 12 | =============================================== 13 | 14 | * :doc:`grp_assets_saved_query_cmds/cmd_add` to add a saved query. 15 | * :doc:`grp_assets_saved_query_cmds/cmd_delete_by_name` to delete a saved query by name. 16 | * :doc:`grp_assets_saved_query_cmds/cmd_delete_by_tags` to delete saved queries by tags. 17 | * :doc:`grp_assets_saved_query_cmds/cmd_get` to get all saved queries. 18 | * :doc:`grp_assets_saved_query_cmds/cmd_get_by_name` to get a saved query by name. 19 | 20 | Help Page 21 | =============================================== 22 | 23 | .. click:: axonius_api_client.cli.grp_assets.grp_saved_query:saved_query 24 | :prog: axonshell devices saved_query 25 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_tools.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | tools 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This is a command group under the main :doc:`root` that has commands for 9 | starting a python interactive shell and writing a .env configuration file with 10 | the credentials and URL for connecting to Axonius. 11 | 12 | Commands 13 | =============================================== 14 | 15 | * :doc:`grp_tools_cmds/cmd_shell` to start a python interactive shell. 16 | * :doc:`grp_tools_cmds/cmd_write_config` to write a .env file with the credentials 17 | and URL for connecting to Axonius. 18 | 19 | Help Page 20 | =============================================== 21 | 22 | .. click:: axonius_api_client.cli.grp_tools:tools 23 | :prog: axonshell tools 24 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_tools_cmds/cmd_shell.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | tools shell 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This command launches a python interactive shell session. 9 | 10 | The python session will establish a connection to the Axonius instance as a 11 | ``client`` object and instantiate the API objects for 12 | ``devices``, ``users``, and ``adapters``. 13 | 14 | Common Options 15 | =============================================== 16 | 17 | * :ref:`connection_options` for examples of supplying the Axonius credentials and URL. 18 | 19 | Examples 20 | =============================================== 21 | 22 | .. toctree:: 23 | :maxdepth: 1 24 | :glob: 25 | 26 | cmd_shell_examples/ex* 27 | 28 | Help Page 29 | =============================================== 30 | 31 | .. click:: axonius_api_client.cli.grp_tools.cmd_shell:cmd 32 | :prog: axonshell tools shell 33 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_tools_cmds/cmd_shell_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Use interactive python interpreter 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This does the following: 9 | 10 | * Starts the python interpreter. 11 | * Shows how to use some of API client methods. 12 | 13 | .. code:: shell 14 | 15 | $ axonshell tools shell 16 | 17 | .. raw:: html 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_tools_cmds/cmd_write_config.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | .. _tools_write_config: 4 | 5 | tools write-config 6 | ############################################### 7 | 8 | .. include:: /main/deprecation_banner.rst 9 | 10 | This command will prompt for the :ref:`connection_options`, test if the supplied values connect properly, then write the variables to a .env file in the current 11 | working directory. 12 | 13 | Examples 14 | =============================================== 15 | 16 | .. toctree:: 17 | :maxdepth: 1 18 | :glob: 19 | 20 | cmd_write_config_examples/ex* 21 | 22 | Help Page 23 | =============================================== 24 | 25 | .. click:: axonius_api_client.cli.grp_tools.cmd_write_config:cmd 26 | :prog: axonshell tools write-config 27 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_tools_cmds/cmd_write_config_examples/ex1.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | Prompt for connection info, test connection, write .env file 4 | ############################################################ 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | .. raw:: html 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/main/usage_cli/grp_users_saved_query.rst: -------------------------------------------------------------------------------- 1 | .. include:: /main/.special.rst 2 | 3 | users saved_query 4 | ############################################### 5 | 6 | .. include:: /main/deprecation_banner.rst 7 | 8 | This is a sub-command group under :doc:`grp_users` that has commands 9 | to add, delete, or get saved queries for user assets. 10 | 11 | Commands 12 | =============================================== 13 | 14 | * :doc:`grp_assets_saved_query_cmds/cmd_add` to add a saved query. 15 | * :doc:`grp_assets_saved_query_cmds/cmd_delete_by_name` to delete a saved query by name. 16 | * :doc:`grp_assets_saved_query_cmds/cmd_delete_by_tags` to delete saved queries by tags. 17 | * :doc:`grp_assets_saved_query_cmds/cmd_get` to get all saved queries. 18 | * :doc:`grp_assets_saved_query_cmds/cmd_get_by_name` to get a saved query by name. 19 | 20 | 21 | Help Page 22 | =============================================== 23 | 24 | .. click:: axonius_api_client.cli.grp_assets.grp_saved_query:saved_query 25 | :prog: axonshell users saved_query 26 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | Sphinx>=3.2.1 2 | docutils 3 | sphinx-click 4 | sphinx-rtd-theme 5 | sphinx-autodoc-typehints 6 | -------------------------------------------------------------------------------- /get_version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """Package setup.""" 4 | import codecs 5 | import os 6 | 7 | PROJECT = "axonius_api_client" 8 | HERE = os.path.abspath(os.path.dirname(__file__)) 9 | VERSION_PATH = os.path.join(HERE, PROJECT, "version.py") 10 | 11 | 12 | ABOUT = {} 13 | with codecs.open(VERSION_PATH, "r", "utf-8") as fh: 14 | CONTENTS = "\n".join(a for a in fh.readlines() if not a.startswith("#")) 15 | exec(CONTENTS, ABOUT) 16 | 17 | print(ABOUT["__version__"], end="") 18 | -------------------------------------------------------------------------------- /requirements-build.txt: -------------------------------------------------------------------------------- 1 | twine 2 | wheel 3 | readme-renderer[md] 4 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | # codecov 2 | pytest 3 | pytest-cov 4 | flaky 5 | coverage 6 | -------------------------------------------------------------------------------- /requirements-lint.txt: -------------------------------------------------------------------------------- 1 | black 2 | ruff 3 | -------------------------------------------------------------------------------- /requirements-pkg.txt: -------------------------------------------------------------------------------- 1 | pip 2 | wheel 3 | disttools 4 | pipenv 5 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests[security,socks]>=2.23.0 2 | python-dotenv>=0.12.0 3 | python-dateutil>=2.8.1 4 | click>=7.1.1 5 | pyreadline3>=3.4.1 ; platform_system == "Windows" 6 | tabulate>=0.8.7 7 | xlsxwriter>=1.3.1 8 | cachetools>=4.1.1 9 | fuzzyfinder>=2.1.0 10 | xmltodict>=0.12.0 11 | dataclasses ; python_version < '3.7' 12 | marshmallow>=3.10.0,<=3.23.0 13 | marshmallow-jsonapi>=0.24.0 14 | dataclasses-json>=0.5.2 15 | pyOpenSSL>=21.0.0 16 | asn1crypto>=1.4.0 17 | bson>=0.5.0 18 | # TODO: security implication, need to update cert_human and http.Http 19 | # urllib3 v2 requires python 3.7 or later, so that will be a breaking change 20 | urllib3<2 -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal = 1 3 | 4 | [metadata] 5 | license_file = LICENSE 6 | -------------------------------------------------------------------------------- /shell.py: -------------------------------------------------------------------------------- 1 | axonius_api_client/examples/script_base.py --------------------------------------------------------------------------------