Lucene search
K

Nutanix Data Collection

🗓️ 25 Apr 2022 00:00:00Reported by TenableType 
nessus
 nessus
🔗 www.tenable.com👁 31 Views

Nutanix Data Collection. Collects all data from Nutanix PC using REST APIs

Code
#TRUSTED 8c82058ba933d253fbe82cbf44cb32a6a048c3cf5f1cfafe3d5a2cb969b279db4d895e3c7772b078a3002be980476f2b31bbbe20455a70eb5ceca62025aaadfc94ab97031962c8dedcde23736a7725745540f6bf8d4f63e00bf90fa84438af821cd1f07000c47c2c7abc94eab25ddc68e5aa6e270437cec3b3f42cc2807483cfb17eaa5c6e186f53d26fc6da84c27066226c13864e347510ade0b35aa3d2587fffac6ba753f03a1bdcd6ffb9702bec9d6a19df594cb29a1e53861f40f8b3aab981007c797a8fbce2435cfa66930a6c17b8245f9578e60c9fd671bf224b947ed2e4d21538b4e42bcdc43844ccc9db6f2594ffba7343b168c09284cfac8b1b49ed31e1e3dd0a4ef2534d64f3be9cf289576f2317de320febedef14c7a27b0428c64c6dbf7284c4d04074fc2c4b2cb7926af8787ab7c628722c7a4dd3c5a9462c18e6636a0d64922dcdf0d398ebf00864172f9af35db30605252a75fcdc52056a60bcc6cc205db1e182703d075de1170fd5c27e7d6842f19939d0adb776fca45f511b56a5952d8008a967de14fc0337500a6dd211ed1e79c6bdbcda4912c1f87c80576bbd528898fdd9a562a10537a9e96d38762b04dde7309473c00fa68c7b9b748a8ed2e949922c7180282526da35d9c547d7027e22e9fc53bf9f3d53ecbe8fe1eb1c9e23655fd48d6e42f423c898a5c6935e3276158c90e0109c026ee7c8273b
#TRUST-RSA-SHA256 7d904240d3be6f1f35cb195974a1a565f98e592c5a4a49c5dcac23ed32bf4269b0d75f3267b4f439690abea3b816b97f90345ae8f73726b98414f939526f2e40357a2901d505c2de7bee5266513b11a851abc03af5e5c3c1fa23ddab840d70cfa56ee3f208292245225fc2a7a7308a913d1bac16e1a2791b55ddd21695e7fc734cfe37b1f7a3c7fbab7df6ea1ddef4dd441df5ae3883b14f1c9a4640e7810fea14b220ef6bfadd995249cec6d89900b5ef078f47c02f89b12a0735d2f778e54045dc9c1dd9471a87a6ba813a1f4e8d1b540e315212c30f81a4dfa13b3c67c5689929a62798f7beda77f379a80b70264ea482d3b926aa80e79617de21d70e6992210ca1df9523f5f3b7d9effbeae3257ae7f6efbc9fc3eb4771ab3f4a8d7918d24480a860a9d60520ea161b53ab9ad0e7e92bd6f145ada331135a21ed3a738a602e324027d3911715593da9f53cea5a65f0c398e8f9658f7010da0650e1c54dd71653bdd77b3073c40af61c70a7fd5a3e575846718d1c31fc9069ad226f5844626c837906b46f6b4358d620bf41bd8e3efa3fc7a5fe174a45997d76b360f3a90873464943c22b12411f895c266830e6f03552d59f41fbe8037897a41eec0da330b50c9b01ff022209d7c24a3d1b9889cdfd3bd2ac42b4fe60bb93822ccfc8f758d19aef9155b018d836d565bedaeaa724ac0f19ab66736126a1a4c17bd937cd98
###
# (C) Tenable Network Security, Inc.
#
###

include('deprecated_nasl_level.inc');
include("compat.inc");

if (description)
{
  script_id(160185);
  script_version("1.13");
  
  script_name(english:"Nutanix Data Collection");
  script_summary(english:"Collects Nutanix data.");

  script_set_attribute(attribute:"synopsis", value:"Collects all data from Nutanix PC using REST APIs.");
  script_set_attribute(attribute:"description", value:"Collects Nutanix data using REST APIs.");
  script_set_attribute(attribute:"solution", value:"n/a");

  script_set_attribute(attribute:"plugin_publication_date", value:"2022/04/25");
  script_set_attribute(attribute:"plugin_modification_date", value:"2025/11/24");
  script_set_attribute(attribute:"risk_factor", value:"None");
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"x-cpe:/o:nutanix:pc");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_copyright(english:"This script is Copyright (C) 2022-2025 and is owned by Tenable, Inc. or an Affiliate thereof.");
  script_family(english:"Misc.");

  script_dependencies("nutanix_settings.nasl");

  script_require_keys("Host/Nutanix/config/host", 
                      "Host/Nutanix/config/port", 
                      "Host/Nutanix/config/ssl", 
                      "Host/Nutanix/config/ssl_verify", 
                      "Secret/Nutanix/config/username", 
                      "Secret/Nutanix/config/password");

  script_timeout(0);

  exit(0);
}

if (!defined_func("inject_host") && defined_func("nasl_level") && nasl_level() <= 190200)
{
  exit(0, "Nessus older than 10.2");
}

include("compat_shared.inc");
include("http.inc");
include("nutanix.inc");
include("ssl_funcs.inc");
include("spad_log_func.inc");

