I’m trying to play with gvm-cli to parse XML output in scripting. With omp XML output contained newline after each parameter. With gvm-cli, there is no more newlines. XML output is bulk XML, which makes it harder for parsing.
I was wondering of any tool available to ease xml parsing. Any suggestions welcome !
Well the issue is you have to know python… which I don’t
Currently my bash scripts does what I need, so it’s fine. I just need to make it work with gvm. The main problem I have is that with omp you could retrieve informations directly (such as tasks), while with gvm you have to send XML instructions. And XML is kind of cryptic to me.
Most of the commands are straight forward like <get_tasks/>, <get_reports/>, … to get data but understanding XML is crucial for extracting specific data from the responses.
Yes, you are perfectly right and that’s what I’m trying to at the moment. But I can’t figure out how to extract a sub data from XML. For instance, I have several tasks called:
Target A, subnet 1
Target A, subnet 2
…
Target B, subnet 1
Target B, subnet 2
…
Now I want to extract all target IDs of group “Target A” and not Target B. How do you achieve this with xmlstartlet ?
I am not sure what you exactly want to read from the response. E.g. an XPath for getting the task ids for all tasks using the target with name Target A from a <get_tasks/> response would be
Thank you guys for your replies. Thanks to your inputs I was able to do what I was looking for. So now I’m able to get my reports in csv using gvm-cli. I’m still struggling with some data consistencies issues between openvas8/openvas9 that will be another post.