Scan script doesn't work

hi I’m trying to use this script “scan-new-system.gmp.py” present in the example scripts on github in this link.

using this command which is suggested:
$ gvm-script --gmp-username name --gmp-password pass ssh --hostname scripts / scan-new-system.gmp.py <host_ip>

where “name” and “pass” are replaced by my greenbone username and password and in place of <host_ip> I put the ip of my host.

Using this command the terminal returns
“zsh: non-existent file or directory: gsm”

If instead I remove that “gsm” I get this:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/gvmtools/script.py”, line 88, in main
with protocol_class(connection, transform=transform) as protocol:
File “/usr/lib/python3/dist-packages/gvm/protocols/gmp.py”, line 117, in enter
gmp = self.determine_supported_gmp()
File “/usr/lib/python3/dist-packages/gvm/protocols/gmp.py”, line 99, in determine_supported_gmp
version_str = self.determine_remote_gmp_version().split(‘.’, 1)
File “/usr/lib/python3/dist-packages/gvm/protocols/gmp.py”, line 82, in determine_remote_gmp_version
self.connect()
File “/usr/lib/python3/dist-packages/gvm/protocols/base.py”, line 107, in connect
self._connection.connect()
File “/usr/lib/python3/dist-packages/gvm/connections.py”, line 348, in connect
self._ssh_authentication()
File “/usr/lib/python3/dist-packages/gvm/connections.py”, line 331, in _ssh_authentication
raise GvmError(
gvm.errors.GvmError: Something went wrong with reading the known_hosts file: [Errno 2] No such file or directory: ‘/home/marco/.ssh/known_hosts’

In addition there are also 2 reported problems namely:
gmp is not defined
args is not defined

Can anyone please help me?

I tested this on my latest with 22.4, and it seems to work, but the docs seem a little out …

/usr/local/bin/gvm-script --gmp-username admin --gm
p-password admin tls --hostname 127.0.0.1 /scripts/scan-new-system.gmp.py target.host.com                                                 
                                                                                                                                          
        This script starts a new scan on the given host.                                                                                  
        It needs one parameters after the script name.                                                                                    
                                                                                                                                          
        1. <host_ip>        IP Address of the host system                                                                                 
        2. <port_list_id>   Port List UUID for scanning the host system.                                                                  
                            Preconfigured UUID might be under                                                                             
                            /var/lib/gvm/data-objects/gvmd/20.08/port_lists/.                                                             
                            ex. iana-tcp-udp is                                                                                           
                            "4a4717fe-57d2-11e1-9a26-406186ea4fc5".                                                                       
                                                                                                                                          
                Example:                                                                                                                  
            $ gvm-script --gmp-username name --gmp-password pass ssh --hostname <gsm> scripts/scan-new-system.gmp.py <host_ip> <port_list_
id> 

The docs from the script say it needs “one” parameter, and then lists two. My XP is that it needs both.

Also, it looks like you left out the hostname after the “–hostname”. If you are running this from the same host as your gvmd, then you should be able to use “127.0.0.1” as I did. Otherewise, the IP where your gvmd is running. Also note, I have gvmd listening on a tcp port, so I’m using the tls method vs the ssh method.

-Scott

sorry I misspelled the command, I used this:
$ gvm-script --gmp-username name --gmp-password pass ssh --hostname scripts scan-new-system.gmp.py <host_ip> <port_list_id>

where I replace name, pass, gsm, host ip and port list.

before I had also left " \ " after “password pass” … now when I execute the command written above it appears this:

gvm-script: error: the following arguments are required: CONNECTION_TYPE
unknown option - -
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
[-b bind_address] [-c cipher_spec] [-D [bind_address:] port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
[-i identity_file] [-J [user @] host [: port]] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-Q query_option] [-R address] [-S ctl_path] [-W host: port]
[-w local_tun [: remote_tun]] destination [command [argument …]]

I state that I am doing this on kali linux installed on virtual box, from windows 10 … my windows ip is therefore different from the ip I have on kali linux.

You need to set a connection type. Please take a look at the gvm-script --help output and the documentation of gvm-tools. For more info about the connection types you can take a look at Connection Types - gvm-tools

2 Likes