Skip to content

Commit 8fb7969

Browse files
robindittmargreenbonebot
authored andcommitted
Change: Script for generating CERT-BUND-ADV scan configs now supports whole-only families
1 parent d2f606a commit 8fb7969

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

scripts/cfg-gen-for-certs.gmp.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def create_scan_config(gmp, cert_bund_name):
6161
copy_id = "085569ce-73ed-11df-83c3-002264764cea"
6262
config_name = f"scanconfig_for_{cert_bund_name}"
6363
config_id = ""
64+
whole_families = []
6465

6566
try:
6667
res = gmp.create_scan_config(copy_id, config_name)
@@ -73,7 +74,17 @@ def create_scan_config(gmp, cert_bund_name):
7374
config_id=config_id, nvt_oids=nvt_oid, family=family
7475
)
7576
except GvmError as gvmerr:
76-
print(f"{gvmerr=}")
77+
if 'Attempt to modify NVT in whole-only family' in gvmerr.message:
78+
print(f'Adding whole family "{family}" to scan config')
79+
whole_families.append((family, True, True))
80+
else:
81+
print(f"Could not modify scan config, {gvmerr=}")
82+
83+
if len(whole_families) > 0:
84+
gmp.modify_scan_config_set_family_selection(
85+
config_id=config_id,
86+
families=whole_families,
87+
)
7788

7889
# This nvts must be present to work
7990
family = "Port scanners"
@@ -82,8 +93,8 @@ def create_scan_config(gmp, cert_bund_name):
8293
config_id=config_id, nvt_oids=nvts, family=family
8394
)
8495

85-
except GvmError:
86-
print("Config exist")
96+
except GvmError as e:
97+
print("Config exist ", e)
8798

8899

89100
def main(gmp: Gmp, args: Namespace) -> None:

0 commit comments

Comments
 (0)