OpenVAS: CLI Vulnerability Scanning [CentOS]

I have been trying to figure out how I can execute tasks from the command line with OpenVAS (without any interactions with their web gui)

I’ve tried running this command:

omp --port=9392 --host=<IP> --username=admin --password=admin --xml "<get_results/>"

And it just stalls there, appearing to do nothing. No output, nothing.

After looking around, apparently omp is deprecated and people have said to switch to gvm-cli

After switching to gvm-cli, I ran the following commands, and got this error…

gvm-cli socket --xml "<get_results/>"
[Errno 2] No such file or directory

gvm-cli socket --gmp-username admin --gmp-password admin --xml "<get_results/>"
Traceback (most recent call last):
  File "/home/phillip/py37/bin/gvm-cli", line 10, in <module>
    sys.exit(main())
  File "/home/phillip/py37/lib/python3.7/site-packages/gvmtools/cli.py", line 92, in main
    gvm.authenticate(args.gmp_username, args.gmp_password)
  File "/home/phillip/py37/lib/python3.7/site-packages/gvm/protocols/gmpv7.py", line 210, in authenticate
    self._send(cmd.to_string())
  File "/home/phillip/py37/lib/python3.7/site-packages/gvm/protocols/base.py", line 62, in _send
    self.connect()
  File "/home/phillip/py37/lib/python3.7/site-packages/gvm/protocols/base.py", line 98, in connect
    self._connection.connect()
  File "/home/phillip/py37/lib/python3.7/site-packages/gvm/connections.py", line 310, in connect
    self._socket.connect(self.path)
FileNotFoundError: [Errno 2] No such file or directory

I’m not sure what else to do. Could someone steer me in the right direction with this?

What I want to eventually end up doing is create an automated scanning system completely from the command line. I want to be able to:

  1. Create a new target
  2. Create a new task
  3. Run the scan

How can I accomplish this?

Extra Info:

When running openvas-check-setup --v9 my output is: It seems like your OpenVAS-9 installation is OK

OS: CentOS 7

The web gui runs fine, and I executed a task to make sure everything is working ok.

1 Like

This message isn’t very helpful for end users and I’ll see how to improve it.

But nevertheless it’s cause by accessing a file that’s not available. In your case the file which is tried to be opened is the unix socket. Therefore please check the –socketpath argument and adjust it accordingly. I don’t know which socket path is used by CentOS. Most likely something like /var/run/openvasmd.sock

1 Like

It seems the solution was already found by the OP on the created stackoverflow discussion:

1 Like

@phillipr if you have issues with gvm-tools/python-gvm just create a new topic here. I will always try to improve our codebase to be easier to understand. Just let me know!

2 Likes