scripts/check-gmp.gmp.py fails with list index out of range
Expected behavior
When using scripts/check-gmp.gmp.py in the past it correctly reported the vulnerabilities found by a Greenbone appliance
Current behavior
After updating the greenbone appliance to 21.04.3 the script fails with "list index out of range"
Updating the gvm-tools to the current version using git pull introduced an additional bug: get_tasks() got an unexpected keyword argument 'filter_string'
When correcting this bug by replacing filter_string with filter the original bug "list index out of range" is thrown again.
Steps to reproduce
- Deploy check-gmp.gmp.py successfully with an older version of Greenbone OS
- Update to 21.04.3
- check-gmp.gmp.py will fail
GVM versions
As included in Greenbone OS 21.04.3
Can you be more explicit?
filter_string should be correct and you should have installed the correct version of python-gvm, too.
As mentioned here you need to use python-gvm >=21.05 with the latest gvm-tools, where filter has been replaced with filter_string(filter is now a builtin python method, thus the changes).
I would also like to see the full traceback and maybe the passed arguments, using check-gmp to help you with the list out of range error.
Thank you.
Hi, here is some information: pip3 list | grep gvm gvm-tools 21.6.1 python-gvm 21.6.0
gvm-script --gmp-username="xxx" --gmp-password="yy" ssh --hostname ab.cd.de ~/local/lib/nagios/plugins/check-gmp.gmp.py -F 91.x.y.z --last-report -T "report" --status list index out of range
There is no traceback. How do I enable the traceback?
I also wonder if your script in ~/local/lib/nagios/plugins/check-gmp.gmp.py is the latest version of the script provided here?
Yes it is. $ md5sum local/lib/nagios/plugins/check-gmp.gmp.py 206b07a7dd5e2d2821b566c34e43c993 local/lib/nagios/plugins/check-gmp.gmp.py
Thx. I will refactor the script and look into the issue.
Thanks a lot.
Hi, I could locate the error. Apparently on my Greenbone the construct error.xpath("host/text()") is empty. On line 756 this is assigned to host, which is empty as well. The next couple of lines try to access host[0] which caused the script to fail. Commenting the if clause on line 757 renders the script functional. I did not look any further but I hope this will point you into the correct location. Kind regards, Ralf