SSH login-based detection of PostgreSQL on Linux/Uni
# SPDX-FileCopyrightText: 2009 Greenbone AG
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-only
if(description)
{
script_oid("1.3.6.1.4.1.25623.1.0.900478");
script_version("2024-07-19T15:39:06+0000");
script_tag(name:"last_modification", value:"2024-07-19 15:39:06 +0000 (Fri, 19 Jul 2024)");
script_tag(name:"creation_date", value:"2009-03-26 11:19:12 +0100 (Thu, 26 Mar 2009)");
script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N");
script_tag(name:"cvss_base", value:"0.0");
script_name("PostgreSQL Detection (Linux/Unix SSH Login)");
script_category(ACT_GATHER_INFO);
script_copyright("Copyright (C) 2009 Greenbone AG");
script_family("Product detection");
script_dependencies("gather-package-list.nasl");
script_mandatory_keys("login/SSH/success");
script_exclude_keys("ssh/no_linux_shell");
script_tag(name:"summary", value:"SSH login-based detection of PostgreSQL.");
script_tag(name:"qod_type", value:"executable_version");
exit(0);
}
include("ssh_func.inc");
include("host_details.inc");
sock = ssh_login_or_reuse_connection();
if(!sock)
exit(0);
port = kb_ssh_transport();
binaries = ssh_find_file(file_name:"/psql$", useregex:TRUE, sock:sock);
foreach binary(binaries) {
binary = chomp(binary);
if(!binary)
continue;
vers = ssh_get_bin_version(full_prog_name:binary, version_argv:"--version", ver_pattern:"psql \(PostgreSQL\) ([0-9.]+)", sock:sock);
if(!isnull(vers[1])) {
found = TRUE;
set_kb_item(name:"postgresql/ssh-login/" + port + "/installs", value:"0#---#" + binary + "#---#" + vers[1] + "#---#" + vers[0]);
}
}
if(found) {
set_kb_item(name:"postgresql/detected", value:TRUE);
set_kb_item(name:"postgresql/ssh-login/detected", value:TRUE);
set_kb_item(name:"postgresql/ssh-login/port", value:port);
}
ssh_close_connection();
exit(0);
Transform Your Security Services
Elevate your offerings with Vulners' advanced Vulnerability Intelligence. Contactย us for a demo andย discover the difference comprehensive, actionable intelligence can make in your security strategy.
Book a live demo