Package: gvm-tools
Greenbone Vulnerability Management ToolsThe Greenbone Vulnerability Management Toolsgvm-toolsare a collection of
tools that help with remote controlling a Greenbone Enterprise Appliance and
Greenbone Community Edition installations. The tools aid in accessing the
communication protocols GMP (Greenbone Management Protocol) and OSP
(Open Scanner Protocol).This module is comprised of interactive and non-interactive clients.
The programming language Python is supported directly for interactive scripting.
But it is also possible to issue remote GMP/OSP commands without programming in
Python.Table of ContentsDocumentationInstallationRequirementsVersionUsagegvm-cliExamplesgvm-scriptExample scriptMore example scriptsgvm-pyshellExample program useSupportMaintainerContributingLicenseDocumentationThe documentation forgvm-toolscan be found athttps://greenbone.github.io/gvm-tools/.
Please refer to the documentation for more details as this README just
gives a short overview.InstallationSee thedocumentationfor all supported installation options.RequirementsPython 3.9 and later is supported.VersionPlease consider to always use thenewestversion ofgvm-toolsandpython-gvm.
We frequently update this projects to add features and keep them free from bugs.
This is why installinggvm-toolsusing pip is recommended.To usegvm-toolswith an old GMP version (7, 8, 9) you must use a release versionthat is<21.06, combined with anpython-gvmversion<21.05.In the21.06release the support of these older versions has been dropped.UsageThere are several clients to communicate via GMP/OSP.All clients have the ability to build a connection in various ways:Unix SocketTLS ConnectionSSH Connectiongvm-cliThis tool sends plain GMP/OSP commands and prints the result to the standard
output.ExamplesReturn the current protocol version used by the server:gvm-clisocket--xml"<get_version/>"Return all tasks visible to the GMP user with the provided credentials:gvm-cli--gmp-usernamefoo--gmp-passwordbarsocket--xml"<get_tasks/>"Read a file with GMP commands and return the result:gvm-cli--gmp-usernamefoo--gmp-passwordbarsocketmyfile.xmlNote thatgvm-cliwill by default print an error message and exit with a
non-zero exit code when a command is rejected by the server. If this kind of
error handling is not desired, the unparsed XML response can be requested using
the--rawparameter:gvm-clisocket--raw--xml"<authenticate/>"gvm-scriptThis tool has a lot more features than the simplegvm-cliclient. You
have the possibility to create your own custom gmp or osp scripts with commands
from thepython-gvm libraryand from
Python 3 itself.Example script# Retrieve current GMP versionversion=gmp.get_version()# Prints the XML in beautiful formfromgvmtools.helperimportpretty_printpretty_print(version)# Retrieve all taskstasks=gmp.get_tasks()# Get names of taskstask_names=tasks.xpath('task/name/text()')pretty_print(task_names)More example scriptsThere is a growing collection of gmp-scripts in the"scripts/"folder.
Some of them might be exactly what you need and all of them help writing
your own gmp scripts.gvm-pyshellThis tool is for running gmp or osp scripts interactively. It provides the same
API asgvm-scriptusing thepython-gvm library.Example program useConnect with given credentials via a unix domain socket and open an interactive
shell:gvm-pyshell--gmp-usernameuser--gmp-passwordpasssocketConnect through SSH connection and open the interactive shell:gvm-pyshell--hostname127.0.0.1sshSupportFor any question on the usage ofgvm-toolsor gmp scripts please use theGreenbone Community Portal. If you
found a problem with the software, pleasecreate an issueon GitHub.MaintainerThis project is maintained byGreenbone AG.ContributingYour contributions are highly appreciated. Pleasecreate a pull requeston GitHub.
For bigger changes, please discuss it first in theissues.For development you should usepoetryto keep you python packages separated in different environments. First install
poetry via pippython3 -m pip install --user poetryAfterwards runpoetry installin the checkout directory ofgvm-tools(the directory containing thepyproject.tomlfile) to install all dependencies including the packages only
required for development.Afterwards active the git hooks for auto-formatting and linting viaautohooks.poetry run autohooks activate --forceLicenseCopyright (C) 2017-2023Greenbone AGLicensed under theGNU General Public License v3.0 or later.