Integrate OpenVAS using python

I have installed OpenVAS/GVM for ubuntu using the following docs - Greenbone Community Containers - Greenbone Community Documentation

Now I need to interact with GVM using python. Previously I installed gvm manually using sudo apt install gvm on kali linux and interacted with it successfully using python-gvm through UnixSocketConnection. But this approach is not working for ubuntu system.

Manual installation on ubuntu was not successful that is why I used greenbone community containers and everything is working fine. I just need to figure out how do I interact with GVM in python using this approach.

I would really appreciate and be grateful for any help and guidance.

Thank you.

Hi, please take a look at

and

1 Like

Thanks for the documentation.

I followed the second part of exposing the Unix socket. This solution worked partially. I am able to start a scan using python but I cant fetch the status. On the GUI I am getting internal server error.

Also, I would really appreciate if you can confirm that I have made correct changes. Here is the part of the compose file.

gvmd:
image: registry.community.greenbone.net/community/gvmd:stable
restart: on-failure
volumes:

  • gvmd_data_vol:/var/lib/gvm
  • scap_data_vol:/var/lib/gvm/scap-data/
  • cert_data_vol:/var/lib/gvm/cert-data
  • data_objects_vol:/var/lib/gvm/data-objects/gvmd
  • vt_data_vol:/var/lib/openvas/plugins
  • psql_data_vol:/var/lib/postgresql

- gvmd_socket_vol:/run/gvmd

  • /tmp/gvm/gvmd:/run/gvmd
  • ospd_openvas_socket_vol:/run/ospd
  • psql_socket_vol:/var/run/postgresql

gsa:
image: registry.community.greenbone.net/community/gsa:stable
restart: on-failure
ports:

  • 127.0.0.1:9392:80
    volumes:

- gvmd_socket_vol:/run/gvmd

  • /tmp/gvm/gvmd:/run/gvmd
    depends_on:
  • gvmd

Thank you.

If the management daemon has an error please take a look at the logs to identify the error. Otherwise we can’t offer any help.

These are the some of the error logs:

gmp:UNKNOWN:2025-02-18 08h16.58 utc:614: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h17.13 utc:621: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h17.28 utc:624: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h17.43 utc:627: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h17.58 utc:630: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h18.13 utc:637: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h18.29 utc:640: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h47.03 utc:968: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h47.19 utc:981: handle_get_tasks: GET_TASKS: error finding task target, aborting
md gmp:UNKNOWN:2025-02-18 08h48.19 utc:992: handle_get_tasks: GET_TASKS: error finding task target, aborting
pc@desktop:~$

notus-data-1 | products/suse_linux_enterprise_workstation_extension_12.notus
notus-data-1 | changed user permissions to 1001
notus-data-1 | changed group permissions to 1001
notus-data-1 | files copied.
gvmd-1 | md gmp:UNKNOWN:2025-02-18 10h04.06 utc:319: handle_get_tasks: GET_TASKS: error finding task target, aborting
gsa-1 | libgvm util-Message: 10:04:06.865: Error: Error on line 1 char 1: Document was empty or contained only whitespace
gsa-1 |
gsa-1 |
gsa-1 | (gsad:12): libgvm util-WARNING **: 10:04:06.865: End error: Error on line 1 char 1: Document was empty or contained only whitespace
gsa-1

Is there any I can reinstall the database/delete existing targets or scans because my GUI wont let me. Or do I need to setup the images again.

I haven’t seen such an issue before. I suppose that something is broken in your setup/database.

You could delete the docker volume for the postgres database to remove all stored data. Additionally take a look at the following link for starting from scratch completely