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.

The Python models are intended to be a 1:1 mapping of the objects returned by the Qualys API.

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 features.

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 .qualyspy-example for an example configuration file. By default, QualysPy will search for this file at ~/.qualyspy, 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


Release history Release notifications | RSS feed

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.5.10.4.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qualyspy-0.5.10.4-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qualyspy-0.5.10.4.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for qualyspy-0.5.10.4.tar.gz
Algorithm Hash digest
SHA256 5b2a7dcd3b87f936233698a3f68bb8ccbef76a4545de83910ddd65f7d138b9cb
MD5 88f08d1cd1f4d19fa68dff1c4254f4d9
BLAKE2b-256 b7e37cac2b4ed3bc046db5c0f27e851b3e43b2fc5c9ca04a7dcab1ff1633908d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qualyspy-0.5.10.4-py3-none-any.whl
  • Upload date:
  • Size: 48.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for qualyspy-0.5.10.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b5d36584d48ea5a3d433414c1ce8d1cbf73aa7382f3f75e2fb928d19e3423149
MD5 afe91b77709a75bcd7ab64eb23cca17f
BLAKE2b-256 e726e7595f78d327335f4d63ad350722500f0052c4cc2ee2e2335e6a3739cb9b

See more details on using hashes here.

Supported by

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