Gvm-cli fails to "get_hosts", but pyshell works fine

Hi,
I’m trying to run gvm-cli to get hosts (and delete host) but i’m getting Error 400. Bogus command name.
I’m using the following command:

gvm-cli --gmp-username username --gmp-password password socket --xml '<get_hosts />'
ERROR:gvmtools.cli:Response Error 400. Bogus command name

Performing other actions like get_tasks, get_groups, get_feeds, delete_tasks etc, work fine.
Running the same way using gvm-pyshell doesn’t seem to have this issue:

gvm-pyshell --gmp-username username --gmp-password password socket
GVM Interactive Console 22.9.0 API 22.9.0.Type "help" to get information about functionality.
>>> resp=gmp.get_hosts()
>>> pretty_print(resp)
<get_assets_response status="200" status_text="OK">
  <asset id="7a37da6b-d0c3-45d0-c0ce-ed752a3d7519">
    <owner>
...

What am i missing?
Seems to not be platform or version related - Tried on both 21.4 running on Kali and on 22.4 running on docker.

Yes that’s correct and not a bug.

The GMP command to get the hosts is <get_assets type="host"/>. This is one of the quirks in the protocol which we abstracted in the Python API.

2 Likes

Got it, just tried with get_assets / delete_asset and as expected, those work fine.
Thanks!

1 Like