Python SSH Connection

I want to connect like this but

Traceback (most recent call last):
   File "/Users/mkuk/Desktop/pythonProjects/openVas/", line 10, in <module>
     gmp.authenticate("admin", "admin")
   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gvm/protocols/gmpv208/system/", line 68, in authenticate
   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gvm/protocols/", line 72, in _send
   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gvm/", line 391, in send
     return self._send_all(data)
   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gvm/", line 217, in _send_all
     sent =
   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/", line 801, in send
     return self._send(s, m)
   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/", line 1198, in _send
     raise socket.error("Socket is closed")
OSError: Socket is closed

Iā€™m getting an error like this


from gvm.connections import SSHConnection
from gvm.protocols.gmpv208 import Gmp
from gvm.transforms import EtreeTransform
from gvm.xml import pretty_print

connection = SSHConnection(hostname='172.16.x.x',username='admin',password='xxx', port=22)

transform = EtreeTransform()
with Gmp(connection, transform=transform) as gmp:
    gmp.authenticate("admin", "admin")
    version = gmp.get_version()


first of all please always quote you code and output with three backticks ```. I updated your post accordingly.

Second, you can only use the SSHConnection out of the box with our products. For using it with a Community Edition based version, you need to setup a SSH server to forward the SSH connection to gvmd.



thank u.
I solved the problem with unix connection. I can create a task and start it, but how can I monitor the task with Python, that is, how can I give information as a percentage and then get the report?

You need to request the task or report information in a loop. The percentage is included in the responses.

1 Like