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
Built Distribution
File details
Details for the file qualyspy-0.4.4.1.tar.gz
.
File metadata
- Download URL: qualyspy-0.4.4.1.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29498cdbdd7f8cbf899cafb569d366775d3d49e513e95b74631b5c0b08a4057b |
|
MD5 | cb1ef6ebaa2c639b23a177408fecb662 |
|
BLAKE2b-256 | ec75964c28876026b18dfdb72aa740f05268b464094e7c6fccea5aec6de51550 |
File details
Details for the file qualyspy-0.4.4.1-py3-none-any.whl
.
File metadata
- Download URL: qualyspy-0.4.4.1-py3-none-any.whl
- Upload date:
- Size: 35.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aad03910ca2222650c1e54aae6d0936c0bb353f28c21ca89e030a44e1842112 |
|
MD5 | 64e23f83c345e8baa3dd413faafa1cfb |
|
BLAKE2b-256 | 5eb869c7ae6235ae1ef4dcb95ddaf8d93badd395a2d171017eca413840e7abe9 |