Lucene search

K
nessusThis script is Copyright (C) 2015-2024 and is owned by Tenable, Inc. or an Affiliate thereof.NESSUS_PRODUCT_SETUP.NASL
HistoryJun 02, 2015 - 12:00 a.m.

Nessus Product Information

2015-06-0200:00:00
This script is Copyright (C) 2015-2024 and is owned by Tenable, Inc. or an Affiliate thereof.
www.tenable.com
66

7 High

AI Score

Confidence

Low

Set up Nessus product information to help facilitate some plugins to detect what platform they are running on.

#TRUSTED 36859b03d7bc9500a7b962b2f058824af8c9ac57acbbdc866b01f698afca22d80a984698938582aa15f80252cf8f7d0c50b99384b6690bc0b00ff8bc56ee86c2bc31a52a9444de2aa3b96d90d09e89e3db8d5278c27204d440d67836d08bafaaedf7992ad82a0bc3acd8095a90323e3c35419f1f700434ed5647d49f44e43f1ffa6144665d50a94e2a1901290e8dbf365cdc31d09cd450cbb4fcd8d916ac360b06afafa1ef29cadb46cda5055c984285db8b02edd977252a5cae2526fc4f90d667ad3952cf2c3349521c6e4b1ef24075308ece8271727b55bea470e77c1845ddf5c8177b8cb181f18c1191bf1380ae7bf1d9cd0a0362229e7f81d381088bea37be71d924b62888b98e5f8ee80d535c86d5e2b33666ce107dbe9969b303e32d7f567cd61ce620eaf63a6d4319e14c0ded0ea3c4ca9f3b67fa782301ba4dd61b5b58c4bb99b5a66ec43ce7d153e226bbcfe4a600265e8325bcd01f16c7e95740066c1b3de89808a3fdc2b6487f5f95bd2a551e3c402b7efeb4bb432e6d60f59d2227ba9bf8dbaabc9fa8b13583bdf47d13d562105743c4dc0d8d616cfddd4f3dfedf9a0dbbb4f8a35a281083f1bd384936a8171ee0f8a847cd986aaf5ad322c0b96a332daa39033fe14e488586b70b9d753e27715f3cded86bd33c6e979ce8a7eaabcccd171bf6732e7452d393057b73f3ac0d00612a4aaa200d2b851530f0d578
#TRUST-RSA-SHA256 1baf8c2ac89069d6aadc1b5ff965ec36e93b3caba8c426f1d7af6e14a7513467c88f1db779ccf029a43ca510a95d0fa679c428d504f0700a44c57224494f8571140c0ef576f4dad0d76dadbc229bda52490d445a7d687a9fa220843ed0a21330292e590a3e5bd01bd8dc55fa7a7a8ea570fa8790ab09e794735a2af1c2f4dd1778965f266970cda84e3f4c1f44e537059eb47549db9f6f979ee3e01ca67d43a871544483cefba080855462f0208076ef4b5f009e3c7ecd643cddd4e73b1eaa9b5da88b9a212db9f11157a647430f65de53a7a52ae50f2632decb6891499a135e5eeaebb65a2fe89404be05577057ed8f9ecc7fdefbe19d7bc39d9815933415f6c891ddbb1d61d8a6448ef1636b76e144e5d374bc49b12f106a9abc03d312785ac38f53bc6a153badce24f66f3a0402b0b9ea6855a5069e9c5821413b8399b7ed8c42852d552159d510c50a12b714664c036fcbd16e6eaab58a6621264582ac78bebc5be38a8366491972825d58e233e0fbab0ab732f257719c9b44192282ad882d080035c47e7f8907423aac8a3213beedea8ed9b6a0b05edba52713045ee4a2335dbfd75edf7a25ca00805e84e86f51da4bec741c3ba2e95b9e805bd3874d7a83b47be2a8466b6c36e1f8b35c7de171536bdc8bd052d668eef5b0f88ba0c7e640340fb1a8a0b4373a7dc84a5e6bea1780c196d493a564bdf27115778e3deaa2
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
 script_id(83955);
 script_version("1.12");
 script_set_attribute(attribute:"plugin_modification_date", value:"2024/06/27");

 script_name(english:"Nessus Product Information");
 script_summary(english:"Initializes information used in Nessus product detection.");

 script_set_attribute(attribute:"synopsis", value:
"Set up information about which Nessus product is running.");
 script_set_attribute(attribute:"description", value:
"Set up Nessus product information to help facilitate some plugins to
detect what platform they are running on.");
 script_set_attribute(attribute:"solution", value:"n/a");
 script_set_attribute(attribute:"risk_factor", value:"None");

 script_set_attribute(attribute:"plugin_publication_date", value:"2015/06/02");

 script_set_attribute(attribute:"plugin_type", value:"summary");
 script_set_attribute(attribute:"always_run", value:TRUE);
 script_set_attribute(attribute:"agent", value:"all");
 script_end_attributes();

 script_category(ACT_INIT);

 script_copyright(english:"This script is Copyright (C) 2015-2024 and is owned by Tenable, Inc. or an Affiliate thereof.");
 script_family(english:"Settings");

 exit(0);
}
include("global_settings.inc");
include("misc_func.inc");
include("nessusd_product_info.inc");

