qualysclient.QualysClient

class QualysClient(username=None, password=None)

Bases: object

a simple client for interacting with the Qualys API

Methods

add_ips

Add IP addresses to the user's subscription.

cancel_running_report

Cancel a running report in the user’s account.

compliance_control_list

compliance_exception_delete

compliance_exception_list

compliance_exception_request

compliance_exception_update

compliance_policy_add_asset_group_ids

compliance_policy_add_asset_groups

compliance_policy_export

Export compliance policies from your account to an XML file.

compliance_policy_import

compliance_policy_list

compliance_policy_merge

compliance_policy_set_asset_group_ids

compliance_posture_list

download_saved_report

Download a saved report in the user’s account

excluded_host_change_history

excluded_host_list

host_list

host_list_detection

launch_report

Launch a report in the user's account.

launch_scorecard

Launch a vulnerability scorecard report in the user’s Report Share.

list_ip

List IP addresses in the user account.

list_reports

View a list of reports in the user’s account when Report Share feature is enabled.

login

Authenticate to Qualys API

logout

Log out of authenticated sessionn

update_ips

Update IP addresses in the user's subscription.

add_ips(**kwargs) requests.models.Response

Add IP addresses to the user’s subscription.

Once added they are available for scanning and reporting.

Returns

Response – Qualys API response contained within request.Response object

cancel_running_report(id: int, **kwargs) requests.models.Response

Cancel a running report in the user’s account.

Parameters

id (int) – Specifies the report ID of a running report that you want to cancel. The status of the report must be “running”.

Raises

ParameterValidationError – When Parameter Validation fails

Returns

Response – Qualys API response contained within request.Response object

compliance_policy_export(id: int, **kwargs) requests.models.Response

Export compliance policies from your account to an XML file.

Service provided controls are exported and you can choose to also export user defined controls. The output also includes an appendix with human readable look-ups for control descriptions, giving you explanation on the various aspects of control description and evaluation.

Parameters

id (int) – The ID of the policy you want to export

Returns

Response

download_saved_report(id: int, **kwargs) requests.models.Response

Download a saved report in the user’s account

You can download all report types (map, scan, patch, authentication, scorecard, remediation, compliance). This option is available when the Report Share feature is enabled in the user’s subscription.

Parameters

id (int) – (Required) Specifies the report ID of a saved report that you want to download. The status of the report must be “finished”

Returns

Response – Qualys API response contained within request.Response object

launch_report(template_id: int, **kwargs) requests.models.Response

Launch a report in the user’s account. Launch a report in the user’s account. The Report Share feature must be enabled in the user’s subscription. When a report is launched with Report Share, the report is run in the background, and the report generation processing does not timeout until the report has completed.

Parameters

template_id (int) – (Required) The template ID of the report you want to launch.

Returns

Response – Qualys API response contained within request.Response object

launch_scorecard(name: str, **kwargs) requests.models.Response

Launch a vulnerability scorecard report in the user’s Report Share.

Launch a vulnerability scorecard report in the user’s Report Share. It is not possible to launch any compliance scorecard reports or WAS scorecard reports using this API at this time. When a scorecard report is launched, the report is run in the background, and the report generation processing does not timeout until the report has completed.

Parameters

name (str) –

(Required) Specifies the scorecard name for the vulnerability scorecard report that you want to launch. This name corresponds to a service-provided scorecard or a user-created scorecard. For a service-provided scorecard, specify one of these names:

  • Asset Group Vulnerability Report

  • Ignored Vulnerabilities Report

  • Most Prevalent Vulnerabilities Report

  • Most Vulnerable Hosts Report

  • Patch Report

Returns

Response – Qualys API response contained within request.Response object

list_ip(**kwargs) requests.models.Response

List IP addresses in the user account. By default, all hosts in the user account are included.

Optional input parameters support filtering the list by IP addresses and host tracking method.

Returns

Response – Qualys API response contained within request.Response object

list_reports(**kwargs) requests.models.Response

View a list of reports in the user’s account when Report Share feature is enabled.

The report list output includes all report types, including scorecard reports.

Parameters

**kwargs – supported keywords documented within the Qualys VM/PC API user guide

Returns

Response – Qualys API response contained within request.Response object

login(username, password)

Authenticate to Qualys API

Parameters
  • username (str) – Qualys Username

  • password (str) – Qualys Password

logout()

Log out of authenticated sessionn

update_ips(ips: str, **kwargs) requests.models.Response

Update IP addresses in the user’s subscription.

Parameters

ips (str) – (Required) The hosts within the subscription you want to update. IPs must be specified by using the “ips” parameter (using the POST method)

Returns

Response – Qualys API response contained within request.Response object

Example

ips=10.10.10.200,10.10.23.40