Dear Greenbone-Community,
I have searched for the answer, but I was not able to retrieve the information how to use a GSM-Appliance with python-gvm.
What is the problem?
I have some expirience with GSM in the OpenSource edition and I was able to use the API with a connection established via UnixSocketConnection. When I try to use the Module SSHConnection or TLSConnection, our GSM Deca Appliance will respond with an error-message.
My try with TLSConnection:
Code:
from gvm.connections import SSHConnection, TLSConnection, UnixSocketConnection
from gvm.protocols.gmpv208 import Gmp
gmp_obj = TLSConnection(hostname=“10.10.20.150”)
with Gmp(connection=gmp_obj) as gmpReady_obj:
gmpReady_obj.authenticate(username=“webadmin”, password=“webadminpassword”)
print(gmpReady_obj.get_version())
Error:
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed
to respond
My try with SSH:
Code:
from gvm.connections import SSHConnection, TLSConnection, UnixSocketConnection
from gvm.protocols.gmpv208 import Gmp
gmp_obj = SSHConnection(hostname=“10.10.20.150”, port=22, username=“admin”, password=“admin”)
with Gmp(connection=gmp_obj) as gmpReady_obj:
gmpReady_obj.authenticate(username=“webadmin”, password=“webadmin”)
print(gmpReady_obj.get_version())
Error:
File “C:\Users\User\AppData\Roaming\Python\Python38\site-packages\paramiko\channel.py”, line 801, in send
return self._send(s, m)
File “C:\Users\User\AppData\Roaming\Python\Python38\site-packages\paramiko\channel.py”, line 1198, in _send
raise socket.error(“Socket is closed”)
OSError: Socket is closed
(Error message shortened)
GMP is activated on the Deca-Appliance:
Deca-Version:
20.08.7
Python-gvm version:
Name: python-gvm
Version: 21.1.3
I would be happy if you could help me with this!
Best Regards,
Florian