if (defined_func("set_mem_limits")) 
{
  set_mem_limits(max_alloc_size:1024*1024*1024, max_program_size:1024*1024*1024);
}

##
# Wrapper for the collection and injection process.
##
function collect()
{
  var config = nutanix::init();
  set_global_kb_item(name:"Nutanix/DataCollection/CollectionIP", value:get_host_ip());

  # This function sets items in the global KB
  var collect_result = nutanix::collect(config:config);
  if (!collect_result.success)
  {
    nutanix::log(msg:"[Error] Collection failed.", lvl:1, config:config);
    return {success:FALSE};
  }

  # This section is where inject_host is used for 'Auto-Discovery'.
  var kb = { "host/injected/integration": "Nutanix" };
  var injected = 0;
  foreach (var ip in keys(collect_result.hosts_to_inject))
  {
    nutanix::log(msg:"Injecting Discovered Nutanix " + collect_result.hosts_to_inject[ip] + " -> " + ip + '\n', lvl:3, config:config);
    # Skip injecting 127.0.0.1, it is collected from Nutanix but should not be scanned this way.
    if ("127.0.0.1" >!< ip)
    {
      inject_host(hostname:ip, kb:kb);
      injected++;
    }
  }
  # NOTE: this logic only works because even if both auto-discovery toggles are OFF,
  # the Prism Element Cluster IP(s) always get injected. Therefore there should
  # always be at least one host that gets injected.
  if (!injected)
  {
    nutanix::log(msg:"[Error] no hosts were injected.", lvl:1, config:config);
    return {success:FALSE};
  }
  return {success:TRUE};
}

mutex_lock(SCRIPT_NAME);

if (empty_or_null(get_global_kb_item("Nutanix/collected")))
{
  var res = collect();
  set_global_kb_item(name:"Nutanix/collected", value:res.success);
}
else
{
  var collection_ip = get_global_kb_item("Nutanix/DataCollection/CollectionIP");
  spad_log(message:"Nutanix data has already been collected. Check results from " + collection_ip + " for the debugging log.");
}

mutex_unlock(SCRIPT_NAME);

var collected = get_global_kb_item_or_exit("Nutanix/collected", exit_code: 1, msg: "Data collection for Nutanix failed.");

if (!collected)
{
  var msg = "No information was collected from Nutanix Prism Central.";
  report_error(title:"Unable to collect Nutanix Prism Central data", message:msg, severity:1);

  exit(1, msg);
}

# Has Nutanix data collection already ran for this host?
if (!empty_or_null(get_kb_item("Host/Nutanix/DataCollection/ran")))
{
  exit(0);
}

# Current host we are running on for linking the collected data
var target_ip = get_host_ip();

var cluster_ip = get_global_kb_item("Nutanix/Cluster/" + target_ip + "/ip");
var node_ip = get_global_kb_item("Nutanix/Nodes/" + target_ip + "/ip");
var nutanix_port = get_kb_item("Host/Nutanix/config/port");

var version, report;

# Reports cluster data
if (!empty_or_null(cluster_ip))
{
  var service = get_global_kb_item("Nutanix/Cluster/" + target_ip + "/service");
  version = get_global_kb_item("Nutanix/Cluster/" + target_ip + "/version");
  var lts = get_global_kb_item("Nutanix/Cluster/" + target_ip + "/lts");
  var full_version = get_global_kb_item("Nutanix/Cluster/" + target_ip + "/full_version");
  var arch = get_global_kb_item("Nutanix/Cluster/" + target_ip + "/arch");

  set_kb_item(name:"Host/Nutanix/Data/Service", value:service);
  set_kb_item(name:"Host/Nutanix/Data/Version", value:version);
  set_kb_item(name:"Host/Nutanix/Data/lts", value:lts);
  set_kb_item(name:"Host/Nutanix/Data/ip", value:cluster_ip);
  set_kb_item(name:"Host/Nutanix/Data/full_version", value:full_version);
  set_kb_item(name:"Host/Nutanix/Data/arch", value:arch);

  report =
    'Collected Nutanix Data\n\n' +
    'Service: ' + service + '\n' +
    'Version: ' + version + '\n' +
    'Full Version: ' + full_version + '\n' +
    'LTS: ' + lts + '\n' +
    'Arch: ' + arch + '\n';

  security_report_v4(port:nutanix_port, extra:report, severity:SECURITY_NOTE);
}
# Reports node data
else if (!empty_or_null(node_ip))
{
  version = get_global_kb_item("Nutanix/Nodes/" + target_ip + "/version");
  var type = get_global_kb_item("Nutanix/Nodes/" + target_ip + "/type");

  set_kb_item(name:"Host/Nutanix/Data/Node/Ip", value:node_ip);
  set_kb_item(name:"Host/Nutanix/Data/Node/Version", value:version);
  set_kb_item(name:"Host/Nutanix/Data/Node/Type", value:type);

  report = 
    'Collected Nutanix Data :\n\n' +
    'IP Address: ' + node_ip + '\n' +
    'Version: ' + version + '\n' +
    'Type: ' + type + '\n';

  security_report_v4(port:nutanix_port, extra:report, severity:SECURITY_NOTE);
}

set_kb_item(name:"Host/Nutanix/DataCollection/ran", value:TRUE);

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

24 Nov 2025 00:00Current
7High risk
Vulners AI Score7
31