Traceback (most recent call last):
File “/home/xxx/.local/bin/gvm-script”, line 11, in
sys.exit(main())
File “/home/xxx/.local/lib/python3.6/site-packages/gvmtools/script.py”, line 108, in main
run_script(args.scriptname, global_vars)
File “/home/xxx/.local/lib/python3.6/site-packages/gvmtools/helper.py”, line 86, in run_script
exec(file, global_vars) # pylint: disable=exec-used
File “”, line 91, in
AttributeError: ‘Gmp’ object has no attribute ‘create_asset’
$ gvm-pyshell --config ~/.config/gvm-tools.conf socket --socketpath /var/run/openvasmd.sock
GVM Interactive Console 2.0.0b1 API 1.0.0b2.dev1. Type "help" to get information about functionality.
>>> print(gmp.get_version().xpath('version/text()')[0])
7.0
>>> gmp.create_asset()
Traceback (most recent call last):
File "/usr/lib/python3.6/code.py", line 91, in runcode
exec(code, self.locals)
File "<console>", line 1, in <module>
AttributeError: 'Gmp' object has no attribute 'create_asset'
>>>
EDIT:
I think code of my script is screwing something up. I reinstalled gvm-tools and python-gvm and gmp.create_asset() worked fine in gvm-pyshell but stopped working after executing the script. Gonna debu some
EDIT2:
That was false. I think I managed to recreate my issue.
First I install latest release of python-gvm by pip3 install --force-reinstall python-gvm , by now in gvm-pyshell gmp.create_asset() works and gmp.get_credentials() doesn’t (because it doesnt have fix from master).
Then I install newest version by cloning python-gvm repo, go inside repo folder and usine pip3 install ., now in gvm-pyshell I can use gmp.get_credentials() because it has fix, but can’t use gmp.create_asset() (look traceback from top)
I managed to temporarily fix the issue by downloading latest release from repo (not from master branch) and manually applying commit to fix get_credentials() by altering this one line. Question is why it this main issue happened and how to permanently fix it…
From the docs you can see, that there is no create_asset method on the Gmp object anymore. To create a host asset please use create_host instead.
The python-gvm API does NOT reflect the GMP protocol 1:1. It circumvents some rough edges of the protocol and makes it more obvious which parameters are expected.