GVM-CLI Filter get-targets on name

Hello together,

i tried to create a xml request with the tool gvm-cli.exe to get information of only one target.
I have tried the following command:

gvm-cli.exe --gmp-username user --gmp-password password ssh --hostname hostname -X ‘<get_targets -filter=“name=targetA”>’

the following error occurs:

gvm-cli.exe : Invalid XML
In Zeile:54 Zeichen:13

  • gvm-cli.exe --gmp-username user --gmp-password pass…
    • CategoryInfo : NotSpecified: (Invalid XML:String) [], RemoteException
    • FullyQualifiedErrorId : NativeCommandError

does anyone have any ideas?

best regards

Hi,

did you try to remove the invalid - before the filter attribute? Should be ‘<get_targets filter=“name=targetA”>’.

2 Likes

Hi bricks,

thank´s for your help. I tryed your suggestion: ‘<get_targets filter=“name=targetA”>’ and ‘<get_targets filter=“name=targetA”/>’.
Unfortunately, I get the same XML error. When I try to output something else without a filter for example: ‘<get_targets/>’ this works fine.

best regards

If just tested to run gvm-cli socket --pretty --xml "<get_targets filter='name=foo'/>" and it works fine for me. Note: I am using gvm-cli on Linux. Could you paste the version of gvm-cli gvm-cli.exe --version and maybe write something about the installation method?

1 Like

I use the following version under the windows operating system: gvm-cli.exe 21.1.0 (API version 21.4.0)

I scripted the API using PowerShell. I have just copied your XML path one to one and used it for myself. Now it works flawlessly. I may have simply swapped a few quotes and/or shlashes.

Thanks, I’ll close this post now. :smile:

2 Likes