Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display List of Scanners - OpenVAS #204

Open
karnamonkster opened this issue Jun 2, 2022 · 3 comments
Open

Display List of Scanners - OpenVAS #204

karnamonkster opened this issue Jun 2, 2022 · 3 comments

Comments

@karnamonkster
Copy link

Hi,

I am running a GVMD version 21.4.5 (Source install)
PatrowlManager - 1.8.4 Community Edition
PatrowlEngine - 1.5.3

I am able to scan with the default OpenVAS scanner, however I have multiple satellite scanners which are integrated to the GVMD (say its a Master).
I need to know if on Patrowl - while starting a scan, can I get the list of scanners from GVMD ?
similar to running a command
gvmd --get-scanners

Would be great to have this sorted :)

@karnamonkster karnamonkster changed the title List of Scanners - OpenVAS Display List of Scanners - OpenVAS Jun 2, 2022
@karnamonkster
Copy link
Author

Wondering how to use this code for getting scanners - from engine-openvas.py

def get_scanners(name=None):
    """Return the list of scanners' ID."""
    scanners_list = []
    connection = TLSConnection(
        hostname=engine.scanner["options"]["gmp_host"]["value"],
        port=engine.scanner["options"]["gmp_port"]["value"],
        timeout=int(engine.scanner["options"].get("timeout", DEFAULT_TIMEOUT))
    )
    with Gmp(connection) as gmp_cnx:
        gmp_cnx.authenticate(
            engine.scanner["options"]["gmp_username"]["value"],
            engine.scanner["options"]["gmp_password"]["value"])
        scanners_xml = gmp_cnx.get_scanners()
        try:
            scanners = ET.fromstring(scanners_xml)
        except Exception:
            return None
        if not scanners.get("status") == "200":
            return None

        for scanner in scanners.findall("scanner"):
            if name is not None:
                if name == scanner.find('name').text:
                    return [scanner.get("id")]
            else:
                scanners_list.append(scanner.get("id"))

    connection.disconnect()
    return scanners_list

@karnamonkster
Copy link
Author

Bump

@karnamonkster
Copy link
Author

Hi @MaKyOtOx ,

Could you please see if this is possible ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant