From e3a363cd7cd55edeb1d061be939a8b856a296b8b Mon Sep 17 00:00:00 2001 From: Timo Pollmeier Date: Wed, 27 Sep 2023 16:13:27 +0200 Subject: [PATCH] Fix: Fix getting hosts in application-detection The script application-detection.gmp.py will now get the report details and extract the host IP addresses correctly. --- scripts/application-detection.gmp.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/application-detection.gmp.py b/scripts/application-detection.gmp.py index 4eef5bc4..563d405c 100644 --- a/scripts/application-detection.gmp.py +++ b/scripts/application-detection.gmp.py @@ -39,12 +39,17 @@ def check_args(args): def print_assets(gmp, appname): - res = gmp.get_reports() + res = gmp.get_reports(details=True) - hosts = res.xpath("//host") + hosts = res.xpath("/get_reports_response/report/report/host") for host in hosts: ip = host.xpath("ip/text()") + if len(ip) == 0: + continue + else: + ip = ip[0] + hostname = host.xpath('detail/name[text()="hostname"]/../value/text()') if len(hostname) == 0: hostname = ""