How to disable NVT family from a scan configuration via python-gvm

Dear all,

I am attempting to disable a whole NVT family from a scan configuration using python-gvm For example, let’s say my scan configuration contains some NVT families, like the following ones:

  • Brute force attacks
  • General
  • Web Servers
  • Windows

My goal is to disable the Brute force attacks family. Something like this, but programatically:

In order to do so, I am using the following code:

gmp.modify_scan_config_set_family_selection(
    config_id=config_id,
    families=[(family_name, False, False)],
    auto_add_new_families=False
)

where family_name is “Brute force attacks” and config_id is the appropriate scan configuration ID.

However, the scan configuration keeps the NVT family after the python code execution.

My question is: Is there a way to either:

  1. Disable a NVT family from a scan config?
  2. Disable a set of NVTs?

Thank you in advance for your answers.

Kind regards.

I found the solution.

It seems I was using the wrong python method. The following statement does the trick:

gmp.modify_scan_config_set_nvt_selection(
    config_id=<config_id>,
    family="Brute force attacks",
    nvt_oids=[]
)

The previous statement removes NVT familyBrute force attacks” from scan_config <config_id>.

Kind regards.

3 Likes

Hi @victor.sanchez,

Very cool and thanks for sharing what worked!