{ "success": false, "message": "'GMPv227' object has no attribute 'get_assets'" }

it keeps returning GMPv227’ object has no attribute ‘get_assets’" }

this is my current code:
async def get_all_hosts_with_os(args):
try:
@run_gvm_sync
def sync_get_all_assets(gmp, **kwargs):
assets_list =

        assets_xml = gmp.get_assets()
        root = etree.fromstring(assets_xml)

        for asset in root.findall("asset"):
            asset_data = {
                "id": asset.get("id"),
                "name": asset.findtext("name"),
                "ip": asset.findtext("ip"),
                "os": asset.findtext("os") or "Unknown",
                "severity": asset.findtext("highest_threat") or "0.0",
                "first_seen": asset.findtext("first"),
                "last_seen": asset.findtext("last"),
            }
            assets_list.append(asset_data)

        return assets_list

    # ✅ This passes username/password to the wrapper
    result = await asyncio.to_thread(sync_get_all_assets, **vars(args))

    return {
        "success": True,
        "hosts": result,
    }

except Exception as e:
    return {
        "success": False,
        "message": str(e),
    }

I’ve checked my gvm it’s all up to date

Yes because the GMP object doesn’t have a get_assets method. At least not anymore. There is get_hosts and get_operating_systems instead.

3 Likes

Thank you for this! Has this been removed in the latest versions?

I really think it got removed a loooooong time ago. I can’t even find a version where it was available quickly.

2 Likes

I see. Is there a simpler way to fetch this data?
Currently, I have to parse it from the reports, which is a bit complicated. Ideally, I’d like to extract the OS and host information without going through a complex process.
I also tried using get_operating_systems, but it returns empty. Based on my research, it seems this only works if the OS information was manually entered in the OpenVAS “Operating Systems” section.

This topic was automatically closed after 90 days. New replies are no longer allowed.