var report = "Nessus product is ";

# nessus environment
var env = nessusd_env();
var agent_binary = NULL;

if(nessusd_is_agent())
  agent_binary = "tenable-utils-";

if (!isnull(env['product']))
{
  if (env['product'] == PRODUCT_WIN_AGENT)
  {
    agent_binary += "WINDOWS-" + env["hwarch"] + ".bin";
    report += 'Windows Agent.\n';
  }
  else if (env['product'] == PRODUCT_UNIX_AGENT)
  {
    if (env['os'] == 'DARWIN')
    {
      agent_binary += "DARWIN" + ".bin";
      env['product'] = PRODUCT_MAC_AGENT;
      report += 'Mac Agent.\n';
    }
    else
    {
      agent_binary += "LINUX-" + env["hwarch"] + ".bin";
      report += 'Unix Agent.\n';
    }
  }
  else if (env['product'] == PRODUCT_NESSUSD) report += 'Nessus Scanner.\n';
  else if (env['product'] == PRODUCT_NESSUSD_NSX) report += 'Nessus NSX Scanner.\n';

  else report += 'undetermined.\n';
}
else
{
  report = 'No Nessus Product information available.\n';
}

replace_kb_item(name:"nessus/product", value:env['product']);
replace_kb_item(name:"nessus/os", value:env['os']);

if (nessusd_is_agent())
{
  # Agent bool set
  replace_kb_item(name:"nessus/product/agent", value:TRUE);

  if(!isnull(agent_binary))
  {
    var env = nessusd_env();
    var path_sep = "/";
    if(env["os"] == "WINDOWS")
      path_sep = "\\";

    var path = nessus_get_dir(N_PLUGIN_DIR) + path_sep;

    if(validate_agent_binary(path, agent_binary))
    {
      pread_wrapper(cmd: "chmod", argv: ["chmod", "+x", path + agent_binary]);
      var priority = get_preference("scan_performance_mode");
      if(!isnull(priority))
      {
        var priority_delay, batch_size;
        switch(priority)
        {
          case "medium":
            priority_delay = "0.0001";
            batch_size = 5;
            break;
          case "low":
            priority_delay = "0.0004";
            batch_size = 5;
            break;
        }

        if(!isnull(priority_delay))
          replace_kb_item(name:"nessus/utils/delay", value:priority_delay);
        if(!isnull(batch_size))
          replace_kb_item(name:"nessus/utils/batch-size", value:batch_size);
      }

      var selected = get_preference("use_tenable_utils");

      if(!isnull(selected) && selected == "yes")
        replace_kb_item(name:"nessus/utils", value:agent_binary);
    }
    else
    {
      replace_kb_item(name:"nessus/failed_utils_validation", value:TRUE);
    }
  }
}

# local scan set
if (nessusd_is_local()) replace_kb_item(name:"nessus/product/local", value:TRUE);

# Set feed time for UCF
var plugin_feed_info = nessusd_plugin_feed_info();
if (plugin_feed_info["PLUGIN_SET"])
  replace_kb_item(name:"PluginFeed/Version", value:plugin_feed_info["PLUGIN_SET"]);

##
# Returns whether or not the scanner machine is a Nessus Enterprise Cloud system
#
# @return 1 if the Nessus msp_scanner file exists, or the Nessus msp file exists and its MD5 is a specific string
#         else 0 (&& FALSE)
##
function is_nec()
{
  local_var separator, path;
  if (platform() == 'WINDOWS')
    separator = '\\';
  else
    separator = '/';

  path = nessus_get_dir(N_STATE_DIR) + separator + 'msp_scanner';
  if ( file_stat(path) > 0 ) return 1;

  path = nessus_get_dir(N_STATE_DIR) + separator + 'msp';
  return file_stat(path) > 0 &&  hexstr(MD5(fread(path))) == 'bcc7b34f215f46e783987c5f2e6199e5';
}

if (is_nec())
{
  replace_kb_item(name:"Host/msp_scanner", value:TRUE);
}

exit(0, report);

7 High

AI Score

Confidence

Low