GVM RPC
A simple RPC server and client using Python's xmlrpc.server and xmlrpc.client in tandem with Greenbone's python-gvm package.
Installation
# PyPi Installation
pip install gvm-rpc
# GitHub Installation
python -m pip install git+'https://github.com/bnassif/gvm-rpc.git'
Usage
Client
The client, once imported, works exactly like the gvm.protocols.gmp.Gmp object.
Functions called against the client are proxied through the XML-RPC server where it is then sent to gvmd.sock for processing.
The returned lxml.etree objects are transformed to strings in transport, and transformed back into lxml.etree by the client.
Note: Because the
GvmServerProxyobject just relays attemptedobj.__getattr__()calls, IDE's will not be aware of potential Gmp calls.
Consult thepython-gvmusage documentation for available functions and parameters.
Basic Usage
from gvmrpc.client import GvmServerProxy
hostname = 'http://localhost:8000'
username = 'user'
password = 'secret'
client = GvmServerProxy(username, password, host)
# From here on, the client behaves similarly to the Gmp object
client.get_version()
client.get_targets()
...
# It is also possible to handle multiple calls at once using the custom MultiCall class
from .client import MultiCall
# Create a MutliCall instance
multi_call = MultiCall()
# Add calls to the MultiCall object
multi_call.get_version()
multi_call.get_targets()
# Execute the commands
multi_call()
Secure Usage
When the server is secured by an SSL, which it should always be because of Basic auth, it is necessary to assign an SSL context to the client.
from gvmrpc.client import GvmServerProxy
import ssl # We'll need this module
hostname = 'http://localhost:8000'
username = 'user'
password = 'secret'
# Create the context object
context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
# Bind the SSLContext to the client
client = GvmServerProxy(username, password, host, ssl_context=context)
Server
The server runs as a daemon on the GVS server you wish to manage.
The recommended deployment option is to use the accompanying Docker Image if running GVS in Docker.
Otherwise, the server can also be run as a system-level service.
For details on flags available at runtime for both deployments, consult the run.py script in the repo root.
Container Usage
When running GVM RPC as a sidecar container, it is important to bind the gvmd_socket_vol volume in the appropriate place.
You will likely also want to expose this container with an SSL-terminating reverse proxy like nginx to secure usage.
For an example on deploying the container as a sidecar via Docker Compose overrides, reference this example file.
System-Level Service
Running GVM RPC as a service involves additional overhead on maintaining the Python environment it will run in.
It is not recommended to use this option unless you know what you are doing.
For an example on how to do this with systemd, reference this example service.
Available Options
The provided runtime script defaults to serving without an SSL. Please review the options below and secure the server as necessary.
| flag | default | description |
|---|---|---|
--address |
127.0.0.1 |
The local address to listen on |
--port |
8000 |
The local port to listen on |
--socket |
/gvmd/gvmd.sock |
The path to the GVM socket |
--ssl-cert |
The path to the SSL certificate to be used | |
--ssl-key |
The path to the SSL key to be used |
Note: The SSL certificate and key must both be supplied or not supplied
License
MIT - Feel free to use, extend, and contribute.
Metadata
Release files for gvmrpc 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gvmrpc-0.1.0.tar.gz | 6.8 kB | With provenance | Details for gvmrpc-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gvmrpc-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for gvmrpc-0.1.0-py3-none-any.whl |
Total release size: 14.3 kB
Release files / gvmrpc-0.1.0.tar.gz
| Download URL | gvmrpc-0.1.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2a8fe012662ee033d7bb134cb2432e4d315cbb0a1e0f0243a02875df81b68cb
|
|
BLAKE2b-256 checksum How to use checksums |
28efc0952498a38b84849226d46af906b848201b831a548cbeb22bec822a0614
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2025.
Transparency logRelease files / gvmrpc-0.1.0-py3-none-any.whl
| Download URL | gvmrpc-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
047b6f39b53a733104de7f961661ebcf0f5f2d3c01481a0d286dd91cf9845b5c
|
|
BLAKE2b-256 checksum How to use checksums |
0dfb60da3e0d059af0640cd5029c45b671760057d6672ad88c7842a1f1bf85e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2025.
Transparency logSecurity for gvmrpc 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gvmrpc-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.