How to import Target using file

Greetings

I’m new using Greenbone. Im using the Community edition. I have identified my asset that I want to scan. And I want to create a task that scan all my asset in a list instead of creating multiple scans for each host.

What is the format to import a list of my asset to create a target?.

I try a .txt of just the list of the ip and a .csv but it fail.

I appretiate if anyone can point me to a documentation or can give me an example of the import format

Thanks

Hi @jm-barreto you may want to use gvm-tools and take look at: gvm-tools/scripts/create-targets-from-csv.gmp.py at main · greenbone/gvm-tools · GitHub or gvm-tools/scripts/create-targets-from-host-list.gmp.py at main · greenbone/gvm-tools · GitHub

Is this helping you?
Best regards, Jaspar

2 Likes

Can it also be scripted to clone an existing target, import csv list to cloned target and then assign the new target to an existing task?

Hi @dsekely_brs, its been a while that I was responsible for python-gvm, but IIRC everything that is possible via gsa (UI) is also possible via python API.
If you want to know the probability that this - as a script - is implemented by Greenbone in near future: Very low to zero. :wink:
If you implement such a script and feel it is worthy to be contributed - always appreachiated in gvm-tools!

2 Likes

I usually create tasks with scripts, but I think you can add all hosts in target using following syntax:

ip,next-ip,or-net/cidr,ip-to-ip-range

Eero