golismero / openvas_lib

OpenVAS connector for versions 6, 7, 8 and 9
BSD 3-Clause "New" or "Revised" License
80 stars 100 forks source link

openvas_lib.VulnscanServerError: Error while connecting to the server: [Errno 111] Connection refused #27

Open majidmc2 opened 5 years ago

majidmc2 commented 5 years ago

Hello I installed Openvas9 and use Python2.7. This is my code:

from openvas_lib import VulnscanManager, VulnscanException
try:
    scanner = VulnscanManager("127.0.0.1", "admin", "admin")
except VulnscanException as e:
    print(e)

When I run my code, I get this Error:

Error while connecting to the server: [Errno 111] Connection refused

What is the problem?

blackat87 commented 5 years ago

Hi @majidmc2 , checks if the openvas-manager service is listening on host 127.0.0.1 and port 9390 with the command netstat -ant | grep 9390

If not, you can set the host and port to listen to with the command openvasmd -p listen_port -a listen_address

or modify the conf file openvas-manager in /etc/default and restart the service.

Then, if you changes the OMP port or/and the OMP host, you can pass the new port or/and the new host on VulnscanManager object like

scanner = VulnscanManager(host="omp_listen_address", port=omp_listen_port, user="username", password="password")