Skip to main content

qualysapi

Build Status Coverage Status

Python package, qualysapi, that makes calling any Qualys API very simple. Qualys API versions v1, v2, & WAS & AM (asset management) are all supported.

My focus was making the API super easy to use. The only parameters the user needs to provide is the call, and data (optional). It automates the following:

  • Automatically identifies API version through the call requested.
  • Automatically identifies url from the above step.
  • Automatically identifies http method as POST or GET for the request per Qualys documentation.

Usage

Check out the example scripts in the /examples directory.

Connect

There are currenty three methods of connecting to Qualys APIs

  • qualysapi.connect() will prompt the user for credentials at runtime.
  • qualysapi.connect('/path/to/config.ini') will parse the config file for credentials (see below).
  • qualysapi.connect(username='username', password='password') will use the provided credentials.

Example

Detailed example found at qualysapi-example.py.

Sample example below.

>>> import qualysapi
>>> a = qualysapi.connect()
QualysGuard Username: my_username
QualysGuard Password:
>>> print a.request('about.php')
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ABOUT SYSTEM "https://qualysapi.qualys.com/about.dtd">
<ABOUT>
  <API-VERSION MAJOR="1" MINOR="4" />
  <WEB-VERSION>7.10.61-1</WEB-VERSION>
  <SCANNER-VERSION>7.1.10-1</SCANNER-VERSION>
  <VULNSIGS-VERSION>2.2.475-2</VULNSIGS-VERSION>
</ABOUT>
<!-- Generated for username="my_username" date="2013-07-03T10:31:57Z" -->
<!-- CONFIDENTIAL AND PROPRIETARY INFORMATION. Qualys provides the QualysGuard Service "As Is," without any warranty of any kind. Qualys makes no warranty that the information contained in this report is complete or error-free. Copyright 2013, Qualys, Inc. //-->

Installation

Use pip to install:

pip install qualysapi

NOTE: If you would like to experiment without installing globally, look into 'virtualenv'.

Requirements

Configuration

By default, the package will ask at the command prompt for username and password. By default, the package connects to the Qualys documented host (qualysapi.qualys.com).

You can override these settings and prevent yourself from typing credentials by doing any of the following:

  1. By running the following Python, qualysapi.connect(remember_me=True). This automatically generates a .qcrc file in your current working directory, scoping the configuration to that directory.
  2. By running the following Python, qualysapi.connect(remember_me_always=True). This automatically generates a .qcrc file in your home directory, scoping the configuratoin to all calls to qualysapi, regardless of the directory.
  3. By creating a file called '.qcrc' (for Windows, the default filename is 'config.ini') in your home directory or directory of the Python script.
  4. This supports multiple configuration files. Just add the filename in your call to qualysapi.connect('config.txt').

Example config file

; Note, it should be possible to omit any of these entries.

[info]
hostname = qualysapi.serviceprovider.com
username = jerry
password = I<3Elaine

# Set the maximum number of retries each connection should attempt. Note, this applies only to failed connections and timeouts, never to requests where the server returns a response.
max_retries = 10

[proxy]
; This section is optional. Leave it out if you're not using a proxy.
; You can use environmental variables as well: http://www.python-requests.org/en/latest/user/advanced/#proxies

; proxy_protocol set to https, if not specified.
proxy_url = proxy.mycorp.com

; proxy_port will override any port specified in proxy_url
proxy_port = 8080

; proxy authentication
proxy_username = kramer
proxy_password = giddy up!

License

Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.html

Acknowledgements

Special thank you to Colin Bell for qualysconnect.

Release files for qualysapi 8.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qualysapi 8.1.0
File Size Uploaded
qualysapi-8.1.0.tar.gz 27.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qualysapi 8.1.0
File Interpreter ABI Platform
qualysapi-8.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 52.1 kB

Release files / qualysapi-8.1.0.tar.gz

Download URL qualysapi-8.1.0.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d628ef144aecc82150cff47d7c0f3fe1f4044feb40ed8e85338a60279938739f
BLAKE2b-256 checksum
How to use checksums
afcf93702ca08888d1eeec5cebdf1c5d6b8757ca102bf57483934f96cc84badc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / qualysapi-8.1.0-py3-none-any.whl

Download URL qualysapi-8.1.0-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07a3ac26de12f581d5fec31a7329789c05c5bd5925a7bcbf1106353b51cb009c
BLAKE2b-256 checksum
How to use checksums
e5ced7ed0e6083209329ff2d803ea8466e7e9054ac127fb03262752616f66a10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

8.1.0 This release

2 release files

8.0.2

2 release files

8.0.1

2 release files

8.0.0

2 release files

7.1.0

2 release files

7.0.0

2 release files

6.3.0

2 release files

6.2.2

2 release files

6.2.1

2 release files

6.1.2

2 release files

6.1.0

2 release files

6.0.4

2 release files

6.0.3

2 release files

6.0.2

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.1.0

2 release files

5.0.4

2 release files

5.0.3

1 release file

5.0.2

1 release file

5.0.1

1 release file

5.0.0

1 release file

4.1.0

2 release files

4.0.2

1 release file

4.0.1

2 release files

4.0.0

2 release files

3.7.0

2 release files

3.6.1

2 release files

3.6.0

2 release files

3.5.6

2 release files

3.5.5

2 release files

3.5.4

2 release files

3.5.3

1 release file

3.5.2

1 release file

3.5.1

1 release file

3.5.0

1 release file

3.4.3

1 release file

3.4.2

1 release file

3.4.1

1 release file

3.4.0

1 release file

3.3.1

1 release file

3.3.0

1 release file

3.2.4

1 release file

3.2.3

1 release file

3.2.2

1 release file

3.2.1

1 release file

3.2.0

1 release file

3.1.1

1 release file

3.1.0

1 release file

3.0.0

1 release file

2.5.3

1 release file

2.5.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page