Skip to main content

Qualys API Helper

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qualysapi-6.1.0.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

qualysapi-6.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file qualysapi-6.1.0.tar.gz.

File metadata

  • Download URL: qualysapi-6.1.0.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for qualysapi-6.1.0.tar.gz
Algorithm Hash digest
SHA256 b7317516708e047a68897674b0e4e4fffbaeae9ea0b823c6c57aeaddd29d245c
MD5 e43fff551440c62ab610ac35d116aadb
BLAKE2b-256 01d624c11009b9534103053c9ef0afcef163c344132eea055b13fde0ee254d61

See more details on using hashes here.

File details

Details for the file qualysapi-6.1.0-py3-none-any.whl.

File metadata

  • Download URL: qualysapi-6.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for qualysapi-6.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43c3824315d847998d2683b42ea459667e0eb97deab55f898d994b7fd9ead1b4
MD5 9efc127220bf10034b73bc4917a8b9f2
BLAKE2b-256 6e71934f6d98ee1b460e7db27d3490add1d9dd5a8d780025edb9b5a39c8622d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page