I am trying to experiment a bit with the tools provided in your GitHub https://github.com/greenbone/gvm-tools/tree/main/scripts. I wanted to try out the create-targets-from-host-list.gmp.py but I get an error that says gvm.errors.GvmResponseError: Response Error 400. One of PORT_LIST and PORT_RANGE are required, even though the documentation says, that there is just an IP of the GVM host name and a text-file containing hostnames needed. Can someone please tell me where I’m wrong or if I’m wrong?
Thanks ins advance
I figured out, that the source code didn’t provide a port_list_id in the create_target function, so I just added it and it worked
Hi, We are facing this same problem. Could you show me what you added in the create-targets-from-host-list.gmp.py to specify the port_list_id ?
Thanks this was helpful. FYI for anyone else using this. You have to get the port_list_id UID from the web console (we got ours from doing an export) and then put in the code block where Don specified.
Kinda stinks that you have to modify the script from git, but hey - it works!
@rootbeard42 please share the working script, so it can be fixed reused by others…
I will update the mentioned script!
I have fixed the script.
After merging can add a
port_range (will result in creating a new
port_list with that range) or a
port_list_id (by giving a UUID) to the script.
The default behavior of the script has not been changed
gvm-script --gmp-username xyz --gmp-password abc ssh --hostname <host> scripts/create-targets-from-host-list.gmp.py <host> <file>
will default to create targets with the standard
port_list_id of All IANA assigned TCP and UDP (
You can use
+pl/++port_list_id to add your own ID or
+pr/++port_range to create a new port list (
T: 1-1234 or
U: 3-4, …) See documentation.
If you have any further problem, please let me know.