Skip to main content

A Python wrapper for the Qualys API.

Project description

QualysPy

A Python wrapper for the Qualys API. Qualys data can be interacted with using a Python model, loaded into a PostgreSQL database, and queryed from that database with the same model.

This is a work in progress. The currently supported API calls are:

  • VMDR
    • host_list_detection

Requirements

  • Python >= 3.10
  • A supported version of Linux (tested on Ubuntu 22.04)
  • A supported version of PostgreSQL, if you want to use the ORM classes.

Installation

python -m venv .venv
source .venv/bin/activate
pip install qualyspy

Then, create a config file to indicate the Qualys API URLS and credentials and, optionally, PostgreSQL database information. See config-example.ini for an example configuration file. By default, QualysPy will search for this file at ~/etc/qualyspy/config.ini, but a different file path can be supplied.

Usage

Documentation is located at https://qualyspy.readthedocs.io.

Each Qualys API has class subclassed from QualysAPIBase. For example, to connect to the VMDR API:

from qualyspy.vmdr import VmdrAPI

api = VmdrAPI()

The API object has methods corresponding to the Qualys API's endpoints.

host_vulns = api.host_list_detection(ids=12345)

To load the data into a database, use the ORM class corresponding to the API endpoint. For the host_list_detection endpoint:

from qualyspy.vmdr import HostListDetectionORM
# Tip: You can pass echo=True to an ORM class to write the SQL commands to stdout
orm = HostListDetectionORM()
orm.load() # This may take some time, depending on how much data there is to load.

Finally, the data can be queryed and will be outputted in the same form as with VmdrAPI.

from qualyspy.models.vmdr.host_list_vm_detection_orm import Host

# Get all hosts from the database
with orm.Session(vmdr_orm.engine) as session:
    stmt = session.query(Host)
    host_list = vmdr_orm.query(stmt)[0]
    host = host_list.host[0]

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

qualyspy-0.3.9.2.tar.gz (60.3 kB view details)

Uploaded Source

Built Distribution

qualyspy-0.3.9.2-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file qualyspy-0.3.9.2.tar.gz.

File metadata

  • Download URL: qualyspy-0.3.9.2.tar.gz
  • Upload date:
  • Size: 60.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for qualyspy-0.3.9.2.tar.gz
Algorithm Hash digest
SHA256 c12706590fe54f1b365e25ba2455cae61fd59ba65eea9fd9493bab5d4ffb4103
MD5 aed8d14c4fe44b5ee88c2f0645b1ae02
BLAKE2b-256 d1f9e3e87ae37447a52200ca80438cf00d8e78f6f06a5f111048a02ed05da197

See more details on using hashes here.

File details

Details for the file qualyspy-0.3.9.2-py3-none-any.whl.

File metadata

  • Download URL: qualyspy-0.3.9.2-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for qualyspy-0.3.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 862a56d3b75df563c091ce1abe4c97f739a5dddd64c2e7c87f2695e45d863fd7
MD5 c70a1aa370a1e73d1d9fded3a3788a59
BLAKE2b-256 906be793ce4ddda1161e60473e62f88bf821135d86cdc282c9d1745f8f0500c8

See more details on using hashes here.

Supported by

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