Accessing OpenVAS with Python
We could automate the process of getting the information stored in the OpenVAS server using the python-gmv
module. This module provides an interface for interacting with the OpenVAS server's vulnerability scan functionality.
You can get more information about this module at https://pypi.org/project/python-gvm.
The API documentation is available at https://python-gvm.readthedocs.io/en/latest/api/gmpv7.html.
In the following example, we are going to connect with the OpenVAS server on localhost and get the version. You can find the following code in the openvas_get_version.py
file:
#!/usr/bin/env python3 import gvm from gvm.protocols.latest import Gmp connection = gvm.connections.TLSConnection(hostname='localhost') with Gmp(connection=connection) as gmp: version = gmp.get_version() print(version)
In the previous code, we use the TLSConnection
class that uses a socket connection...