hi guys
i using gmp v7
the get_credentials function give me this error any one see that:
<get_version_response status=“200” status_text=“OK”>7.0</get_version_response>
Traceback (most recent call last):
File “/home/PycharmProjects/openvas/Main2.py”, line 47, in
credentials = gmp.get_credentials(filter=“rows=-1 not _owner=”"")
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/gmpv7.py”, line 2188, in get_credentials
return self.send_command(cmd)
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/base.py”, line 131, in send_command
raise e
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/base.py”, line 127, in send_command
self._send(cmd)
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/base.py”, line 63, in _send
self._connection.send(data)
File “/usr/local/lib/python3.6/dist-packages/gvm/connections.py”, line 103, in send
self._socket.sendall(data)
File “/usr/lib/python3.6/ssl.py”, line 969, in sendall
with memoryview(data) as view, view.cast(“B”) as byte_view:
TypeError: memoryview: a bytes-like object is required, not ‘XmlCommand’
Should already be fixed in the master branch of python-gvm
thanks resolved
Hey, got (almost) same issue.
GMP v7.0
Code
: is line number. Everything else is commented fyi
15: path = ‘/var/run/openvasmd.sock’
16: connection = UnixSocketConnection(path=path)
17: transform = EtreeTransform()
18: gmp = Gmp(connection, transform=transform)82: with gmp:
84: gmp.authenticate(‘xxx’, ‘xxx’)
87: req = gmp.get_credentials()
88: print(req.xpath(‘status_text’))
Traceback
gvm-script socket --socketpath /var/run/openvasmd.sock test.gmp
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 87, in
File “/home/xxx/.local/lib/python3.6/site-packages/gvm/protocols/gmpv7.py”, line 2188, in get_credentials
return self.send_command(cmd)
File “/home/xxx/.local/lib/python3.6/site-packages/gvm/protocols/base.py”, line 131, in send_command
raise e
File “/home/xxx/.local/lib/python3.6/site-packages/gvm/protocols/base.py”, line 127, in send_command
self._send(cmd)
File “/home/xxx/.local/lib/python3.6/site-packages/gvm/protocols/base.py”, line 63, in _send
self._connection.send(data)
File “/home/xxx/.local/lib/python3.6/site-packages/gvm/connections.py”, line 103, in send
self._socket.sendall(data)
TypeError: a bytes-like object is required, not ‘XmlCommand’
Any thoughts?
It’s exactly the same issue. The PR fixes your problem.
@bricks
You’re right. I was debugging another issue and installed latest release by mistake. Installed from master and it fixed this problem.
Please create a new thread for this new issue to avoid mixing different issues within a single thread. Especially as the issue discussed in this thread is already solved.