Lucene search

K
nessusThis script is Copyright (C) 2023-2024 and is owned by Tenable, Inc. or an Affiliate thereof.REPORT_PACKAGE_MANAGER_PACKAGES_NIX.NASL
HistoryAug 01, 2023 - 12:00 a.m.

Package Manager Packages Report (nix)

2023-08-0100:00:00
This script is Copyright (C) 2023-2024 and is owned by Tenable, Inc. or an Affiliate thereof.
www.tenable.com
5
nix
package manager
installed packages

AI Score

7.3

Confidence

Low

Reports details about packages installed via package managers

#%NASL_MIN_LEVEL 80900
##
# (C) Tenable, Inc.
##

include('compat.inc');

if (description)
{
  script_id(179139);
  script_version("1.1");
  script_set_attribute(attribute:"plugin_modification_date", value:"2024/07/29");

  script_name(english:"Package Manager Packages Report (nix)");

  script_set_attribute(attribute:"synopsis", value:"Reports details about packages installed via package managers.");
  script_set_attribute(attribute:"description", value:"Reports details about packages installed via package managers");
  script_set_attribute(attribute:"solution", value:"n/a");
  script_set_attribute(attribute:"risk_factor", value:"None");

  script_set_attribute(attribute:"plugin_publication_date", value:"2023/08/01");

  script_set_attribute(attribute:"agent", value:"all");
  script_set_attribute(attribute:"plugin_type", value:"local");
  script_end_attributes();

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

  script_dependencies("unix_enum_sw.nasl");
  script_require_ports("Host/OS/uname");

  exit(0);
}

include('json2.inc');
include('linux_kb_parse_func.inc');
include('install_func.inc');
include('rpm.inc');
include('debian_package.inc');
include('inventory_agent.inc');
include('structured_data.inc');

function structure_nix_package_data(&object, pkg_mgr)
{
  var packages = get_packages(use_one_pkg_mgr:pkg_mgr);
  var pkg;
  foreach (var app in packages)
  {
    pkg = {
      pkg_name: app.properties.name,
      version: app.properties.version,
      # target_sw: '',
      managed_by: app.type
    };
    object.append('packages', pkg);
  }

}

var pacman = new('structured_data_package_manager_packages');
var pkg_mgr;

if (!empty_or_null(get_one_kb_item("Host/*/rpm-list")))
  pkg_mgr = "Host/*/rpm-list";
else if (!empty_or_null(get_one_kb_item("Host/*/dpkg-l")))
  pkg_mgr = "Host/*/dpkg-l";
else
  audit(AUDIT_HOST_NOT, "supported.");
structure_nix_package_data(object:pacman, pkg_mgr:pkg_mgr);
  
pacman.report_internal();

AI Score

7.3

Confidence

Low