Skip to content

Commit

Permalink
Fix: Fix getting hosts in application-detection
Browse files Browse the repository at this point in the history
The script application-detection.gmp.py will now get the report
details and extract the host IP addresses correctly.
  • Loading branch information
timopollmeier committed Sep 28, 2023
1 parent afc6f2c commit e3a363c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/application-detection.gmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down

0 comments on commit e3a363c

Please sign in to comment.